Class PrefixDocumentFormatImpl

java.lang.Object
org.semanticweb.owlapi.model.OWLDocumentFormatImpl
org.semanticweb.owlapi.formats.PrefixDocumentFormatImpl
All Implemented Interfaces:
Serializable, PrefixDocumentFormat, OWLDocumentFormat, PrefixManager
Direct Known Subclasses:
AbstractRDFPrefixDocumentFormat, FunctionalSyntaxDocumentFormat, ManchesterSyntaxDocumentFormat, OWLXMLDocumentFormat

public class PrefixDocumentFormatImpl extends OWLDocumentFormatImpl implements PrefixDocumentFormat
A PrefixOWLDocumentFormat delegates all PrefixManager operations to a PrefixManager implementation.
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
See Also:
  • Constructor Details

    • PrefixDocumentFormatImpl

      public PrefixDocumentFormatImpl()
      Default constructor.
    • PrefixDocumentFormatImpl

      public PrefixDocumentFormatImpl(PrefixManager manager)
      Parameters:
      manager - prefix manager to use
  • Method Details

    • setPrefixManager

      public void setPrefixManager(PrefixManager m)
      Specified by:
      setPrefixManager in interface PrefixDocumentFormat
      Parameters:
      m - prefix manager to use
    • setPrefix

      public void setPrefix(String prefixName, String prefix)
      Description copied from interface: PrefixManager
      Adds a prefix name to prefix mapping.
      Specified by:
      setPrefix in interface PrefixManager
      Parameters:
      prefixName - name The prefix name (must end with a colon)
      prefix - The prefix.
    • clear

      public void clear()
      Description copied from interface: PrefixManager
      Clear the map.
      Specified by:
      clear in interface PrefixManager
    • prefixNames

      public Stream<String> prefixNames()
      Description copied from interface: PrefixManager
      Gets the prefix names that have a mapping in this prefix manager.
      Specified by:
      prefixNames in interface PrefixManager
      Returns:
      The prefix names as a set of strings.
    • containsPrefixMapping

      public boolean containsPrefixMapping(String prefixName)
      Description copied from interface: PrefixManager
      Determines if this manager knows about a given prefix name and it contains a (non-null) mapping for the prefix.
      Specified by:
      containsPrefixMapping in interface PrefixManager
      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.
    • getDefaultPrefix

      @Nullable public String getDefaultPrefix()
      Description copied from interface: PrefixManager
      Gets the default prefix. The default prefix is denoted by the prefix name ":"
      Specified by:
      getDefaultPrefix in interface PrefixManager
      Returns:
      The default prefix, or null if there is no default prefix.
    • setDefaultPrefix

      public void setDefaultPrefix(@Nullable String defaultPrefix)
      Description copied from interface: PrefixManager
      Sets the default namespace. This will also bind the prefix name ":" to this prefix
      Specified by:
      setDefaultPrefix in interface PrefixManager
      Parameters:
      defaultPrefix - The namespace to be used as the default namespace. Note that the value may be null in order to clear the default namespace.
    • getPrefixName2PrefixMap

      public Map<String,String> getPrefixName2PrefixMap()
      Description copied from interface: PrefixManager
      Gets a map that maps prefix names to prefixes.
      Specified by:
      getPrefixName2PrefixMap in interface PrefixManager
      Returns:
      The map of prefix names to prefixes. Note that modifying the contents of this map will not change the prefix name - prefix mappings
    • getPrefix

      @Nullable public String getPrefix(String prefixName)
      Description copied from interface: PrefixManager
      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 the getDefaultPrefix() method.
      Specified by:
      getPrefix in interface PrefixManager
      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.
    • getIRI

      public IRI getIRI(String prefixIRI)
      Description copied from interface: PrefixManager
      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.
      Specified by:
      getIRI in interface PrefixManager
      Parameters:
      prefixIRI - The Prefix IRI
      Returns:
      The full IRI.
    • getPrefixIRI

      @Nullable public String getPrefixIRI(IRI iri)
      Description copied from interface: PrefixManager
      Gets the prefix IRI given a IRI (URI).
      Specified by:
      getPrefixIRI in interface PrefixManager
      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

      public String getPrefixIRIIgnoreQName(IRI iri)
      Description copied from interface: PrefixManager
      Gets the prefix IRI given a IRI (URI). Does not restrict the response to be a QName
      Specified by:
      getPrefixIRIIgnoreQName in interface PrefixManager
      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.
    • copyPrefixesFrom

      public void copyPrefixesFrom(PrefixManager from)
      Description copied from interface: PrefixManager
      Copies the prefix from another prefix manager into this one.
      Specified by:
      copyPrefixesFrom in interface PrefixManager
      Parameters:
      from - The manager that the prefixes should be copied from
    • copyPrefixesFrom

      public void copyPrefixesFrom(Map<String,String> from)
      Description copied from interface: PrefixManager
      Copies the prefix from another prefix manager into this one.
      Specified by:
      copyPrefixesFrom in interface PrefixManager
      Parameters:
      from - The map containing the prefixes
    • unregisterNamespace

      public void unregisterNamespace(String namespace)
      Description copied from interface: PrefixManager
      Removes a previously registered prefix namespace mapping.
      Specified by:
      unregisterNamespace in interface PrefixManager
      Parameters:
      namespace - The namespace to be removed.
    • getPrefixComparator

      public StringComparator getPrefixComparator()
      Specified by:
      getPrefixComparator in interface PrefixManager
      Returns:
      the prefix comparator currently used by the prefix manager
    • setPrefixComparator

      public void setPrefixComparator(StringComparator comparator)
      Specified by:
      setPrefixComparator in interface PrefixManager
      Parameters:
      comparator - the comparator to use
    • getKey

      public String getKey()
      Specified by:
      getKey in interface OWLDocumentFormat
      Returns:
      A unique key for this format.
    • isPrefixOWLDocumentFormat

      public boolean isPrefixOWLDocumentFormat()
      Description copied from interface: OWLDocumentFormat
      Determines if this format is an instance of a format that uses prefixes to shorted IRIs.
      Specified by:
      isPrefixOWLDocumentFormat in interface OWLDocumentFormat
      Returns:
      true if this format is an instance of PrefixDocumentFormat other wise false.