Package com.github.owlcs.ontapi
Class OWLFactoryWrapper
java.lang.Object
com.github.owlcs.ontapi.OWLFactoryWrapper
- All Implemented Interfaces:
OntologyFactory.Loader,OntologyLoader,Serializable
@ParametersAreNonnullByDefault
public class OWLFactoryWrapper
extends Object
implements OntologyFactory.Loader
An implementation of
OntologyLoader which is actually OWLOntologyFactory decorator.
Used to load ontology through pure OWL-API mechanisms (i.e. owl-api parsers).
Some formats (such as ManchesterSyntaxDocumentFormat or
FunctionalSyntaxDocumentFormat) are not supported by Jena,
so this is the only way to handle them by ONT-API.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA copy-pasted OWL-API-impl utility class.static classThis is a copy-paste the original OWL-APIOWLOntologyFactoryimplementation, which is used if syntax format of source can not be handled by Apache Jena. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasOntologyFactory(OntologyCreator builder) Represents this loader as an ontology factory.voidclear()Release the state parameters that can appear during the load.static OntologyBuilderImplCreates a builder that is optimized for load operations occurring through native (OWL-API) parsers.loadOntology(OntologyCreator builder, OntologyManager manager, org.semanticweb.owlapi.io.OWLOntologyDocumentSource source, OntLoaderConfiguration conf) This method loads anontology modelfrom the givendocument sourceinto themanareraccording to theconfigurationsettings.optimize(OntLoaderConfiguration config) Optimizes the given configuration to interact with native OWL-API parsers.optimize(OntologyCreator builder) Optimizes the given builder to interact with native OWL-API parsers.
-
Field Details
-
sources
-
-
Constructor Details
-
OWLFactoryWrapper
public OWLFactoryWrapper()
-
-
Method Details
-
getAdapter
-
asOntologyFactory
Represents this loader as an ontology factory.- Specified by:
asOntologyFactoryin interfaceOntologyFactory.Loader- Parameters:
builder-OntologyCreator- Returns:
OntologyFactory
-
clear
public void clear()Release the state parameters that can appear during the load.- See Also:
-
optimize
Optimizes the given builder to interact with native OWL-API parsers.- Parameters:
builder-OntologyCreator, notnull- Returns:
OntologyCreator- Since:
- 1.4.2
-
optimize
Optimizes the given configuration to interact with native OWL-API parsers.Impl notes: Here, the nodes cache (i.e.
SearchModel) is disabled, since:- 1) read operations (list axioms, annotations) are not expected during assembly model
- 2) if these operations do occur, they may lead to exception, if incomplete information has been cached (for example, cache entity when there is still no declaration axiom)
- Parameters:
config-OntLoaderConfiguration, notnull- Returns:
OntLoaderConfiguration- Since:
- 1.4.2
-
loadOntology
public Ontology loadOntology(OntologyCreator builder, OntologyManager manager, org.semanticweb.owlapi.io.OWLOntologyDocumentSource source, OntLoaderConfiguration conf) throws org.semanticweb.owlapi.model.OWLOntologyCreationException This method loads anontology modelfrom the givendocument sourceinto themanareraccording to theconfigurationsettings. If the document source corresponds an ontology that has imports, these all imports are also treated as sources, and subsequently populated in the manager as ontologies. To handle correctly an IRI document sources, the manager'sIRI MapperandGraph Mapperare used. In case of any error the manager state should not be change.- Specified by:
loadOntologyin interfaceOntologyLoader- Parameters:
builder-OntologyCreatorto construct a freshOntologyinstancemanager-OntologyManagersource-OWLOntologyDocumentSourceconf-OntLoaderConfiguration- Returns:
- an ontology inside manager
- Throws:
OntologyFactoryImpl.BadRecursionException- if recursion occurs (the situation looks like cohesion/coupling issue in OWL-API: a manager uses a factory which uses the manager in its turn)org.semanticweb.owlapi.model.OWLOntologyCreationException- if any other problem occurs- See Also:
-
createLoadingBuilder
Creates a builder that is optimized for load operations occurring through native (OWL-API) parsers.- Parameters:
base-OntologyCreator, the builder to inherit behaviour, notnull- Returns:
OntologyBuilderImpl- Since:
- 1.4.2
-