Package org.semanticweb.owlapi.io
Interface OWLOntologyDocumentSource
- All Known Implementing Classes:
FileDocumentSource
,GZipFileDocumentSource
,GZipStreamDocumentSource
,IRIDocumentSource
,OWLOntologyDocumentSourceBase
,ReaderDocumentSource
,StreamDocumentSource
,StreamDocumentSourceBase
,StringDocumentSource
,XZFileDocumentSource
,XZStreamDocumentSource
public interface OWLOntologyDocumentSource
A document source provides a point for loading an ontology. A document source may provide three
ways of obtaining an ontology document:
Note that while an ontology document source may appear similar to a SAX input source, an important difference is that the getReader and getInputStream methods return new instances each time the method is called. This allows multiple attempts at loading an ontology.
- From a
Reader
- From an
InputStream
- From an ontology document
IRI
Note that while an ontology document source may appear similar to a SAX input source, an important difference is that the getReader and getInputStream methods return new instances each time the method is called. This allows multiple attempts at loading an ontology.
- Since:
- 2.0.0
- Author:
- Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
-
Method Summary
Modifier and TypeMethodDescriptionGets the IRI of the ontology document.default Optional
<OWLDocumentFormat> default Optional
<InputStream> If an input stream can be obtained from this document source then this method creates it.Gets a reader which an ontology document can be read from.boolean
boolean
default void
setAcceptHeaders
(String headers) void
setIRIResolutionFailed
(boolean value) IRI resolution does not happen inside this class.
-
Method Details
-
getReader
Gets a reader which an ontology document can be read from. This method may be called multiple times. Each invocation will return a newReader
. If there is no reader stream available, returns Optional.absent.- Returns:
- A new
Reader
which the ontology can be read from, wrapped in an Optional.
-
getInputStream
If an input stream can be obtained from this document source then this method creates it. This method may be called multiple times. Each invocation will return a new input stream. If there is no input stream available, returns Optional.absent. .- Returns:
- A new input stream which the ontology can be read from, wrapped in an Optional.
-
getDocumentIRI
IRI getDocumentIRI()Gets the IRI of the ontology document.- Returns:
- An IRI which represents the ontology document IRI
-
getFormat
- Returns:
- format for the ontology. If none is known, return Optional.absent.
-
getMIMEType
- Returns:
- MIME type for this source, if one is specified. If none is known, return Optional.absent.
-
setAcceptHeaders
- 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
-
getAcceptHeaders
- Returns:
- currently set accept headers
-
hasAlredyFailedOnStreams
boolean hasAlredyFailedOnStreams()- 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
boolean hasAlredyFailedOnIRIResolution()- 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
void setIRIResolutionFailed(boolean value) 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.- Parameters:
value
- new value for the flag
-