org.semanticweb.owl.util
Class ToldClassHierarchyReasoner

java.lang.Object
  extended by org.semanticweb.owl.util.ToldClassHierarchyReasoner
All Implemented Interfaces:
OWLClassReasoner, OWLReasonerBase, OWLSatisfiabilityChecker

public class ToldClassHierarchyReasoner
extends java.lang.Object
implements OWLClassReasoner

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 22-Nov-2006

A very simple syntactic (and therefore incomplete) reasoner, which provides information about the told named class hierarchy for an ontology and its imports closure. The current implementation does some very simple syntactic reasoning. For example SubClassOf( A And(B C)) would lead to B and C being superclasses of A, and A being a subclass of B and A being a subclass of C.


Constructor Summary
ToldClassHierarchyReasoner(OWLOntologyManager owlOntologyManager)
           
 
Method Summary
 void classify()
          Asks the reasoner to classify the ontology.
 void clearOntologies()
          Clears the reasoner.
 void dispose()
          Disposes of and cleans up any resources used by this reasoner.
 java.util.Set<java.util.Set<OWLClass>> getAncestorClasses(OWLDescription clsC)
          Returns the collection of all superclasses of the given description.
 java.util.Set<java.util.Set<OWLClass>> getDescendantClasses(OWLDescription clsC)
          Returns the collection of all subclasses of the given description.
 java.util.Set<OWLClass> getEquivalentClasses(OWLDescription clsC)
          Returns the collection of (named) classes which are equivalent to the given description.
 java.util.Set<OWLClass> getInconsistentClasses()
          A convenience methods for obtaining all classes which are inconsistent.
 java.util.Set<OWLOntology> getLoadedOntologies()
          Gets the ontologies that have been loaded into this reasoner.
 java.util.Set<java.util.Set<OWLClass>> getSubClasses(OWLDescription clsC)
          Returns the collection of (named) most general subclasses of the given description.
 java.util.Set<java.util.Set<OWLClass>> getSuperClasses(OWLDescription clsC)
          Returns the collection of (named) most specific superclasses of the given description.
 boolean isClassified()
          Determines if the reasoner has classified the ontology.
 boolean isDefined(OWLClass cls)
          Determines if the specified class is defined in the reasoner.
 boolean isDefined(OWLDataProperty prop)
          Determines if the specified property is defined in the reasoner.
 boolean isDefined(OWLIndividual ind)
          Determines if the specified individual is defined in the reasoner.
 boolean isDefined(OWLObjectProperty prop)
          Determines if the specified property is defined in the reasoner.
 boolean isEquivalentClass(OWLDescription clsC, OWLDescription clsD)
          Checks whether the first class is equivalent to the second class
 boolean isRealised()
          Determines if the types of individuals have been computed by this reasoner (if supported).
 boolean isSatisfiable(OWLDescription clsC)
          Checks whether the specified class is consistent
 boolean isSubClassOf(OWLDescription clsC, OWLDescription clsD)
          Checks whether the first class is a subclass of the second class
 void loadOntologies(java.util.Set<OWLOntology> ontologies)
          Loads the specified ontologies.
 void realise()
          Asks the reasoner to compute the types of individuals (if supported).
 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
 

Constructor Detail

ToldClassHierarchyReasoner

public ToldClassHierarchyReasoner(OWLOntologyManager owlOntologyManager)
Method Detail

dispose

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

Specified by:
dispose in interface OWLReasonerBase

isClassified

public boolean isClassified()
Description copied from interface: OWLReasonerBase
Determines if the reasoner has classified the ontology.

Specified by:
isClassified in interface OWLReasonerBase
Returns:
true if the ontology has been classified, or false if the ontology has not been classified.

classify

public void classify()
Description copied from interface: OWLReasonerBase
Asks the reasoner to classify the ontology. If the ontology has been classified then this method may not have any effect.

Specified by:
classify in interface OWLReasonerBase

isRealised

public boolean isRealised()
                   throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Determines if the types of individuals have been computed by this reasoner (if supported).

Specified by:
isRealised in interface OWLReasonerBase
Returns:
true is the types of individuals have been computed, otherwise false.
Throws:
OWLReasonerException

realise

public void realise()
             throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Asks the reasoner to compute the types of individuals (if supported). If realisation is not supported then this method will have no effect.

Specified by:
realise in interface OWLReasonerBase
Throws:
OWLReasonerException

isDefined

