Package org.semanticweb.owlapi.model
Interface PrefixManager
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
PrefixDocumentFormat
- All Known Implementing Classes:
AbstractRDFPrefixDocumentFormat
,DefaultPrefixManager
,FunctionalSyntaxDocumentFormat
,ManchesterSyntaxDocumentFormat
,OWLXMLDocumentFormat
,PrefixDocumentFormatImpl
,RDFXMLDocumentFormat
,TurtleDocumentFormat
A prefix manager than can provide prefixes for prefix names.
- Since:
- 2.2.0
- Author:
- Matthew Horridge, The University Of Manchester, Information Management Group
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the map.boolean
containsPrefixMapping
(String prefixName) Determines if this manager knows about a given prefix name and it contains a (non-null) mapping for the prefix.void
copyPrefixesFrom
(Map<String, String> from) Copies the prefix from another prefix manager into this one.void
Copies the prefix from another prefix manager into this one.Gets the default prefix.Gets the URI for a given prefix IRI.Gets the prefix that is bound to a particular prefix name.getPrefixIRI
(IRI iri) Gets the prefix IRI given a IRI (URI).Gets the prefix IRI given a IRI (URI).Gets a map that maps prefix names to prefixes.Gets the prefix names that have a mapping in this prefix manager.Gets the prefix names that have a mapping in this prefix manager.void
setDefaultPrefix
(String defaultPrefix) Sets the default namespace.void
Adds a prefix name to prefix mapping.void
setPrefixComparator
(StringComparator comparator) void
unregisterNamespace
(String namespace) Removes a previously registered prefix namespace mapping.
-
Method Details
-
getPrefixComparator
StringComparator getPrefixComparator()- Returns:
- the prefix comparator currently used by the prefix manager
-
setPrefixComparator
- Parameters:
comparator
- the comparator to use
-
getDefaultPrefix
Gets the default prefix. The default prefix is denoted by the prefix name ":"- Returns:
- The default prefix, or
null
if there is no default prefix.
-
setDefaultPrefix
Sets the default namespace. This will also bind the prefix name ":" to this prefix- Parameters:
defaultPrefix
- The namespace to be used as the default namespace. Note that the value may benull
in order to clear the default namespace.
-
containsPrefixMapping
Determines if this manager knows about a given prefix name and it contains a (non-null) mapping for the prefix.- Parameters:
prefixName
- The prefix name to be tested for.- Returns:
true
if the manager knows about this prefix and there is a non-null mapping for this prefix.
-
getPrefix
Gets the prefix that is bound to a particular prefix name. Note that specifying ":" corresponds to requesting the default prefix and will return the same result as a call to thegetDefaultPrefix()
method.- Parameters:
prefixName
- The prefix name. A string that represents a prefix name of the prefix to be retrieved. Note that specifying ":" is the same as asking for the default prefix (see the getDefaultPrefix() method).- Returns:
- The prefix, or
null
if there is no prefix name bound to this prefix, or the prefix name doesn't exist.
-
getPrefixName2PrefixMap
Gets a map that maps prefix names to prefixes.- Returns:
- The map of prefix names to prefixes. Note that modifying the contents of this map will not change the prefix name - prefix mappings
-
getIRI
Gets the URI for a given prefix IRI. The prefix IRI must have a prefix name that is registered with this manager, or a runtime exception will be thrown.- Parameters:
prefixIRI
- The Prefix IRI- Returns:
- The full IRI.
- Throws:
OWLRuntimeException
- if the prefix name of the prefix IRI doesn't have a corresponding prefix managed by this manager.
-
getPrefixIRI
Gets the prefix IRI given a IRI (URI).- Parameters:
iri
- The IRI whose prefix it to be retrieved- Returns:
- The prefix IRI for this IRI, or
null
if a prefix IRI cannot be generated.
-
getPrefixIRIIgnoreQName
Gets the prefix IRI given a IRI (URI). Does not restrict the response to be a QName- Parameters:
iri
- The IRI whose prefix it to be retrieved- Returns:
- The prefix IRI for this IRI, or
null
if a prefix IRI cannot be generated.
-
getPrefixNames
Gets the prefix names that have a mapping in this prefix manager.- Returns:
- The prefix names as a set of strings. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
prefixNames
Gets the prefix names that have a mapping in this prefix manager.- Returns:
- The prefix names as a set of strings.
-
setPrefix
Adds a prefix name to prefix mapping.- Parameters:
prefixName
- name The prefix name (must end with a colon)prefix
- The prefix.
-
copyPrefixesFrom
Copies the prefix from another prefix manager into this one.- Parameters:
from
- The manager that the prefixes should be copied from
-
copyPrefixesFrom
Copies the prefix from another prefix manager into this one.- Parameters:
from
- The map containing the prefixes
-
unregisterNamespace
Removes a previously registered prefix namespace mapping.- Parameters:
namespace
- The namespace to be removed.
-
clear
void clear()Clear the map.
-