Class OWLOntologyDocumentSourceBase

java.lang.Object
org.semanticweb.owlapi.io.OWLOntologyDocumentSourceBase
All Implemented Interfaces:
OWLOntologyDocumentSource
Direct Known Subclasses:
FileDocumentSource, GZipFileDocumentSource, GZipStreamDocumentSource, IRIDocumentSource, StreamDocumentSourceBase, StringDocumentSource, XZFileDocumentSource, XZStreamDocumentSource

public abstract class OWLOntologyDocumentSourceBase extends Object implements OWLOntologyDocumentSource
Base class for OWLOntologyDocumentSource.
Since:
4.0.0
Author:
ignazio
  • Constructor Details

    • OWLOntologyDocumentSourceBase

      public OWLOntologyDocumentSourceBase(IRI iri, @Nullable OWLDocumentFormat format, @Nullable String mime)
      Constructs an ontology input source using the specified file.
      Parameters:
      iri - document IRI
      format - ontology format. If null, it is considered unspecified
      mime - mime type. If null or empty, it is considered unspecified.
    • OWLOntologyDocumentSourceBase

      public OWLOntologyDocumentSourceBase(String iriPrefix, @Nullable OWLDocumentFormat format, @Nullable String mime)
      Constructs an ontology input source using the specified file.
      Parameters:
      iriPrefix - document IRI prefix - used to generate a new IRI
      format - ontology format. If null, it is considered unspecified
      mime - mime type. If null or empty, it is considered unspecified.
  • Method Details

    • getAcceptHeaders

      public Optional<String> getAcceptHeaders()
      Specified by:
      getAcceptHeaders in interface OWLOntologyDocumentSource
      Returns:
      currently set accept headers
    • setAcceptHeaders

      public void setAcceptHeaders(String headers)
      Specified by:
      setAcceptHeaders in interface OWLOntologyDocumentSource
      Parameters:
      headers - accept headers; if not set, the mime type will be used; if that is also missing, the available parsers will contribute the headers
    • getDocumentIRI

      public final IRI getDocumentIRI()
      Description copied from interface: OWLOntologyDocumentSource
      Gets the IRI of the ontology document.
      Specified by:
      getDocumentIRI in interface OWLOntologyDocumentSource
      Returns:
      An IRI which represents the ontology document IRI
    • hasAlredyFailedOnStreams

      public boolean hasAlredyFailedOnStreams()
      Specified by:
      hasAlredyFailedOnStreams in interface OWLOntologyDocumentSource
      Returns:
      true if there is no reader or input stream available for this source, or reading from them has already been attempted in a previous call and has failed. This leaves attempting to resolve the document IRI as input. No attempt is made to verify that the document IRI is resolvable.
    • hasAlredyFailedOnIRIResolution

      public boolean hasAlredyFailedOnIRIResolution()
      Specified by:
      hasAlredyFailedOnIRIResolution in interface OWLOntologyDocumentSource
      Returns:
      true if resolving the document IRI has been attempted by a previous call and has failed, false if resolution has not been attempted yet or it has happened successfully.
    • setIRIResolutionFailed

      public void setIRIResolutionFailed(boolean value)
      Description copied from interface: OWLOntologyDocumentSource
      IRI resolution does not happen inside this class. This method allows the resolver to mark the document IRI as unresolvable, so that the information is tracked with the source.
      Specified by:
      setIRIResolutionFailed in interface OWLOntologyDocumentSource
      Parameters:
      value - new value for the flag
    • getFormat

      public Optional<OWLDocumentFormat> getFormat()
      Specified by:
      getFormat in interface OWLOntologyDocumentSource
      Returns:
      format for the ontology. If none is known, return Optional.absent.
    • getMIMEType

      public Optional<String> getMIMEType()
      Specified by:
      getMIMEType in interface OWLOntologyDocumentSource
      Returns:
      MIME type for this source, if one is specified. If none is known, return Optional.absent.