public class Reasoner extends AbstractReasonerState
OntologyIndex object, which is updated by adding or removing
ElkAxioms (methods addAxiom() and removeAxiom()). When querying the
results of the reasoning tasks, the reasoner will ensure that all necessary
reasoning stages, such as consistency checking, are performed.
Reasoners are created (and pre-configured) by the ReasonerFactory.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowFreshEntities
Should fresh entities in reasoner queries be accepted (configuration
setting).
|
protected ProgressMonitor |
progressMonitor
The progress monitor that is used for reporting progress.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Reasoner(AxiomLoader axiomLoader,
ReasonerStageExecutor stageExecutor,
ExecutorService executor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getAllowFreshEntities()
Get whether fresh entities are allowed.
|
TaxonomyNode<ElkClass> |
getClassNode(ElkClassExpression classExpression)
Return the
TaxonomyNode for the given ElkClassExpression. |
Node<ElkClass> |
getEquivalentClasses(ElkClassExpression classExpression)
Return the
Node containing equivalent classes of the given
ElkClassExpression. |
protected InstanceNode<ElkClass,ElkNamedIndividual> |
getInstanceNode(ElkNamedIndividual elkNamedIndividual)
Helper method to get an
InstanceNode from the taxonomy. |
Set<? extends Node<ElkNamedIndividual>> |
getInstances(ElkClassExpression classExpression,
boolean direct)
Return the (direct or indirect) instances of the given
ElkClassExpression as specified by the parameter. |
protected int |
getNumberOfWorkers() |
protected ComputationExecutor |
getProcessExecutor() |
protected ProgressMonitor |
getProgressMonitor() |
protected ReasonerStageExecutor |
getStageExecutor() |
Set<? extends Node<ElkClass>> |
getSubClasses(ElkClassExpression classExpression,
boolean direct)
Return the (direct or indirect) subclasses of the given
ElkClassExpression as specified by the parameter. |
Set<? extends Node<ElkClass>> |
getSuperClasses(ElkClassExpression classExpression,
boolean direct)
Return the (direct or indirect) superclasses of the given
ElkClassExpression as specified by the parameter. |
protected TaxonomyNode<ElkClass> |
getTaxonomyNode(ElkClass elkClass)
Helper method to get a
TaxonomyNode from the taxonomy. |
protected TypeNode<ElkClass,ElkNamedIndividual> |
getTypeNode(ElkClass elkClass)
Helper method to get a
TypeNode from the taxonomy. |
Set<? extends Node<ElkClass>> |
getTypes(ElkNamedIndividual elkNamedIndividual,
boolean direct)
Return the (direct or indirect) types of the given
ElkNamedIndividual. |
boolean |
isSatisfiable(ElkClassExpression classExpression)
Check if the given
ElkClassExpression is satisfiable, that is, if
it can possibly have instances. |
void |
setAllowFreshEntities(boolean allow)
Set if fresh entities should be allowed.
|
void |
setConfigurationOptions(ReasonerConfiguration config)
This supposed to be the central place where the reasoner gets its
configuration options
|
void |
setNumberOfWorkers(int workerNo)
Sets the number of working threads.
|
void |
setProgressMonitor(ProgressMonitor progressMonitor)
Set the progress monitor that will be used for reporting progress on all
potentially long-running operations.
|
boolean |
shutdown()
Tries to shut down the reasoner within 1 minute
|
boolean |
shutdown(long timeout,
TimeUnit unit)
Tries to shut down the reasoner within the specified time
|
complete, doneConsistencyCheck, doneInstanceTaxonomy, doneTaxonomy, forceLoading, getAllClasses, getAllNamedIndividuals, getAxiomLoader, getContextMap, getIndexedClassExpressions, getInstanceTaxonomy, getInstanceTaxonomyQuietly, getModifiableOntologyIndex, getOntologyIndex, getPropertySaturationMap, getTaxonomy, getTaxonomyQuietly, initClassTaxonomy, initInstanceTaxonomy, interrupt, isAllowIncrementalMode, isInconsistent, isIncrementalMode, registerAxiomLoader, resetAxiomLoading, resetPropertySaturation, setAllowIncrementalMode, setAllowIncrementalTaxonomy, setInterrupt, useIncrementalTaxonomyisInterruptedprotected ProgressMonitor progressMonitor
protected boolean allowFreshEntities
ElkFreshEntitiesException will be thrown
when encountering entities that did not occur in the ontology.protected Reasoner(AxiomLoader axiomLoader, ReasonerStageExecutor stageExecutor, ExecutorService executor)
ReasonerFactory.public void setProgressMonitor(ProgressMonitor progressMonitor)
progressMonitor - public void setAllowFreshEntities(boolean allow)
ElkFreshEntitiesException will be thrown in
such cases. If true, the reasoner will answer as if the entity had been
declared (but not used in any axiom).allow - public boolean getAllowFreshEntities()
setAllowFreshEntities(boolean) for details.true if fresh entities are allowedprotected int getNumberOfWorkers()
getNumberOfWorkers in class AbstractReasonerStatepublic void setNumberOfWorkers(int workerNo)
workerNo - public void setConfigurationOptions(ReasonerConfiguration config)
config - protected ComputationExecutor getProcessExecutor()
getProcessExecutor in class AbstractReasonerStateComputationExecutor that is used for execution of
reasoning processesprotected ReasonerStageExecutor getStageExecutor()
getStageExecutor in class AbstractReasonerStateReasonerStageExecutor that is used for executing the
stages of the reasoner.protected ProgressMonitor getProgressMonitor()
getProgressMonitor in class AbstractReasonerStateProgressMonitor that is used for reporting progress
on all potentially long-running operations.public boolean shutdown(long timeout,
TimeUnit unit)
throws InterruptedException
timeout - the maximum time to waitunit - the time unit of the timeout argumenttrue if the operation was successfulInterruptedException - if the current thread was interruptedpublic boolean shutdown()
throws InterruptedException
true if the operation was successfulInterruptedException - if the current thread was interruptedprotected TaxonomyNode<ElkClass> getTaxonomyNode(ElkClass elkClass) throws ElkException
TaxonomyNode from the taxonomy.elkClass - an ElkClass for which to find a TaxonomyNodeTaxonomyNode for the given ElkClassElkExceptionprotected InstanceNode<ElkClass,ElkNamedIndividual> getInstanceNode(ElkNamedIndividual elkNamedIndividual) throws ElkException
InstanceNode from the taxonomy.elkNamedIndividual - InstanceNode for the given ElkNamedIndividualElkException - if the result cannot be computedprotected TypeNode<ElkClass,ElkNamedIndividual> getTypeNode(ElkClass elkClass) throws ElkException
TypeNode from the taxonomy.elkClass - TypeNode for the given ElkClassElkException - if the result cannot be computedpublic TaxonomyNode<ElkClass> getClassNode(ElkClassExpression classExpression) throws ElkException
TaxonomyNode for the given ElkClassExpression.
Calling of this method may trigger the computation of the taxonomy, if it
has not been done yet. If the input is an ElkClass that does not
occur in the ontology and fresh entities are not allowed, a
ElkFreshEntitiesException will be thrown.classExpression - the ElkClassExpression for which to return the
NodeTaxonomyNode for the given ElkClassExpressionElkException - if the result cannot be computedpublic Node<ElkClass> getEquivalentClasses(ElkClassExpression classExpression) throws ElkException
Node containing equivalent classes of the given
ElkClassExpression. Calling of this method may trigger the
computation of the taxonomy, if it has not been done yet.classExpression - the ElkClassExpression for which to return the
NodeNode whose members are ElkClasses
equivalent to the given ElkClassExpressionElkException - if the result cannot be computedpublic Set<? extends Node<ElkClass>> getSubClasses(ElkClassExpression classExpression, boolean direct) throws ElkException
ElkClassExpression as specified by the parameter. The method
returns a set of Nodes, each of which representing an equivalent
class of subclasses. Calling of this method may trigger the computation
of the taxonomy, if it has not been done yet.classExpression - the ElkClassExpression for which to return the
subclass Nodesdirect - if true, only direct subclasses should be returnedNodes for direct or indirect subclasses of the
given ElkClassExpression according to the specified
parameterElkException - if the result cannot be computedpublic Set<? extends Node<ElkClass>> getSuperClasses(ElkClassExpression classExpression, boolean direct) throws ElkException
ElkClassExpression as specified by the parameter. The method
returns a set of Nodes, each of which representing an equivalent
class of superclasses. Calling of this method may trigger the computation
of the taxonomy, if it has not been done yet.classExpression - the ElkClassExpression for which to return the
superclass Nodesdirect - if true, only direct superclasses are returnedNodes for direct or indirect superclasses of
the given ElkClassExpression according to the specified
parameterElkException - if the result cannot be computedpublic Set<? extends Node<ElkNamedIndividual>> getInstances(ElkClassExpression classExpression, boolean direct) throws ElkException
ElkClassExpression as specified by the parameter. The method
returns a set of Nodes, each of which representing an equivalent
class of instances. Calling of this method may trigger the computation of
the realization, if it has not been done yet.classExpression - the ElkClassExpression for which to return the
instances Nodesdirect - if true, only direct instances are returnedNodes for direct or indirect instances of the
given ElkClassExpression according to the specified
parameterElkException - if the result cannot be computedpublic Set<? extends Node<ElkClass>> getTypes(ElkNamedIndividual elkNamedIndividual, boolean direct) throws ElkException
ElkNamedIndividual. The method returns a set of Nodes,
each of which representing an equivalent class of types. Calling of this
method may trigger the computation of the realization, if it has not been
done yet.elkNamedIndividual - the ElkNamedIndividual for which to return the types
Nodesdirect - if true, only direct types are returnedNodes for the direct or indirect types of the
given ElkNamedIndividual according to the specified
parameterElkException - if the result cannot be computedpublic boolean isSatisfiable(ElkClassExpression classExpression) throws ElkException
ElkClassExpression is satisfiable, that is, if
it can possibly have instances. ElkClassExpressions are not
satisfiable if they are equivalent to owl:Nothing. A satisfiable
ElkClassExpression is also called consistent or coherent. Calling
of this method may trigger the computation of the taxonomy, if it has not
been done yet.classExpression - the ElkClassExpression for which to check
satisfiabilitytrue if the given input is satisfiableElkException - if the result cannot be computedCopyright © 2011-2015 Department of Computer Science, University of Oxford. All Rights Reserved.