public class PolyadicPrefixMappingImpl extends PrefixMappingImpl implements PrefixMapping
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedException
Extended, Standard
Constructor and Description |
---|
PolyadicPrefixMappingImpl(Polyadic p) |
Modifier and Type | Method and Description |
---|---|
PrefixMapping |
clearNsPrefixMap()
Clear this prefix mapping of all mappings
|
String |
expandPrefix(String prefixed)
Expand a prefixed URI.
|
Map<String,String> |
getNsPrefixMap()
Return a copy of the internal mapping from names to URI strings.
|
String |
getNsPrefixURI(String prefix)
Get the URI bound to a specific prefix, null if there isn't one.
|
String |
getNsURIPrefix(String uri)
Answer the prefix for the given URI, or null if there isn't one.
|
boolean |
hasNoMappings()
Return whether the prefix mapping has any defined prefixes.
|
int |
numPrefixes()
Return the number of defined prefixes.
|
String |
qnameFor(String uri)
Answer the qname for
uri which uses a prefix from this
mapping, or null if there isn't one. |
PrefixMapping |
removeNsPrefix(String prefix)
Remove any existing maplet with the given prefix name and answer this
mapping.
|
PrefixMapping |
setNsPrefix(String prefix,
String uri)
Specify the prefix name for a URI prefix string.
|
PrefixMapping |
setNsPrefixes(Map<String,String> other)
Add the bindings in the map to our own.
|
PrefixMapping |
setNsPrefixes(PrefixMapping other)
Add the bindings of other to our own.
|
String |
shortForm(String uri)
Compress the URI using the prefix mapping.
|
String |
toString()
Answer a readable (we hope) representation of this prefix mapping.
|
isNiceURI, lock, samePrefixMappingAs, withDefaultMappings
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
lock, samePrefixMappingAs, withDefaultMappings
public PolyadicPrefixMappingImpl(Polyadic p)
public PrefixMapping setNsPrefix(String prefix, String uri)
PrefixMapping
A prefix name must be a valid NCName, or the empty string. The empty string is reserved to mean "the default namespace".
Need not check the RFC2396 validity of the URI. Bad URIs are either silently ignored or behave as if they were good. The earlier restriction that the URI should end with a non-NCName character has been removed.
Note, in particular, that the prefix mapping can only be used if it includes the URI up to any '#' character because '#' is not legal in the local part of an NCName.
setNsPrefix
in interface PrefixMapping
setNsPrefix
in class PrefixMappingImpl
prefix
- the string to be used for the prefix.uri
- the URI prefix to be namedpublic PrefixMapping removeNsPrefix(String prefix)
PrefixMapping
The reverse URI-to-prefix mapping is updated, but if there are multiple prefixes for the removed URI it is unspecified which of them will be chosen.
removeNsPrefix
in interface PrefixMapping
removeNsPrefix
in class PrefixMappingImpl
prefix
- the prefix string to removepublic PrefixMapping clearNsPrefixMap()
PrefixMapping
clearNsPrefixMap
in interface PrefixMapping
clearNsPrefixMap
in class PrefixMappingImpl
public PrefixMapping setNsPrefixes(PrefixMapping other)
setNsPrefixes
in interface PrefixMapping
setNsPrefixes
in class PrefixMappingImpl
other
- the PrefixMapping whose bindings we are to add to this.public PrefixMapping setNsPrefixes(Map<String,String> other)
setNsPrefixes
in interface PrefixMapping
setNsPrefixes
in class PrefixMappingImpl
other
- the Map whose bindings we are to add to this.public String getNsPrefixURI(String prefix)
PrefixMapping
getNsPrefixURI
in interface PrefixMapping
getNsPrefixURI
in class PrefixMappingImpl
prefix
- the prefix name to be looked uppublic Map<String,String> getNsPrefixMap()
PrefixMapping
getNsPrefixMap
in interface PrefixMapping
getNsPrefixMap
in class PrefixMappingImpl
public String getNsURIPrefix(String uri)
PrefixMapping
getNsURIPrefix
in interface PrefixMapping
getNsURIPrefix
in class PrefixMappingImpl
uri
- the uri whose prefix is to be foundpublic String expandPrefix(String prefixed)
expandPrefix
in interface PrefixMapping
expandPrefix
in class PrefixMappingImpl
prefixed
- a QName or URIpublic String toString()
toString
in class PrefixMappingImpl
public String shortForm(String uri)
shortForm
in interface PrefixMapping
shortForm
in class PrefixMappingImpl
uri
- the URI string to try and prefix-compresspublic boolean hasNoMappings()
PrefixMapping
hasNoMappings
in interface PrefixMapping
hasNoMappings
in class PrefixMappingImpl
public int numPrefixes()
PrefixMapping
numPrefixes
in interface PrefixMapping
numPrefixes
in class PrefixMappingImpl
public String qnameFor(String uri)
PrefixMappingImpl
uri
which uses a prefix from this
mapping, or null if there isn't one.
Relies on splitNamespace
to carve uri into namespace and
localname components; this ensures that the localname is legal and we just
have to (reverse-)lookup the namespace in the prefix table.
qnameFor
in interface PrefixMapping
qnameFor
in class PrefixMappingImpl
PrefixMapping.qnameFor(java.lang.String)
Licenced under the Apache License, Version 2.0