public boolean isDefined(OWLClass cls)
                  throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Determines if the specified class is defined in the reasoner. If a class is defined then the reasoner "knows" about it, if a class is not defined then the reasoner doesn't know about it.

Specified by:
isDefined in interface OWLReasonerBase
Parameters:
cls - The class to check for.
Returns:
true if the class is defined in the reasoner, or false if the class is not defined in the reasoner.
Throws:
OWLReasonerException

isDefined

public boolean isDefined(OWLObjectProperty prop)
                  throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Determines if the specified property is defined in the reasoner. If a property is defined then the reasoner "knows" about it, if a property is not defined then the reasoner doesn't know about it.

Specified by:
isDefined in interface OWLReasonerBase
Parameters:
prop - The property to check for.
Returns:
true if the property is defined in the reasoner, or false if the property is not defined in the reasoner.
Throws:
OWLReasonerException

isDefined

public boolean isDefined(OWLDataProperty prop)
                  throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Determines if the specified property is defined in the reasoner. If a property is defined then the reasoner "knows" about it, if a property is not defined then the reasoner doesn't know about it.

Specified by:
isDefined in interface OWLReasonerBase
Parameters:
prop - The property to check for.
Returns:
true if the property is defined in the reasoner, or false if the property is not defined in the reasoner.
Throws:
OWLReasonerException

isDefined

public boolean isDefined(OWLIndividual ind)
                  throws OWLReasonerException
Description copied from interface: OWLReasonerBase
Determines if the specified individual is defined in the reasoner. If an individual is defined then the reasoner "knows" about it, if a individual is not defined then the reasoner doesn't know about it.

Specified by:
isDefined in interface OWLReasonerBase
Parameters:
ind - The individual to check for.
Returns:
true if the individual is defined in the reasoner, or false if the individual is not defined in the reasoner.
Throws:
OWLReasonerException

loadOntologies

public void loadOntologies(java.util.Set<OWLOntology> ontologies)
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.

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)
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.

clearOntologies

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

Specified by:
clearOntologies in interface OWLReasonerBase

isSubClassOf

public boolean isSubClassOf(OWLDescription clsC,
                            OWLDescription clsD)
Checks whether the first class is a subclass of the second class

Specified by:
isSubClassOf in interface OWLClassReasoner
Returns:
true if the first class is a subclass of the second class

isEquivalentClass

public boolean isEquivalentClass(OWLDescription clsC,
                                 OWLDescription clsD)
Checks whether the first class is equivalent to the second class

Specified by:
isEquivalentClass in interface OWLClassReasoner
Returns:
true if the first class is equivalent to the second class, or false if the first class is not equivalent to the second class

isSatisfiable

public boolean isSatisfiable(OWLDescription clsC)
Checks whether the specified class is consistent

Specified by:
isSatisfiable in interface OWLSatisfiabilityChecker
Parameters:
clsC - the class to check
Returns:
true if the class is consistent, or false if the class is not consistent

getInconsistentClasses

public java.util.Set<OWLClass> getInconsistentClasses()
A convenience methods for obtaining all classes which are inconsistent.

Specified by:
getInconsistentClasses in interface OWLClassReasoner
Returns:
A set of classes which are inconsistent.

getSuperClasses

public java.util.Set<java.util.Set<OWLClass>> getSuperClasses(OWLDescription clsC)
Returns the collection of (named) most specific superclasses of the given description. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Specified by:
getSuperClasses in interface OWLClassReasoner

getAncestorClasses

public java.util.Set<java.util.Set<OWLClass>> getAncestorClasses(OWLDescription clsC)
Returns the collection of all superclasses of the given description. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Specified by:
getAncestorClasses in interface OWLClassReasoner

getSubClasses

public java.util.Set<java.util.Set<OWLClass>> getSubClasses(OWLDescription clsC)
Returns the collection of (named) most general subclasses of the given description. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Specified by:
getSubClasses in interface OWLClassReasoner

getDescendantClasses

public java.util.Set<java.util.Set<OWLClass>> getDescendantClasses(OWLDescription clsC)
Returns the collection of all subclasses of the given description. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Specified by:
getDescendantClasses in interface OWLClassReasoner

getEquivalentClasses

public java.util.Set<OWLClass> getEquivalentClasses(OWLDescription clsC)
Returns the collection of (named) classes which are equivalent to the given description.

Specified by:
getEquivalentClasses in interface OWLClassReasoner