An OWLReasoner reasons over a set of axioms (the set of reasoner axioms) that is based on the
imports closure of a particular ontology - the "root" ontology. This ontology can be obtained
using the
OWLReasoner#getRootOntology() method. When the client responsible for creating
the reasoner has finished with the reasoner instance it must call the
#dispose() method
to free any resources that are used by the reasoner. In general, reasoners should not be
instantiated directly, but should be created using the appropriate
org.semanticweb.owlapi.reasoner.OWLReasonerFactory.
Ontology Change Management (Buffering and Non-Buffering Modes) At creation time, an
OWLReasoner will load the axioms in the root ontology imports closure. It will attach itself as a
listener to the
org.semanticweb.owlapi.model.OWLOntologyManager that manages the root
ontology. The reasoner will listen to any
org.semanticweb.owlapi.model.OWLOntologyChanges
and respond appropriately to them before answering any queries. If the
org.semanticweb.owlapi.reasoner.BufferingMode of the reasoner (the answer to
#getBufferingMode() is
org.semanticweb.owlapi.reasoner.BufferingMode#NON_BUFFERING) the ontology changes are
processed by the reasoner immediately so that any queries asked after the changes are answered
with respect to the changed ontologies. If the
org.semanticweb.owlapi.reasoner.BufferingMode of the reasoner is
org.semanticweb.owlapi.reasoner.BufferingMode#BUFFERING then ontology changes are stored
in a buffer and are only taken into consideration when the buffer is flushed with the
#flush() method. When reasoning, axioms in the root ontology imports closure, minus the
axioms returned by the
#getPendingAxiomAdditions() method, plus the axioms returned by
the
#getPendingAxiomRemovals() are taken into consideration.
Note that there is no guarantee that the reasoner implementation will respond to changes in an
incremental (and efficient manner) manner.
Reasoner Axioms The set of axioms that the reasoner takes into consideration when
answering queries is known as the
set of reasoner axioms. This corresponds the axioms in
the imports closure of the root ontology plus the axioms returned by the
#getPendingAxiomRemovals() minus the axioms returned by
#getPendingAxiomAdditions()
Nodes The reasoner interface contains methods that return
org.semanticweb.owlapi.reasoner.NodeSets. These are sets of
org.semanticweb.owlapi.reasoner.Nodes. A
Node contains entities.
For a
Node<OWLClass> of classes, each class in the node is equivalent to the other
classes in the
Node with respect to the imports closure of the root ontology.
For a
Node<OWLObjectProperty> of object properties, each object property in the
Node is equivalent to the other object properties in the node with respect to the imports
closure of the root ontology.
For a
Node<OWLDataProperty> of data properties, each data property in the
Node is equivalent to the other data properties in the node with respect to the imports
closure of the root ontology.
For a
Node<OWLNamedIndividual> of named individuals, each individual in the node is
the same as the other individuals in the node with respect to the imports closure of the root
ontology.
By abuse of notation, we say that a
NodeSet "contains" an entity if that entity is
contained in one of the
Nodes in the
NodeSet.
Hierarchies A hierachy (class hierachy, object property hierarchy, data property
hierarchy) is viewed as a directed acyclic graph (DAG) containing nodes connected via edges. Each
node in the hierarchy represents a set of entities that are equivalent to each other. Each
hierarchy has a top node (see org.semanticweb.owlapi.reasoner.Node#isTopNode()) and a bottom node
(see org.semanticweb.owlapi.reasoner.Node#isBottomNode()).
The figure below shows an example class hierarchy. Each box in the hierarchy represents a
Node. In this case the top node contains
owl:Thing and the bottom node contains
owl:Nothing because the nodes in the hierarchy are
OWLClass nodes. In this case,
class
G is equivalent to
owl:Thing so it appears as an entity in the top node
along with
owl:Thing. Similarly, class
K is unsatisfiable, so it is equivalent to
owl:Nothing, and therefore appears in the bottom node containing
owl:Nothing. In
this example, classes
A and
B are equivalent so they appear in one node, also,
classes
D and
F are equivalent so they appear in one node.
Asking for the subclasses of a given class (expression) returns the a
NodeSet containing
the nodes that contain classes that are strict subclasses of the specified class (expression).
For example, asking for the subclasses of class
C returns the
NodeSet {E} and
{owl:Nothing, K}.
Asking for the direct subclasses of a given class (expression) returns the
NodeSet that
contains the nodes that contains classes that are direct subclasses of the specified class. For
example, asking for the direct subclasses of class
A returns the
NodeSetcontaining the nodes
{C} and
{D, F}. Note that there are
convenience methods on
NodeSet and
org.semanticweb.owlapi.reasoner.Node that can
be used to directly access the entities in a
NodeSet without having to iterate over the
nodes and entities in a
NodeSet. For example, a "plain" stream of classes contained
inside the
Nodes contained inside a
NodeSet can easily be obtained using the
NodeSet#entities() method. In this case we could quickly obtain
{C, D, F} as the direct subclasses of
A simply by using the
#getSubClasses(org.semanticweb.owlapi.model.OWLClassExpression,boolean) (with
boolean=true) method on
OWLReasoner and then we could use the
NodeSet#entities()method on the retuned
NodeSet .
Asking for equivalent classes of a class (expression) returns a
Node that contains
classes that are equivalent to the class (expression) . For example, asking for the equivalent
classes of
owl:Nothing (i.e. asking for the unsatisfiable classes) returns the
Node
{owl:Nothing, K}.
Definitions In what follows, an extension of the
OWL 2 Functional Syntax is given in order to
capture notions like a class being a "direct" subclass of another class.
StrictSubClassOf
Given two class expressions
CE1 and
CE2 and an ontology
O,
CE1 is a strict subclass of
CE2, written
StrictSubClassOf(CE1 CE2) if
O entails
SubClassOf(CE1 CE2) and
Odoes not entail
SubClassOf(CE2 CE1)
DirectSubClassOf
Given two class expressions
CE1 and
CE2 and an ontology
O,
CE1 is a
direct subclass of
CE2, written
DirectSubClassOf(CE1 CE2), with respect to
O if
O entails
StrictSubClassOf(CE1 CE2) and there is no class name
C in the signature of
O such that
O entails
StrictSubClassOf(CE1 C) and
O entails
StrictSubClassOf(C CE2).
StrictSubObjectPropertyOf
Given two object property expressions
OPE1 and
OPE2 and an ontology
O,
OPE1 is a strict subproperty of
OPE2,
written
StrictSubObjectPropertyOf(OPE1 OPE2) if
O entails
SubObjectPropertyOf(OPE1 OPE2) and
O does not entail
SubObjectPropertyOf(OPE2 OPE1)
DirectSubObjectPropertyOf
Given two object property expressions
OPE1 and
OPE2 and an ontology
O,
OPE1 is a
direct subproperty of
OPE2, written
DirectSubObjectPropertyOf(OPE1 OPE2), with respect to
O if
O entails
StrictSubObjectPropertyOf(OPE1 OPE2) and there is no object property
name
P in the signature of
O such that
O entails
StrictSubObjectPropertyOf(OPE1 P) and
O entails
StrictSubObjectPropertyOf(P OPE2).
StrictSubDataPropertyOf
Given two dbject property expressions
DPE1 and
DPE2 and an ontology
O,
DPE1 is a strict subproperty of
DPE2,
written
StrictSubDataPropertyOf(DPE1 DPE2) if
O entails
SubDataPropertyOf(DPE1 DPE2) and
O does not entail
SubDataPropertyOf(DPE1 DPE2)
DirectSubDataPropertyOf
Given two data property expressions
DPE1 and
DPE2 and an ontology
O,
DPE1 is a
direct subproperty of
DPE2, written
DirectSubDataPropertyOf(DPE1 DPE2), with respect to
O if
O entails
StrictSubDataPropertyOf(DPE1 DPE2) and there is no data property name
P in the signature of
O such that
O entails
StrictSubDataPropertyOf(DPE1 P) and
O entails
StrictSubDataPropertyOf(P DPE2).
DirectClassAssertion
Given an individual
j and a class expression
CE and
an ontology
O,
CE is a direct class assertion (type) for
j, written
DirectClassAssertion(CE j), if
O entails
ClassAssertion(CE j) and there
is no class name
C in the signature of
O such that
O entails
ClassAssertion(C j) and
O entails
StrictSubClassOf(C CE).
ObjectPropertyComplementOf
Given an object property expression
pe, the object
property complement of
pe is written as
ObjectPropertyComplementOf(pe). The
interpretation of
ObjectPropertyComplementOf(pe) is equal to the interpretation of
owl:topObjectProperty minus the interpretation of
pe. In other words,
ObjectPropertyComplementOf(pe) is the set of pairs of individuals that are not in
pe.
DataPropertyComplementOf
Given a data property expression
pe , the data property
complement of
pe is written as
DataPropertyComplementOf(pe). The interpretation
of
DataPropertyComplementOf(pe) is equal to the interpretation of
owl:topDataProperty minus the interpretation of
pe. In other words,
DataPropertyComplementOf(pe) is the set of pairs of individual and literals that are not
in
pe.
Simplified Object Property Expression
A simplified object property expression
is either a named property
P, or an object inverse property of the form
ObjectInverseOf(P) where
P is a named property. In other words, there is no
nesting of
ObjectInverseOf operators.
Error Handling An
OWLReasoner may throw the following exceptions to indicate
errors. More documentation for each type of exception can be found on the particular exception
class.
-
org.semanticweb.owlapi.reasoner.AxiomNotInProfileException
-
org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException
-
org.semanticweb.owlapi.reasoner.FreshEntitiesException
-
org.semanticweb.owlapi.reasoner.InconsistentOntologyException
-
org.semanticweb.owlapi.reasoner.TimeOutException
-
org.semanticweb.owlapi.reasoner.ReasonerInterruptedException
-
org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException
-
org.semanticweb.owlapi.reasoner.ReasonerInternalException
Note that
org.semanticweb.owlapi.reasoner.ReasonerInternalException may be throw by any
of the reasoner methods below.