org.semanticweb.owlapi.reasoner.impl
Class OWLReasonerBase

java.lang.Object
  extended by org.semanticweb.owlapi.reasoner.impl.OWLReasonerBase
All Implemented Interfaces:
OWLReasoner
Direct Known Subclasses:
StructuralReasoner

public abstract class OWLReasonerBase
extends java.lang.Object
implements OWLReasoner

Author: Matthew Horridge
The University of Manchester
Information Management Group
Date: 01-Aug-2009


Constructor Summary
protected OWLReasonerBase(OWLOntology rootOntology, OWLReasonerConfiguration configuration, BufferingMode bufferingMode)
           
 
Method Summary
 void dispose()
          Disposes of this reasoner.
 void flush()
          Flushes the pending changes from the pending change list.
 BufferingMode getBufferingMode()
          Gets the buffering mode of this reasoner.
 FreshEntityPolicy getFreshEntityPolicy()
          Gets the Fresh Entity Policy in use by this reasoner.
 IndividualNodeSetPolicy getIndividualNodeSetPolicy()
          Gets the IndividualNodeSetPolicy in use by this reasoner.
 OWLDataFactory getOWLDataFactory()
           
 java.util.Set<OWLAxiom> getPendingAxiomAdditions()
          Gets the axioms that as a result of ontology changes need to be added to the reasoner to synchronise it with the root ontology imports closure.
 java.util.Set<OWLAxiom> getPendingAxiomRemovals()
          Gets the axioms that as a result of ontology changes need to removed to the reasoner to synchronise it with the root ontology imports closure.
 java.util.List<OWLOntologyChange> getPendingChanges()
          Gets the pending changes which need to be taken into consideration by the reasoner so that it is up to date with the root ontology imports closure.
 java.util.Collection<OWLAxiom> getReasonerAxioms()
          Gets the axioms that should be currently being reasoned over.
 OWLReasonerConfiguration getReasonerConfiguration()
           
 OWLOntology getRootOntology()
          Gets the "root" ontology that is loaded into this reasoner.
 long getTimeOut()
          Gets the time out (in milliseconds) for the most basic reasoning operations.
protected abstract  void handleChanges(java.util.Set<OWLAxiom> addAxioms, java.util.Set<OWLAxiom> removeAxioms)
          Asks the reasoner implementation to handle axiom additions and removals from the imports closure of the root ontology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semanticweb.owlapi.reasoner.OWLReasoner
getBottomClassNode, getBottomDataPropertyNode, getBottomObjectPropertyNode, getDataPropertyDomains, getDataPropertyValues, getDifferentIndividuals, getDisjointClasses, getDisjointDataProperties, getDisjointObjectProperties, getEquivalentClasses, getEquivalentDataProperties, getEquivalentObjectProperties, getInstances, getInverseObjectProperties, getObjectPropertyDomains, getObjectPropertyRanges, getObjectPropertyValues, getPrecomputableInferenceTypes, getReasonerName, getReasonerVersion, getSameIndividuals, getSubClasses, getSubDataProperties, getSubObjectProperties, getSuperClasses, getSuperDataProperties, getSuperObjectProperties, getTopClassNode, getTopDataPropertyNode, getTopObjectPropertyNode, getTypes, getUnsatisfiableClasses, interrupt, isConsistent, isEntailed, isEntailed, isEntailmentCheckingSupported, isPrecomputed, isSatisfiable, precomputeInferences
 

Constructor Detail

OWLReasonerBase

protected OWLReasonerBase(OWLOntology rootOntology,
                          OWLReasonerConfiguration configuration,
                          BufferingMode bufferingMode)
Method Detail

getReasonerConfiguration

public OWLReasonerConfiguration getReasonerConfiguration()

getBufferingMode

public BufferingMode getBufferingMode()
Description copied from interface: OWLReasoner
Gets the buffering mode of this reasoner.

Specified by:
getBufferingMode in interface OWLReasoner
Returns:
The buffering mode of this reasoner.

getTimeOut

public long getTimeOut()
Description copied from interface: OWLReasoner
Gets the time out (in milliseconds) for the most basic reasoning operations. That is the maximum time for a satisfiability test, subsumption test etc. The time out should be set at reasoner creation time. During satisfiability (subsumption) checking the reasoner will check to see if the time it has spent doing the single check is longer than the value returned by this method. If this is the case, the reasoner will throw a TimeOutException in the thread that is executing the reasoning process.

Note that clients that want a higher level timeout, at the level of classification for example, should start their own timers and request that the reasoner interrupts the current process using the OWLReasoner.interrupt() method.

