| com.hp.hpl.jena.shared.PrefixMapping
All known Subclasses: com.hp.hpl.jena.shared.impl.PrefixMappingImpl, com.hp.hpl.jena.rdf.model.impl.ModelCom, com.hp.hpl.jena.graph.compose.PolyadicPrefixMappingImpl,
PrefixMapping | public interface PrefixMapping (Code) | | 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.
author: kers |
Inner Class :public static class IllegalPrefixException extends JenaException | |
Inner Class :public static class JenaLockedException extends JenaException | |
Inner Class :public static class Factory | |
Extended | final public static PrefixMapping Extended(Code) | | A PrefixMapping built on Standard with some extras
|
Standard | final public static PrefixMapping Standard(Code) | | A PrefixMapping that contains the "standard" prefixes we know about,
viz rdf, rdfs, dc, rss, vcard, and owl.
|
expandPrefix | String expandPrefix(String prefixed)(Code) | | Expand the uri using the prefix mappings if possible. If prefixed has the
form Foo:Bar, and Foo is a prefix bound to FooURI, return FooURI+Bar.
Otherwise return prefixed unchanged.
Parameters: prefixed - a QName or URI the expanded string if possible, otherwise the original string |
getNsPrefixMap | Map getNsPrefixMap()(Code) | | Return a copy of the internal mapping from names to URI strings. Updating
this copy will have no effect on the PrefixMap.
a copy of the internal String -> String mapping |
getNsPrefixURI | String getNsPrefixURI(String prefix)(Code) | | Get the URI bound to a specific prefix, null if there isn't one.
Parameters: prefix - the prefix name to be looked up the most recent URI bound to that prefix name, null if none |
getNsURIPrefix | String getNsURIPrefix(String uri)(Code) | | Answer the prefix for the given URI, or null if there isn't one.
If there is more than one, one of them will be picked. If possible,
it will be the most recently added prefix. (The cases where it's not
possible is when a binding has been removed.)
Parameters: uri - the uri whose prefix is to be found the prefix mapped to that uri, or null if there isn't one |
lock | PrefixMapping lock()(Code) | | Lock the PrefixMapping so that changes can no longer be made to it.
Primarily intended to lock Standard against mutation.
this mapping, locked against changes |
qnameFor | String qnameFor(String uri)(Code) | | Answer a qname with the expansion of the given uri, or null if no such qname
can be constructed using the mapping's prefixes.
|
removeNsPrefix | PrefixMapping removeNsPrefix(String prefix)(Code) | | Remove any existing maplet with the given prefix name and answer this
mapping. If the prefix is the empty string, then this removes the default
namespace. If the prefix is not a legal prefix string, or is not present in
the mapping, nothing happens.
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.
Parameters: prefix - the prefix string to remove this PrefixMapping |
samePrefixMappingAs | boolean samePrefixMappingAs(PrefixMapping other)(Code) | | 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.
|
setNsPrefix | PrefixMapping setNsPrefix(String prefix, String uri)(Code) | | Specify the prefix name for a URI prefix string. Any existing use of
that prefix name is overwritten. The result is this same prefixMapping.
(The earlier restriction that adding second prefix for the same URI
caused the earlier binding to be deleted has been withdrawn.)
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.
Parameters: prefix - the string to be used for the prefix. Parameters: uri - the URI prefix to be named exception: IllegalPrefixException - if the prefix is not an XML NCName this PrefixMapping |
setNsPrefixes | PrefixMapping setNsPrefixes(PrefixMapping other)(Code) | | Copies the prefixes from other into this. Any existing binding of the
same prefix is lost. The result is this same prefixMapping.
Parameters: other - the PrefixMapping to add this PrefixMapping |
setNsPrefixes | PrefixMapping setNsPrefixes(Map map)(Code) | | Copies the prefix mapping from other into this. Illegal prefix mappings
are detected. Existing binds of the same prefix are lost. The result is this
same prefixMapping.
Parameters: map - the Map whose maplets are to be added this PrefixMapping |
shortForm | String shortForm(String uri)(Code) | | Compress the URI using the prefix mappings if possible. If there is a
prefix mapping Name -> URIStart, and uri is URIStart+Tail, return Name:Tail;
otherwise return uri unchanged. If there are multiple applicable mappings
available, the "most recent" is chosen if that is possible, otherwise
one is picked "at random".
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.
Parameters: uri - the URI string to try and prefix-compress the shortened form if possible, otherwise the unchanged argument |
withDefaultMappings | PrefixMapping withDefaultMappings(PrefixMapping map)(Code) | | Update this PrefixMapping with the bindings in map , only
adding those (p, u) pairs for which neither p nor u appears in this mapping.
Answer this PrefixMapping.
|
|
|