Class OWLOntologyID

java.lang.Object
org.semanticweb.owlapi.model.OWLOntologyID
All Implemented Interfaces:
Serializable, Comparable<OWLOntologyID>, IsAnonymous

public class OWLOntologyID extends Object implements Comparable<OWLOntologyID>, Serializable, IsAnonymous
An object that identifies an ontology. Since OWL 2, ontologies do not have to have an ontology IRI, or if they have an ontology IRI then they can optionally also have a version IRI. Instances of this OWLOntologyID class bundle identifying information of an ontology together. If an ontology doesn't have an ontology IRI then we say that it is "anonymous".
Since:
3.0.0
Author:
Matthew Horridge, The University of Manchester, Information Management Group
See Also:
  • Constructor Details

    • OWLOntologyID

      public OWLOntologyID(@Nullable IRI iri)
      Constructs an ontology identifier specifying the ontology IRI and version IRI. Equivalent to OWLOntologyID(Optional
      Parameters:
      iri - The ontology IRI (may be null)
    • OWLOntologyID

      public OWLOntologyID(@Nullable IRI iri, @Nullable IRI versionIRI)
      Constructs an ontology identifier specifying the ontology IRI and version IRI.
      Parameters:
      iri - The ontology IRI (may be null)
      versionIRI - The version IRI (must be null if the ontologyIRI is null)
    • OWLOntologyID

      public OWLOntologyID(Optional<IRI> iri, Optional<IRI> version)
      Constructs an ontology identifier specifying the ontology IRI and version IRI.
      Parameters:
      iri - The ontology IRI (may be absent)
      version - The version IRI (must be absent if the ontologyIRI is absent)
    • OWLOntologyID

      public OWLOntologyID()
      Constructs an ontology identifier specifying that the ontology IRI (and hence the version IRI) is not present.
  • Method Details

    • match

      public boolean match(IRI iri)
      Parameters:
      iri - the iri to check
      Returns:
      true if the input iri matches the ontology iri or the version iri
    • matchVersion

      public boolean matchVersion(IRI iri)
      Parameters:
      iri - the iri to check
      Returns:
      true if the input iri matches the version iri
    • matchDocument

      public boolean matchDocument(IRI iri)
      Parameters:
      iri - the iri to check
      Returns:
      true if the input iri matches the default document iri
    • matchOntology

      public boolean matchOntology(IRI iri)
      Parameters:
      iri - the iri to check
      Returns:
      true if the input iri matches the ontology iri
    • match

      public boolean match(OWLOntologyID id)
      Parameters:
      id - the id to check
      Returns:
      true if the input id has the same ontology iri
    • isOWL2DLOntologyID

      public boolean isOWL2DLOntologyID()
      Determines if this is a valid OWL 2 DL ontology ID. To be a valid OWL 2 DL ID, the ontology IRI and version IRI must not be reserved vocabulary.
      Returns:
      true if this is a valid OWL 2 DL ontology ID, otherwise false
      See Also:
    • compareTo

      public int compareTo(@Nullable OWLOntologyID o)
      Specified by:
      compareTo in interface Comparable<OWLOntologyID>
    • getOntologyIRI

      public Optional<IRI> getOntologyIRI()
      Gets the ontology IRI. If the ontology is anonymous, it will return an absent Optional (i.e., getOntologyIRI().isPresent() will return false.
      Returns:
      Optional of the ontology IRI, or Optional.absent if there is no ontology IRI.
    • getVersionIRI

      public Optional<IRI> getVersionIRI()
      Gets the version IRI.
      Returns:
      an optional of the version IRI, or Optional.absent if there is no version IRI.
    • getDefaultDocumentIRI

      public Optional<IRI> getDefaultDocumentIRI()
      Gets the IRI which is used as a default for the document that contain a representation of an ontology with this ID. This will be the version IRI if there is an ontology IRI and version IRI, else it will be the ontology IRI if there is an ontology IRI but no version IRI, else it will be null if there is no ontology IRI. See Ontology Documents in the OWL 2 Structural Specification.
      Returns:
      An Optional of the IRI that can be used as a default for an ontology document containing an ontology as identified by this ontology ID. Returns the default IRI or an Optional.absent.
    • isAnonymous

      public boolean isAnonymous()
      Determines if this ID names an ontology or whether it is an ID for an ontology without an IRI. If the result of this method is true, getOntologyIRI() will return an Optional.absent.
      Specified by:
      isAnonymous in interface IsAnonymous
      Returns:
      true if this ID is an ID for an ontology without an IRI, or false if this ID is an ID for an ontology with an IRI.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object