Specified by:
getTimeOut in interface OWLReasoner
Returns:
The time out in milliseconds for basic reasoner operation. By default this is the value of Long.MAX_VALUE.

getRootOntology

public OWLOntology getRootOntology()
Description copied from interface: OWLReasoner
Gets the "root" ontology that is loaded into this reasoner. The reasoner takes into account the axioms in this ontology and its imports closure, plus the axioms returned by OWLReasoner.getPendingAxiomRemovals(), minus the axioms returned by OWLReasoner.getPendingAxiomAdditions() when reasoning.

Note that the root ontology is set at reasoner creation time and cannot be changed thereafter. Clients that want to add ontologies to and remove ontologies from the reasoner after creation time should create a "dummy" ontology that imports the "real" ontologies and then specify the dummy ontology as the root ontology at reasoner creation time.

Specified by:
getRootOntology in interface OWLReasoner
Returns:
The root ontology that is loaded into the reasoner.

getPendingChanges

public java.util.List<OWLOntologyChange> getPendingChanges()
Description copied from interface: OWLReasoner
Gets the pending changes which need to be taken into consideration by the reasoner so that it is up to date with the root ontology imports closure. After the OWLReasoner.flush() method is called the set of pending changes will be empty.

Specified by:
getPendingChanges in interface OWLReasoner
Returns:
A set of changes. Note that the changes represent the raw changes as applied to the imports closure of the root ontology.

getPendingAxiomAdditions

public java.util.Set<OWLAxiom> getPendingAxiomAdditions()
Description copied from interface: OWLReasoner
Gets the axioms that as a result of ontology changes need to be added to the reasoner to synchronise it with the root ontology imports closure. If the buffering mode is BufferingMode.NON_BUFFERING then there will be no pending axiom additions.

Specified by:
getPendingAxiomAdditions in interface OWLReasoner
Returns:
The set of axioms that need to added to the reasoner to the reasoner to synchronise it with the root ontology imports closure.

getPendingAxiomRemovals

public java.util.Set<OWLAxiom> getPendingAxiomRemovals()
Description copied from interface: OWLReasoner
Gets the axioms that as a result of ontology changes need to removed to the reasoner to synchronise it with the root ontology imports closure. If the buffering mode is BufferingMode.NON_BUFFERING then there will be no pending axiom additions.

Specified by:
getPendingAxiomRemovals in interface OWLReasoner
Returns:
The set of axioms that need to added to the reasoner to the reasoner to synchronise it with the root ontology imports closure.

flush

public void flush()
Flushes the pending changes from the pending change list. The changes will be analysed to dermine which axioms have actually been added and removed from the imports closure of the root ontology and then the reasoner will be asked to handle these changes via the handleChanges(java.util.Set, java.util.Set) method.

Specified by:
flush in interface OWLReasoner

getReasonerAxioms

public java.util.Collection<OWLAxiom> getReasonerAxioms()
Gets the axioms that should be currently being reasoned over.

Returns:
A collections of axioms (not containing duplicates) that the reasoner should be taking into consideration when reasoning. This set of axioms many not correspond to the current state of the imports closure of the reasoner root ontology if the reasoner is buffered.

handleChanges

protected abstract void handleChanges(java.util.Set<OWLAxiom> addAxioms,
                                      java.util.Set<OWLAxiom> removeAxioms)
Asks the reasoner implementation to handle axiom additions and removals from the imports closure of the root ontology. The changes will not include annotation axiom additions and removals.

Parameters:
addAxioms - The axioms to be added to the reasoner.
removeAxioms - The axioms to be removed from the reasoner

dispose

public void dispose()
Description copied from interface: OWLReasoner
Disposes of this reasoner. This frees up any resources used by the reasoner and detaches the reasoner as an OWLOntologyChangeListener from the OWLOntologyManager that manages the ontologies contained within the reasoner.

Specified by:
dispose in interface OWLReasoner

getFreshEntityPolicy

public FreshEntityPolicy getFreshEntityPolicy()
Description copied from interface: OWLReasoner
Gets the Fresh Entity Policy in use by this reasoner. The policy is set at reasoner creation time.

Specified by:
getFreshEntityPolicy in interface OWLReasoner
Returns:
The policy.

getIndividualNodeSetPolicy

public IndividualNodeSetPolicy getIndividualNodeSetPolicy()
Description copied from interface: OWLReasoner
Gets the IndividualNodeSetPolicy in use by this reasoner. The policy is set at reasoner creation time.

Specified by:
getIndividualNodeSetPolicy in interface OWLReasoner
Returns:
The policy.

getOWLDataFactory

public OWLDataFactory getOWLDataFactory()