Package org.semanticweb.owlapi.model
Interface OWLOntology
- All Superinterfaces:
Comparable<OWLObject>
,HasAnnotationPropertiesInSignature
,HasAnnotations
,HasAnonymousIndividuals
,HasApplyChange
,HasApplyChanges
,HasApplyDirectChange
,HasAxioms
,HasAxiomsByType
,HasClassesInSignature
,HasComponents
,HasContainsAxiom
,HasContainsEntityInSignature
,HasDataPropertiesInSignature
,HasDatatypesInSignature
,HasDirectAddAxiom
,HasDirectAddAxioms
,HasDirectImports
,HasDirectRemoveAxiom
,HasDirectRemoveAxioms
,HasGetEntitiesInSignature
,HasHashIndex
,HasImportsClosure
,HasIndex
,HasIndividualsInSignature
,HasLogicalAxioms
,HasObjectPropertiesInSignature
,HasOntologyID
,HasSignature
,IsAnonymous
,OWLAxiomCollection
,OWLAxiomCollectionBooleanArgs
,OWLAxiomIndex
,OWLObject
,OWLSignature
,OWLSignatureBooleanArgs
,Serializable
- All Known Subinterfaces:
OWLMutableOntology
- All Known Implementing Classes:
ConcurrentOWLOntologyImpl
,OWLImmutableOntologyImpl
,OWLOntologyImpl
public interface OWLOntology
extends OWLObject, HasAnnotations, HasDirectImports, HasImportsClosure, HasOntologyID, OWLAxiomCollection, OWLAxiomCollectionBooleanArgs, OWLSignature, OWLSignatureBooleanArgs, OWLAxiomIndex, HasApplyChange, HasApplyChanges, HasDirectAddAxiom, HasDirectAddAxioms, HasDirectRemoveAxiom, HasDirectRemoveAxioms, HasApplyDirectChange
Represents an OWL 2 Ontology in the
OWL 2 specification.
An
An
OWLOntology
consists of a possibly empty set of
OWLAxiom
s and a possibly empty set of
OWLAnnotation
s. An ontology can have an ontology IRI which can be used to identify the
ontology. If it has an ontology IRI then it may also have an ontology version IRI. Since OWL 2,
an ontology need not have an ontology IRI. (See the
OWL 2 Structural Specification An ontology cannot
be modified directly. Changes must be applied via its OWLOntologyManager
.- Since:
- 2.0.0
- Author:
- Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
-
Method Summary
Modifier and TypeMethodDescriptionaboxAxioms
(Imports includeImportsClosure) Gets the axioms that form the ABox for this ontology, i.e., the ones whose type is in the AxiomType::ABoxAxiomTypes.default void
accept
(OWLNamedObjectVisitor visitor) accept for named object visitordefault <O> O
accept
(OWLNamedObjectVisitorEx<O> visitor) Accepts a visitordefault void
accept
(OWLObjectVisitor visitor) Accepts a visitordefault <O> O
accept
(OWLObjectVisitorEx<O> visitor) Accepts a visitordefault ChangeApplied
A convenience method that adds a single axiom to an ontology.default ChangeApplied
addAxioms
(Collection<? extends OWLAxiom> axioms) A convenience method that adds a set of axioms to an ontology.default ChangeApplied
A convenience method that adds a set of axioms to an ontology.default ChangeApplied
A convenience method that adds a set of axioms to an ontology.default ChangeApplied
applyChange
(OWLOntologyChange change) A convenience method that applies just one change to an ontology.default ChangeDetails
applyChangesAndGetDetails
(List<? extends OWLOntologyChange> changes) Applies a list ontology changes to a collection of ontologies.default ChangeApplied
applyDirectChange
(OWLOntologyChange change) A convenience method that applies just one change to this ontology.default Stream<?>
Gets the stream of general axioms in this ontology.getABoxAxioms
(Imports includeImportsClosure) Gets the axioms that form the ABox for this ontology, i.e., the ones whose type is in the AxiomType::ABoxAxiomTypes.default OWLDocumentFormat
default Set<OWLClassAxiom>
Gets the set of general axioms in this ontology.default Set<OWLOntology>
Gets the set of loaded ontologies that this ontology is related to via the transitive closure of the directlyImports relation.
For example, if this ontology imports ontology B, and ontology B imports ontology C, then this method will return the set consisting of ontology B and ontology C.default Set<OWLImportsDeclaration>
Gets the set of imports declarations for this ontology.default OWLDocumentFormat
Gets the ontology format for this ontology, ensuring it is not null (an error is thrown if the ontology has no format).Gets the manager that manages this ontology.getRBoxAxioms
(Imports includeImportsClosure) Gets the axioms that form the RBox for this ontology, i.e., the ones whose type is in the AxiomType::RBoxAxiomTypes.getSignature
(Imports imports) Gets the entities that are in the signature of this ontology.getTBoxAxioms
(Imports includeImportsClosure) Gets the axioms that form the TBox for this ontology, i.e., the ones whose type is in the AxiomType::TBoxAxiomTypes.default int
imports()
Gets the stream of loaded ontologies that this ontology is related to via the transitive closure of the directlyImports relation.
For example, if this ontology imports ontology B, and ontology B imports ontology C, then this method will return the set consisting of ontology B and ontology C.Gets the stream of imports declarations for this ontology.default int
default boolean
isAxiom()
boolean
isDeclared
(OWLEntity owlEntity) Determines if this ontology declares an entity i.e.default boolean
isDeclared
(OWLEntity owlEntity, Imports imports) Determines if this ontology or its imports closure declares an entity i.e.boolean
isEmpty()
Determines if this ontology is empty - an ontology is empty if it does not contain any axioms (i.e.default boolean
default boolean
rboxAxioms
(Imports includeImportsClosure) Gets the axioms that form the RBox for this ontology, i.e., the ones whose type is in the AxiomType::RBoxAxiomTypes.default ChangeApplied
removeAxiom
(OWLAxiom axiom) A convenience method that removes a single axiom from this object.default ChangeApplied
removeAxioms
(Collection<? extends OWLAxiom> axioms) A convenience method that removes a set of axioms from this object.default ChangeApplied
removeAxioms
(Stream<? extends OWLAxiom> axioms) A convenience method that removes a set of axioms from this object.default ChangeApplied
removeAxioms
(OWLAxiom... axioms) A convenience method that removes a set of axioms from this object.default void
Saves the ontology.default void
saveOntology
(OutputStream outputStream) Saves the ontology, to the specified output streamdefault void
saveOntology
(OWLOntologyDocumentTarget documentTarget) Saves the ontology to the specifiedOWLOntologyDocumentTarget
.default void
saveOntology
(IRI documentIRI) Saves the ontology, using the specified document IRI to determine where/how the ontology should be saved.default void
saveOntology
(OWLDocumentFormat ontologyFormat) Saves the ontology in the specified ontology format to its document URI.default void
saveOntology
(OWLDocumentFormat ontologyFormat, OutputStream outputStream) Saves the ontology to the specified output stream in the specified ontology format.default void
saveOntology
(OWLDocumentFormat ontologyFormat, OWLOntologyDocumentTarget documentTarget) Saves the ontology to the specified output target in the specified ontology format.default void
saveOntology
(OWLDocumentFormat ontologyFormat, IRI documentIRI) Saves the ontology to the specified document IRI in the specified ontology format.void
setOWLOntologyManager
(OWLOntologyManager manager) Sets the manager for this ontology.Gets the entities that are in the signature of this ontology.tboxAxioms
(Imports includeImportsClosure) Gets the axioms that form the TBox for this ontology, i.e., the ones whose type is in the AxiomType::TBoxAxiomTypes.default int
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.semanticweb.owlapi.model.HasAnnotationPropertiesInSignature
annotationPropertiesInSignature, getAnnotationPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasAnnotations
annotations, annotations, annotations, annotationsAsList, getAnnotations, getAnnotations
Methods inherited from interface org.semanticweb.owlapi.model.HasAnonymousIndividuals
anonymousIndividuals, getAnonymousIndividuals
Methods inherited from interface org.semanticweb.owlapi.model.HasApplyChanges
applyChanges, applyChanges, applyChangesAndGetDetails
Methods inherited from interface org.semanticweb.owlapi.model.HasAxiomsByType
axioms, equalAxioms, getAxioms
Methods inherited from interface org.semanticweb.owlapi.model.HasClassesInSignature
classesInSignature, getClassesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasComponents
componentsAnnotationsFirst, componentsWithoutAnnotations
Methods inherited from interface org.semanticweb.owlapi.model.HasContainsAxiom
containsAxiom
Methods inherited from interface org.semanticweb.owlapi.model.HasContainsEntityInSignature
containsEntityInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasDataPropertiesInSignature
dataPropertiesInSignature, getDataPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasDatatypesInSignature
datatypesInSignature, getDatatypesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasDirectAddAxiom
add
Methods inherited from interface org.semanticweb.owlapi.model.HasDirectAddAxioms
add, add
Methods inherited from interface org.semanticweb.owlapi.model.HasDirectImports
directImports, directImportsDocuments, getDirectImports, getDirectImportsDocuments
Methods inherited from interface org.semanticweb.owlapi.model.HasDirectRemoveAxiom
remove
Methods inherited from interface org.semanticweb.owlapi.model.HasDirectRemoveAxioms
remove, remove, remove
Methods inherited from interface org.semanticweb.owlapi.model.HasGetEntitiesInSignature
entitiesInSignature, getEntitiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasImportsClosure
getImportsClosure, importsClosure
Methods inherited from interface org.semanticweb.owlapi.model.HasIndividualsInSignature
getIndividualsInSignature, individualsInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasLogicalAxioms
getLogicalAxioms, logicalAxioms
Methods inherited from interface org.semanticweb.owlapi.model.HasObjectPropertiesInSignature
getObjectPropertiesInSignature, objectPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasOntologyID
getOntologyID
Methods inherited from interface org.semanticweb.owlapi.model.HasSignature
getSignature, signature, unsortedSignature
Methods inherited from interface org.semanticweb.owlapi.model.IsAnonymous
isAnonymous, isNamed
Methods inherited from interface org.semanticweb.owlapi.model.OWLAxiomCollection
axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axioms, axiomsIgnoreAnnotations, axiomsIgnoreAnnotations, containsAxiom, containsAxiomIgnoreAnnotations, getAxiomCount, getAxiomCount, getAxiomCount, getAxiomCount, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxiomsIgnoreAnnotations, getAxiomsIgnoreAnnotations, getLogicalAxiomCount, getLogicalAxiomCount, getLogicalAxioms, getReferencingAxioms, getReferencingAxioms, logicalAxioms, referencingAxioms, referencingAxioms
Methods inherited from interface org.semanticweb.owlapi.model.OWLAxiomCollectionBooleanArgs
containsAxiom, containsAxiomIgnoreAnnotations, getAxiomCount, getAxiomCount, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getAxiomsIgnoreAnnotations, getLogicalAxiomCount, getLogicalAxioms, getReferencingAxioms
Methods inherited from interface org.semanticweb.owlapi.model.OWLAxiomIndex
annotationAssertionAxioms, annotationAssertionAxioms, annotationPropertyDomainAxioms, annotationPropertyRangeAxioms, asymmetricObjectPropertyAxioms, axioms, axioms, axioms, axioms, axioms, axioms, classAssertionAxioms, classAssertionAxioms, contains, contains, dataPropertyAssertionAxioms, dataPropertyDomainAxioms, dataPropertyRangeAxioms, dataSubPropertyAxiomsForSubProperty, dataSubPropertyAxiomsForSuperProperty, datatypeDefinitions, declarationAxioms, differentIndividualAxioms, disjointClassesAxioms, disjointDataPropertiesAxioms, disjointObjectPropertiesAxioms, disjointUnionAxioms, equivalentClassesAxioms, equivalentDataPropertiesAxioms, equivalentObjectPropertiesAxioms, filterAxioms, filterAxioms, functionalDataPropertyAxioms, functionalObjectPropertyAxioms, getAnnotationAssertionAxioms, getAnnotationAssertionAxioms, getAnnotationPropertyDomainAxioms, getAnnotationPropertyRangeAxioms, getAsymmetricObjectPropertyAxioms, getAxioms, getAxioms, getAxioms, getAxioms, getClassAssertionAxioms, getClassAssertionAxioms, getDataPropertyAssertionAxioms, getDataPropertyDomainAxioms, getDataPropertyRangeAxioms, getDataSubPropertyAxiomsForSubProperty, getDataSubPropertyAxiomsForSuperProperty, getDatatypeDefinitions, getDeclarationAxioms, getDifferentIndividualAxioms, getDisjointClassesAxioms, getDisjointDataPropertiesAxioms, getDisjointObjectPropertiesAxioms, getDisjointUnionAxioms, getEquivalentClassesAxioms, getEquivalentDataPropertiesAxioms, getEquivalentObjectPropertiesAxioms, getFunctionalDataPropertyAxioms, getFunctionalObjectPropertyAxioms, getHasKeyAxioms, getInverseFunctionalObjectPropertyAxioms, getInverseObjectPropertyAxioms, getIrreflexiveObjectPropertyAxioms, getNegativeDataPropertyAssertionAxioms, getNegativeObjectPropertyAssertionAxioms, getObjectPropertyAssertionAxioms, getObjectPropertyDomainAxioms, getObjectPropertyRangeAxioms, getObjectSubPropertyAxiomsForSubProperty, getObjectSubPropertyAxiomsForSuperProperty, getReflexiveObjectPropertyAxioms, getSameIndividualAxioms, getSubAnnotationPropertyOfAxioms, getSubClassAxiomsForSubClass, getSubClassAxiomsForSuperClass, getSymmetricObjectPropertyAxioms, getTransitiveObjectPropertyAxioms, hasKeyAxioms, inverseFunctionalObjectPropertyAxioms, inverseObjectPropertyAxioms, irreflexiveObjectPropertyAxioms, negativeDataPropertyAssertionAxioms, negativeObjectPropertyAssertionAxioms, objectPropertyAssertionAxioms, objectPropertyDomainAxioms, objectPropertyRangeAxioms, objectSubPropertyAxiomsForSubProperty, objectSubPropertyAxiomsForSuperProperty, reflexiveObjectPropertyAxioms, sameIndividualAxioms, subAnnotationPropertyOfAxioms, subClassAxiomsForSubClass, subClassAxiomsForSuperClass, symmetricObjectPropertyAxioms, transitiveObjectPropertyAxioms
Methods inherited from interface org.semanticweb.owlapi.model.OWLObject
getNestedClassExpressions, hasSharedStructure, isAnonymousExpression, isBottomEntity, isIRI, isTopEntity, nestedClassExpressions
Methods inherited from interface org.semanticweb.owlapi.model.OWLSignature
annotationPropertiesInSignature, classesInSignature, containsAnnotationPropertyInSignature, containsAnnotationPropertyInSignature, containsClassInSignature, containsClassInSignature, containsDataPropertyInSignature, containsDataPropertyInSignature, containsDatatypeInSignature, containsDatatypeInSignature, containsEntitiesOfTypeInSignature, containsEntitiesOfTypeInSignature, containsEntityInSignature, containsEntityInSignature, containsEntityInSignature, containsIndividualInSignature, containsIndividualInSignature, containsObjectPropertyInSignature, containsObjectPropertyInSignature, containsReference, containsReference, dataPropertiesInSignature, datatypesInSignature, entitiesInSignature, getAnnotationPropertiesInSignature, getClassesInSignature, getDataPropertiesInSignature, getDatatypesInSignature, getEntitiesInSignature, getIndividualsInSignature, getObjectPropertiesInSignature, getPunnedIRIs, getReferencedAnonymousIndividuals, getReferencedAnonymousIndividuals, individualsInSignature, objectPropertiesInSignature, referencedAnonymousIndividuals, referencedAnonymousIndividuals
Methods inherited from interface org.semanticweb.owlapi.model.OWLSignatureBooleanArgs
containsAnnotationPropertyInSignature, containsClassInSignature, containsDataPropertyInSignature, containsDatatypeInSignature, containsEntityInSignature, containsEntityInSignature, containsIndividualInSignature, containsObjectPropertyInSignature, containsReference, getAnnotationPropertiesInSignature, getClassesInSignature, getDataPropertiesInSignature, getDatatypesInSignature, getEntitiesInSignature, getIndividualsInSignature, getObjectPropertiesInSignature, getReferencedAnonymousIndividuals
-
Method Details
-
isAxiom
default boolean isAxiom() -
isIndividual
default boolean isIndividual()- Specified by:
isIndividual
in interfaceOWLObject
- Returns:
- true if this object is an individual.
-
isOntology
default boolean isOntology()- Specified by:
isOntology
in interfaceOWLObject
- Returns:
- true for ontologies, false for any other OWL object
-
components
- Specified by:
components
in interfaceHasComponents
- Returns:
- components as a stream. The stream is ordered (by visit order) but not sorted. Implementations that override components() must ensure the order is compatible with equals() and hashCode().
-
initHashCode
default int initHashCode()- Specified by:
initHashCode
in interfaceOWLObject
- Returns:
- hash code for the object; called on first use, cached by OWLObjectImpl in the default implementation.
-
hashIndex
default int hashIndex()- Specified by:
hashIndex
in interfaceHasHashIndex
- Returns:
- index for this type. This is not a hashcode for instances, rather a hashcode for the types.
-
typeIndex
default int typeIndex() -
applyChange
Description copied from interface:HasApplyChange
A convenience method that applies just one change to an ontology. When this method is used through anOWLOntologyManager
implementation, the instance used should be the one that the ontology returns through thegetOWLOntologyManager()
call. The reason is that some changes, e.g., change of ontology id and change of imports directives, affect data that only that manager instance knows about, such as the imports closure; changes of ontology id through the wrong manager will make the ontology unreachable through its new id in the manager associated with the ontology. Configuration for loading and saving parameters is also held by the manager, if not explicitly specified for the ontology. While the change might be successful, other bugs might be made apparent later.- Specified by:
applyChange
in interfaceHasApplyChange
- Parameters:
change
- The change to be applied- Returns:
- ChangeApplied.SUCCESSFULLY if the change is applied with success, ChangeApplied.UNSUCCESSFULLY otherwise.
-
applyDirectChange
Description copied from interface:HasApplyDirectChange
A convenience method that applies just one change to this ontology. Note: ontology ID changes should not be passed directly to this method but applied through OWLOntologyManager. This is because the manager needs to update its internal structures for id changes.- Specified by:
applyDirectChange
in interfaceHasApplyDirectChange
- Parameters:
change
- The change to be applied- Returns:
- ChangeApplied.SUCCESSFULLY if the change is applied with success, ChangeApplied.UNSUCCESSFULLY otherwise.
-
applyChangesAndGetDetails
Description copied from interface:HasApplyChanges
Applies a list ontology changes to a collection of ontologies. When this method is used through anOWLOntologyManager
implementation, the instance used should be the one that the ontology returns through thegetOWLOntologyManager()
call. The reason is that some changes, e.g., change of ontology id and change of imports directives, affect data that only that manager instance knows about, such as the imports closure; changes of ontology id through the wrong manager will make the ontology unreachable through its new id in the manager associated with the ontology. Configuration for loading and saving parameters is also held by the manager, if not explicitly specified for the ontology. While the change might be successful, other bugs might be made apparent later.- Specified by:
applyChangesAndGetDetails
in interfaceHasApplyChanges
- Parameters:
changes
- The changes to be applied.- Returns:
- ChangeApplied.SUCCESSFULLY if the axiom is added, ChangeApplied.UNSUCCESSFULLY otherwise.
-
addAxiom
Description copied from interface:HasDirectAddAxiom
A convenience method that adds a single axiom to an ontology. The appropriate AddAxiom change object is automatically generated.- Specified by:
addAxiom
in interfaceHasDirectAddAxiom
- Parameters:
axiom
- The axiom to be added- Returns:
- ChangeApplied.SUCCESSFULLY if the axiom is added, ChangeApplied.UNSUCCESSFULLY otherwise.
-
addAxioms
Description copied from interface:HasDirectAddAxioms
A convenience method that adds a set of axioms to an ontology. The appropriate AddAxiom change objects are automatically generated.- Specified by:
addAxioms
in interfaceHasDirectAddAxioms
- Parameters:
axioms
- The axioms to be added. Notnull
.- Returns:
- ChangeApplied.SUCCESSFULLY if the axiom is added, ChangeApplied.UNSUCCESSFULLY otherwise.
-
addAxioms
Description copied from interface:HasDirectAddAxioms
A convenience method that adds a set of axioms to an ontology. The appropriate AddAxiom change objects are automatically generated.- Specified by:
addAxioms
in interfaceHasDirectAddAxioms
- Parameters:
axioms
- The axioms to be added. Notnull
.- Returns:
- ChangeApplied.SUCCESSFULLY if the axiom is added, ChangeApplied.UNSUCCESSFULLY otherwise.
-
addAxioms
Description copied from interface:HasDirectAddAxioms
A convenience method that adds a set of axioms to an ontology. The appropriate AddAxiom change objects are automatically generated.- Specified by:
addAxioms
in interfaceHasDirectAddAxioms
- Parameters:
axioms
- The axioms to be added. Notnull
.- Returns:
- ChangeApplied.SUCCESSFULLY if the axiom is added, ChangeApplied.UNSUCCESSFULLY otherwise.
-
removeAxiom
Description copied from interface:HasDirectRemoveAxiom
A convenience method that removes a single axiom from this object. The appropriate RemoveAxiom change object is automatically generated.- Specified by:
removeAxiom
in interfaceHasDirectRemoveAxiom
- Parameters:
axiom
- The axiom to be removed- Returns:
- A list of ontology changes that represent the changes that actually took place.
-
removeAxioms
Description copied from interface:HasDirectRemoveAxioms
A convenience method that removes a set of axioms from this object. The appropriate RemoveAxiom change objects are automatically generated.- Specified by:
removeAxioms
in interfaceHasDirectRemoveAxioms
- Parameters:
axioms
- The axioms to be removed.- Returns:
- A list of ontology changes that represent the changes which took place in order to remove the axioms.
-
removeAxioms
Description copied from interface:HasDirectRemoveAxioms
A convenience method that removes a set of axioms from this object. The appropriate RemoveAxiom change objects are automatically generated.- Specified by:
removeAxioms
in interfaceHasDirectRemoveAxioms
- Parameters:
axioms
- The axioms to be removed.- Returns:
- A list of ontology changes that represent the changes which took place in order to remove the axioms.
-
removeAxioms
Description copied from interface:HasDirectRemoveAxioms
A convenience method that removes a set of axioms from this object. The appropriate RemoveAxiom change objects are automatically generated.- Specified by:
removeAxioms
in interfaceHasDirectRemoveAxioms
- Parameters:
axioms
- The axioms to be removed.- Returns:
- A list of ontology changes that represent the changes which took place in order to remove the axioms.
-
accept
accept for named object visitor- Parameters:
visitor
- the visitor
-
accept
Accepts a visitor- Type Parameters:
O
- visitor return type- Parameters:
visitor
- The visitor- Returns:
- visitor return value
-
getOWLOntologyManager
OWLOntologyManager getOWLOntologyManager()Gets the manager that manages this ontology. The manager is used by various methods on OWLOntology to resolve imports- Returns:
- The manager for this ontology.
-
setOWLOntologyManager
Sets the manager for this ontology. This method is used when moving ontologies from one manager to another and when removing an ontology form a manager, and should be used by OWLOntologyManager implementations only.- Parameters:
manager
- the new manager for this ontology
-
getFormat
- Returns:
- ontology format for this ontology; can be null if the ontology has been created programmatically and not loaded/saved, so it does not have any format information associated.
-
getNonnullFormat
Gets the ontology format for this ontology, ensuring it is not null (an error is thrown if the ontology has no format). Do not use this method to check if an ontology has a format associated with it; prefergetFormat()
.- Returns:
- The format of the ontology
-
getImports
Gets the set of loaded ontologies that this ontology is related to via the transitive closure of the directlyImports relation.
For example, if this ontology imports ontology B, and ontology B imports ontology C, then this method will return the set consisting of ontology B and ontology C.- Returns:
- The set of ontologies that this ontology is related to via the transitive closure of the directlyImports relation. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
- Throws:
UnknownOWLOntologyException
- if this ontology is no longer managed by its manager because it was removed from the manager.
-
imports
Stream<OWLOntology> imports()Gets the stream of loaded ontologies that this ontology is related to via the transitive closure of the directlyImports relation.
For example, if this ontology imports ontology B, and ontology B imports ontology C, then this method will return the set consisting of ontology B and ontology C.- Returns:
- The stream of ontologies that this ontology is related to via the transitive closure of the directlyImports relation.
- Throws:
UnknownOWLOntologyException
- if this ontology is no longer managed by its manager because it was removed from the manager.
-
getImportsDeclarations
Gets the set of imports declarations for this ontology. The set returned represents the set of IRIs that correspond to the set of IRIs in an ontology's directlyImportsDocuments (see Section 3 in the OWL 2 structural specification).- Returns:
- The set of imports declarations that correspond to the set of ontology document IRIs that are directly imported by this ontology. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
importsDeclarations
Stream<OWLImportsDeclaration> importsDeclarations()Gets the stream of imports declarations for this ontology. These are the IRIs that correspond to the set of IRIs in an ontology's directlyImportsDocuments (see Section 3 in the OWL 2 structural specification).- Returns:
- Sorted stream of imports declarations that correspond to the set of ontology document IRIs that are directly imported by this ontology.
-
isEmpty
boolean isEmpty()Determines if this ontology is empty - an ontology is empty if it does not contain any axioms (i.e.HasAxioms.axioms()
is empty), and it does not have any annotations (i.e.HasAnnotations.annotations()
is empty).- Returns:
true
if the ontology is empty, otherwisefalse
.
-
getTBoxAxioms
Gets the axioms that form the TBox for this ontology, i.e., the ones whose type is in the AxiomType::TBoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A set containing the axioms which are of the specified type. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
tboxAxioms
Gets the axioms that form the TBox for this ontology, i.e., the ones whose type is in the AxiomType::TBoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A stream containing the axioms which are of the specified type.
-
getABoxAxioms
Gets the axioms that form the ABox for this ontology, i.e., the ones whose type is in the AxiomType::ABoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A set containing the axioms which are of the specified type. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
aboxAxioms
Gets the axioms that form the ABox for this ontology, i.e., the ones whose type is in the AxiomType::ABoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A stream containing the axioms which are of the specified type.
-
getRBoxAxioms
Gets the axioms that form the RBox for this ontology, i.e., the ones whose type is in the AxiomType::RBoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A set containing the axioms which are of the specified type. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
rboxAxioms
Gets the axioms that form the RBox for this ontology, i.e., the ones whose type is in the AxiomType::RBoxAxiomTypes.- Parameters:
includeImportsClosure
- if INCLUDED, the imports closure is included.- Returns:
- A stream containing the axioms which are of the specified type.
-
getGeneralClassAxioms
Gets the set of general axioms in this ontology. This includes:- Subclass axioms that have a complex class as the subclass
- Equivalent class axioms that don't contain any named classes (
OWLClass
es) - Disjoint class axioms that don't contain any named classes (
OWLClass
es)
- Returns:
- The set of general axioms in this ontology. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
-
generalClassAxioms
Stream<OWLClassAxiom> generalClassAxioms()Gets the stream of general axioms in this ontology. This includes:- Subclass axioms that have a complex class as the subclass
- Equivalent class axioms that don't contain any named classes (
OWLClass
es) - Disjoint class axioms that don't contain any named classes (
OWLClass
es)
- Returns:
- The sorted stream containing the general axioms in the ontology.
-
getSignature
Gets the entities that are in the signature of this ontology. The signature of an ontology is the set of entities that are used to build axioms and annotations in the ontology. (See The OWL 2 Structural Specification)- Parameters:
imports
- if INCLUDED, the imports closure is included.- Returns:
- A set of
OWLEntity
objects. The set that is returned is a copy; modifications to the returned set will not be reflected in this object. - See Also:
-
signature
Gets the entities that are in the signature of this ontology. The signature of an ontology is the set of entities that are used to build axioms and annotations in the ontology. (See The OWL 2 Structural Specification)- Parameters:
imports
- if INCLUDED, the imports closure is included.- Returns:
- A stream of
OWLEntity
objects. - See Also:
-
isDeclared
Determines if this ontology declares an entity i.e. it contains a declaration axiom for the specified entity.- Parameters:
owlEntity
- The entity to be tested for- Returns:
true
if the ontology contains a declaration for the specified entity, otherwisefalse
.
-
isDeclared
Determines if this ontology or its imports closure declares an entity i.e. contains a declaration axiom for the specified entity.- Parameters:
owlEntity
- The entity to be tested forimports
- if INCLUDED, the imports closure is included.- Returns:
true
if the ontology or its imports closure contains a declaration for the specified entity, otherwisefalse
.
-
saveOntology
Saves the ontology. The ontology will be saved to the location that it was loaded from, or if it was created programmatically, it will be saved to the location specified by an ontology IRI mapper at creation time. The ontology will be saved in the same format which it was loaded from, or the default ontology format if the ontology was created programmatically.- Throws:
OWLOntologyStorageException
- An exception will be thrown if there is a problem with saving the ontology, or the ontology can't be saved in the format it was loaded from.
-
saveOntology
Saves the ontology, using the specified document IRI to determine where/how the ontology should be saved.- Parameters:
documentIRI
- The document IRI where the ontology should be saved to- Throws:
OWLOntologyStorageException
- If the ontology cannot be saved
-
saveOntology
Saves the ontology, to the specified output stream- Parameters:
outputStream
- The output stream where the ontology will be saved to- Throws:
OWLOntologyStorageException
- If there was a problem saving this ontology to the specified output stream
-
saveOntology
Saves the ontology in the specified ontology format to its document URI.- Parameters:
ontologyFormat
- The format in which the ontology should be saved.- Throws:
OWLOntologyStorageException
- If the ontology cannot be saved.
-
saveOntology
default void saveOntology(OWLDocumentFormat ontologyFormat, IRI documentIRI) throws OWLOntologyStorageException Saves the ontology to the specified document IRI in the specified ontology format.- Parameters:
ontologyFormat
- The format in which to save the ontologydocumentIRI
- The document IRI where the ontology should be saved to- Throws:
OWLOntologyStorageException
- If the ontology could not be saved.
-
saveOntology
default void saveOntology(OWLDocumentFormat ontologyFormat, OutputStream outputStream) throws OWLOntologyStorageException Saves the ontology to the specified output stream in the specified ontology format.- Parameters:
ontologyFormat
- The format in which to save the ontologyoutputStream
- The output stream where the ontology will be saved to.- Throws:
OWLOntologyStorageException
- If the ontology could not be saved.
-
saveOntology
default void saveOntology(OWLOntologyDocumentTarget documentTarget) throws OWLOntologyStorageException Saves the ontology to the specifiedOWLOntologyDocumentTarget
.- Parameters:
documentTarget
- The output target where the ontology will be saved to.- Throws:
OWLOntologyStorageException
- If the ontology could not be saved.
-
saveOntology
default void saveOntology(OWLDocumentFormat ontologyFormat, OWLOntologyDocumentTarget documentTarget) throws OWLOntologyStorageException Saves the ontology to the specified output target in the specified ontology format.- Parameters:
ontologyFormat
- The output format in which to save the ontologydocumentTarget
- The output target where the ontology will be saved to- Throws:
OWLOntologyStorageException
- If the ontology could not be saved.
-
accept
Description copied from interface:OWLObject
Accepts a visitor -
accept
Description copied from interface:OWLObject
Accepts a visitor
-