org.semanticweb.owl.inference
Class OWLReasonerAdapter

java.lang.Object
  extended by org.semanticweb.owl.inference.OWLReasonerAdapter
All Implemented Interfaces:
OWLClassReasoner, OWLConsistencyChecker, OWLIndividualReasoner, OWLPropertyReasoner, OWLReasoner, OWLReasonerBase, OWLSatisfiabilityChecker, OWLOntologyChangeListener
Direct Known Subclasses:
DIGReasoner, MonitorableOWLReasonerAdapter

public abstract class OWLReasonerAdapter
extends java.lang.Object
implements OWLReasoner, OWLOntologyChangeListener

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 18-Mar-2007


Constructor Summary
protected OWLReasonerAdapter(OWLOntologyManager manager)
           
 
Method Summary
 void clearOntologies()
          Clears the reasoner.
static
<O> java.util.Set<java.util.Set<O>>
createSetOfSets(java.util.Collection<O> objs, java.util.Map<O,java.util.Collection<O>> equivalentsMap)
           
 void dispose()
          Disposes of and cleans up any resources used by this reasoner.
protected abstract  void disposeReasoner()
           
static
<E> java.util.Set<E>
flattenSetOfSets(java.util.Set<java.util.Set<E>> setOfSets)
          A utility method that will flatten a set of sets.
protected  java.util.Set<OWLAxiom> getAllAxioms()
          A convenience method which gets the union of all logical axioms from ontologies which have been loaded into this reasoner.
 java.util.Set<OWLOntology> getLoadedOntologies()
          Gets the ontologies that have been loaded into this reasoner.
protected  OWLDataFactory getOWLDataFactory()
           
protected  OWLOntologyManager getOWLOntologyManager()
           
protected abstract  void handleOntologyChanges(java.util.List<OWLOntologyChange> changes)
          This method will be called when any of the loaded ontologies have had logical axioms added to or removed from them.
 void loadOntologies(java.util.Set<OWLOntology> ontologies)
          Loads the specified ontologies.
protected abstract  void ontologiesChanged()
          This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has changed.
 void ontologiesChanged(java.util.List<? extends OWLOntologyChange> changes)
          Called when some changes have been applied to various ontologies.
protected abstract  void ontologiesCleared()
          This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has been cleared.
 void unloadOntologies(java.util.Set<OWLOntology> ontologies)
          Unloads the specified ontologies from this reasoner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semanticweb.owl.inference.OWLConsistencyChecker
isConsistent
 
Methods inherited from interface org.semanticweb.owl.inference.OWLClassReasoner
getAncestorClasses, getDescendantClasses, getEquivalentClasses, getInconsistentClasses, getSubClasses, getSuperClasses, isEquivalentClass, isSubClassOf
 
Methods inherited from interface org.semanticweb.owl.inference.OWLSatisfiabilityChecker
isSatisfiable
 
Methods inherited from interface org.semanticweb.owl.inference.OWLIndividualReasoner
getDataPropertyRelationships, getIndividuals, getObjectPropertyRelationships, getRelatedIndividuals, getRelatedValues, getTypes, hasDataPropertyRelationship, hasObjectPropertyRelationship, hasType
 
Methods inherited from interface org.semanticweb.owl.inference.OWLPropertyReasoner
getAncestorProperties, getAncestorProperties, getDescendantProperties, getDescendantProperties, getDomains, getDomains, getEquivalentProperties, getEquivalentProperties, getInverseProperties, getRanges, getRanges, getSubProperties, getSubProperties, getSuperProperties, getSuperProperties, isAntiSymmetric, isFunctional, isFunctional, isInverseFunctional, isIrreflexive, isReflexive, isSymmetric, isTransitive
 

Constructor Detail

OWLReasonerAdapter

protected OWLReasonerAdapter(OWLOntologyManager manager)
Method Detail

dispose

public final void dispose()
Description copied from interface: OWLReasonerBase
Disposes of and cleans up any resources used by this reasoner.

Specified by:
dispose in interface OWLReasonerBase

disposeReasoner

protected abstract void disposeReasoner()

getOWLOntologyManager

protected OWLOntologyManager getOWLOntologyManager()

getOWLDataFactory

protected OWLDataFactory getOWLDataFactory()

loadOntologies

public void loadOntologies(java.util.Set<OWLOntology> ontologies)
                    throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Loads the specified ontologies. The reasoner will then take into consideration the logical axioms in each ontology. Note that this methods does not load any ontologies in the imports closure - all imports must be loaded explicitly.

Specified by:
loadOntologies in interface OWLReasonerBase
Parameters:
ontologies - The ontolgies to be loaded.
Throws:
OWLReasonerException

getLoadedOntologies

public java.util.Set<OWLOntology> getLoadedOntologies()
Description copied from interface: OWLReasonerBase
Gets the ontologies that have been loaded into this reasoner.

Specified by:
getLoadedOntologies in interface OWLReasonerBase

unloadOntologies

public void unloadOntologies(java.util.Set<OWLOntology> ontologies)
                      throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Unloads the specified ontologies from this reasoner.

Specified by:
unloadOntologies in interface OWLReasonerBase
Parameters:
ontologies - The ontologies to be unloaded.
Throws:
OWLReasonerException

clearOntologies

public void clearOntologies()
                     throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Clears the reasoner. All loaded ontologies will be unloaded.

Specified by:
clearOntologies in interface OWLReasonerBase
Throws:
OWLReasonerException

ontologiesCleared

protected abstract void ontologiesCleared()
                                   throws OWLReasonerException
This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has been cleared.

Throws:
OWLReasonerException

ontologiesChanged

protected abstract void ontologiesChanged()
                                   throws OWLReasonerException
This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has changed.

Throws:
OWLReasonerException

getAllAxioms

protected java.util.Set<OWLAxiom> getAllAxioms()
A convenience method which gets the union of all logical axioms from ontologies which have been loaded into this reasoner.


ontologiesChanged

public void ontologiesChanged(java.util.List<? extends OWLOntologyChange> changes)
                       throws OWLException
Description copied from interface: OWLOntologyChangeListener
Called when some changes have been applied to various ontologies. These may be an axiom added or an axiom removed changes.

Specified by:
ontologiesChanged in interface OWLOntologyChangeListener
Parameters:
changes - A list of changes that have occurred. Each change may be examined to determine which ontology it was applied to.
Throws:
OWLException

handleOntologyChanges

protected abstract void handleOntologyChanges(java.util.List<OWLOntologyChange> changes)
                                       throws OWLException
This method will be called when any of the loaded ontologies have had logical axioms added to or removed from them.

Parameters:
changes - The set of changes that represent changes to loaded ontologies.
Throws:
OWLException

flattenSetOfSets

public static <E> java.util.Set<E> flattenSetOfSets(java.util.Set<java.util.Set<E>> setOfSets)
A utility method that will flatten a set of sets.

Parameters:
setOfSets - The set of sets to be flattened.

createSetOfSets

public static <O> java.util.Set<java.util.Set<O>> createSetOfSets(java.util.Collection<O> objs,
                                                                  java.util.Map<O,java.util.Collection<O>> equivalentsMap)