|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PrefixMapping
Methods for recording namepsace prefix mappings and applying and unapplying them to URIs.
Note that a Model *is* a PrefixMapping, so all the PrefixMapping operations apply to Models, and a Model can be used to supply the PrefixMapping argument to setNsPrefixes.
Nested Class Summary | |
---|---|
static class |
PrefixMapping.Factory
Factory class to create an unspecified kind of PrefixMapping. |
static class |
PrefixMapping.IllegalPrefixException
Exception to throw when the prefix argument to setNsPrefix is illegal for some reason. |
static class |
PrefixMapping.JenaLockedException
Exception to throw when trying to update a locked PrefixMapping. |
Field Summary | |
---|---|
static PrefixMapping |
Extended
A PrefixMapping built on Standard with some extras |
static PrefixMapping |
Standard
A PrefixMapping that contains the "standard" prefixes we know about, viz rdf, rdfs, dc, rss, vcard, and owl. |
Method Summary | |
---|---|
java.lang.String |
expandPrefix(java.lang.String prefixed)
Expand the uri using the prefix mappings if possible. |
java.util.Map<java.lang.String,java.lang.String> |
getNsPrefixMap()
Return a copy of the internal mapping from names to URI strings. |
java.lang.String |
getNsPrefixURI(java.lang.String prefix)
Get the URI bound to a specific prefix, null if there isn't one. |
java.lang.String |
getNsURIPrefix(java.lang.String uri)
Answer the prefix for the given URI, or null if there isn't one. |
PrefixMapping |
lock()
Lock the PrefixMapping so that changes can no longer be made to it. |
java.lang.String |
qnameFor(java.lang.String uri)
Answer a qname with the expansion of the given uri, or null if no such qname can be constructed using the mapping's prefixes. |
PrefixMapping |
removeNsPrefix(java.lang.String prefix)
Remove any existing maplet with the given prefix name and answer this mapping. |
boolean |
samePrefixMappingAs(PrefixMapping other)
Answer true iff this prefix-mappings are equal, that is, map the same prefixes to the same URIs; same as this.getNsPrefixMap().equals( other.getNsPrefixMap() ) except that it may avoid unnecessary Map creations. |
PrefixMapping |
setNsPrefix(java.lang.String prefix,
java.lang.String uri)
Specify the prefix name for a URI prefix string. |
PrefixMapping |
setNsPrefixes(java.util.Map<java.lang.String,java.lang.String> map)
Copies the prefix mapping from other into this. |
PrefixMapping |
setNsPrefixes(PrefixMapping other)
Copies the prefixes from other into this. |
java.lang.String |
shortForm(java.lang.String uri)
Compress the URI using the prefix mappings if possible. |
PrefixMapping |
withDefaultMappings(PrefixMapping map)
Update this PrefixMapping with the bindings in map , only
adding those (p, u) pairs for which neither p nor u appears in this mapping. |
Field Detail |
---|
static final PrefixMapping Standard
static final PrefixMapping Extended
Method Detail |
---|
PrefixMapping setNsPrefix(java.lang.String prefix, java.lang.String uri)
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.
prefix
- the string to be used for the prefix.uri
- the URI prefix to be named
PrefixMapping.IllegalPrefixException
- if the prefix is not an XML NCNamePrefixMapping removeNsPrefix(java.lang.String prefix)
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.
prefix
- the prefix string to remove
PrefixMapping setNsPrefixes(PrefixMapping other)
other
- the PrefixMapping to add
PrefixMapping setNsPrefixes(java.util.Map<java.lang.String,java.lang.String> map)
map
- the Map whose maplets are to be added
PrefixMapping withDefaultMappings(PrefixMapping map)
map
, only
adding those (p, u) pairs for which neither p nor u appears in this mapping.
Answer this PrefixMapping.
java.lang.String getNsPrefixURI(java.lang.String prefix)
prefix
- the prefix name to be looked up
java.lang.String getNsURIPrefix(java.lang.String uri)
uri
- the uri whose prefix is to be found
java.util.Map<java.lang.String,java.lang.String> getNsPrefixMap()
java.lang.String expandPrefix(java.lang.String prefixed)
prefixed
- a QName or URI
java.lang.String shortForm(java.lang.String uri)
The result is primarily intended for human convenience: it is not necessarily a legal QName, as Tail need not be a legal NCName; and there's no way to tell a shortened name from a URI with an unusual scheme.
uri
- the URI string to try and prefix-compress
java.lang.String qnameFor(java.lang.String uri)
PrefixMapping lock()
boolean samePrefixMappingAs(PrefixMapping other)
this.getNsPrefixMap().equals( other.getNsPrefixMap() )except that it may avoid unnecessary Map creations.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |