Protégé-OWL 3.4.1

edu.stanford.smi.protegex.owl.inference.reasoner
Class AbstractProtegeReasoner

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.inference.reasoner.AbstractProtegeReasoner
All Implemented Interfaces:
edu.stanford.smi.protege.util.Disposable, ProtegeReasoner
Direct Known Subclasses:
DefaultProtegeDIGReasoner

public abstract class AbstractProtegeReasoner
extends Object
implements ProtegeReasoner


Field Summary
protected  boolean autoSynchReasoner
           
protected  ClassListener classListener
           
protected  ModelListener modelListener
           
protected  OWLModel owlModel
           
protected  edu.stanford.smi.protege.event.ProjectListener projectListener
           
protected  PropertyListener propertyListener
           
protected  PropertyValueListener propertyValueListener
           
protected  ReasonerTaskListener reasonerTaskListener
           
protected  ResourceListener resourceAdapter
           
protected  boolean synchronizeReasoner
           
 
Constructor Summary
protected AbstractProtegeReasoner()
           
 
Method Summary
protected  void addListeners()
           
 void classifyTaxonomy()
          For each named class in the ontology, this method queries the reasoner for the consistency of the class, its inferred super classes and its inferred equivalent classes.
 void computeEquivalentConcepts()
          This method queries the reasoner the equivalent classes for each class in the ontology, and updates protege-owl with the information.
 void computeInconsistentConcepts()
          This method queries the reasoner for the consistency of all classes in the ontology, and updates protege-owl with the information.
 void computeInferredHierarchy()
          For each named class in the ontology, this method queries the reasoner to obtain its inferred superclasses.
 void computeInferredIndividualTypes()
          This method queries the reasoner for the types of all individuals in the ontology, and updates protege-owl with the information.
 void dispose()
           
 void forceReasonerReSynchronization()
          Depending on the implementation of the ProtegeGenericReasoner, some kind of caching may be used.
 Collection<OWLClass> getAncestorClasses(OWLClass class1)
          Gets the inferred ancestor classes of the specified class.
 Collection<OWLProperty> getAncestorProperties(OWLProperty property)
           
protected  ClassListener getClassListener()
           
 Collection<OWLClass> getDescendantClasses(OWLClass class1)
          Gets the inferred descendant classes of the specified class.
 Collection<OWLProperty> getDescendantProperties(OWLProperty property)
           
 Collection<OWLClass> getEquivalentClasses(OWLClass class1)
          Gets the equivalent classes of the specified class.
 Collection<OWLClass> getIndividualDirectTypes(OWLIndividual owlIndividual)
          Get the direct inferred types for the specified individual.
 Collection<OWLIndividual> getIndividualsBelongingToClass(OWLClass class1)
          Gets the individuals that are inferred to be members of the specified class.
 Collection<OWLClass> getIndividualTypes(OWLIndividual individual)
          Get the inferred types (direct and indirect) for the specified individual.
protected  ModelListener getModelListener()
           
 OWLModel getOWLModel()
          Returns the OWL model to which this reasoner is attached to.
protected  edu.stanford.smi.protege.event.ProjectListener getProjectListener()
           
protected  PropertyListener getPropertyListener()
           
protected  PropertyValueListener getPropertyValueListener()
           
 ReasonerTaskListener getReasonerTaskListener()
           
 Collection<OWLIndividual> getRelatedIndividuals(OWLIndividual subject, OWLObjectProperty objectProperty)
          Get the individuals that are related to the subject individual through the object property objectProperty.
 Collection getRelatedValues(OWLIndividual subject, OWLDatatypeProperty datatypeProperty)
          Get the values that are related to the subject individual through the datatype property datatypeProperty.
protected  ResourceListener getResourceListener()
           
 Collection<OWLClass> getSubclasses(OWLClass class1)
          Gets the (direct) inferred subclasses of the specified class.
 Collection<OWLProperty> getSubProperties(OWLProperty property)
           
 int getSubsumptionRelationship(OWLClass cls1, OWLClass cls2)
           
 Collection<OWLClass> getSuperclasses(OWLClass class1)
          Gets the (direct) inferred superclasses of the specified class.
 Collection<OWLClass> getSuperclassesOfIntersection(OWLClass[] clses)
           
 Collection<OWLProperty> getSuperProperties(OWLProperty property)
           
 void initialize()
          This is an optional method that can be called by applications and that gives the reasoner a chance to do some pre-computations.
 boolean isAutoSynchronizationEnabled()
           
 boolean isDisjointTo(OWLClass cls1, OWLClass cls2)
          Determines if the specified classes are disjoint from each other.
 boolean isIntersectionSatisfiable(OWLClass[] clses)
          Determines if the intersection of the list of specified classes is satisfiable.
 boolean isSatisfiable(OWLClass class1)
          This method queries the reasoner to determine if the specified concept is satisfiable.
 boolean isSubsumedBy(OWLClass cls1, OWLClass cls2)
          Determines if one class (cls1) is subsumed by another class (cls2).
 void performTask(ReasonerTask task)
           
 void performTask(ReasonerTask task, ReasonerTaskListener taskListener)
           
protected  void reactToKnowledgeBaseChange()
           
 void rebind()
          Resynchronizes the reasoner with the OWL model.
protected  void removeListeners()
           
 void setAutoSynchronizationEnabled(boolean b)
          Depending on the implementation of the ProtegeOWLReasoner, the DIG reasoner may automatically be sunchronized with changes in the Protege-OWL knowledgebase.
 void setOWLModel(OWLModel owlModel)
          Sets the OWL model that will be attached to this reasoner.
 void setReasonerTaskListener(ReasonerTaskListener reasonerTaskListener)
          Set the listener which will be informed of the progress of the reasoning task.
protected  void synchronizeReasoner(ReasonerTaskListener taskListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.stanford.smi.protegex.owl.inference.reasoner.ProtegeReasoner
reset
 

Field Detail

owlModel

protected OWLModel owlModel

reasonerTaskListener

protected ReasonerTaskListener reasonerTaskListener

synchronizeReasoner

protected boolean synchronizeReasoner

autoSynchReasoner

protected boolean autoSynchReasoner

modelListener

protected ModelListener modelListener

resourceAdapter

protected ResourceListener resourceAdapter

propertyListener

protected PropertyListener propertyListener

classListener

protected ClassListener classListener

propertyValueListener

protected PropertyValueListener propertyValueListener

projectListener

protected edu.stanford.smi.protege.event.ProjectListener projectListener
Constructor Detail

AbstractProtegeReasoner

protected AbstractProtegeReasoner()
Method Detail

setReasonerTaskListener

public void setReasonerTaskListener(ReasonerTaskListener reasonerTaskListener)
Description copied from interface: ProtegeReasoner
Set the listener which will be informed of the progress of the reasoning task. May be null if the progress of the task does not need to be monitored.

Specified by:
setReasonerTaskListener in interface ProtegeReasoner

getReasonerTaskListener

public ReasonerTaskListener getReasonerTaskListener()
Specified by:
getReasonerTaskListener in interface ProtegeReasoner

setOWLModel

public void setOWLModel(OWLModel owlModel)
Description copied from interface: ProtegeReasoner
Sets the OWL model that will be attached to this reasoner. The reasoner may do in this method a clean-up of the previously attached OWL model.

Specified by:
setOWLModel in interface ProtegeReasoner

dispose

public void dispose()
Specified by:
dispose in interface edu.stanford.smi.protege.util.Disposable

initialize

public void initialize()
Description copied from interface: ProtegeReasoner
This is an optional method that can be called by applications and that gives the reasoner a chance to do some pre-computations.

Specified by:
initialize in interface ProtegeReasoner

rebind

public void rebind()
Description copied from interface: ProtegeReasoner
Resynchronizes the reasoner with the OWL model. This usually implies a reset and a reload of the entire OWL model and can be an expensive operation. This is a useful method if the OWL model has changed, but the reasoner is not aware of the changes.

Specified by:
rebind in interface ProtegeReasoner

classifyTaxonomy

public void classifyTaxonomy()
                      throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
For each named class in the ontology, this method queries the reasoner for the consistency of the class, its inferred super classes and its inferred equivalent classes. The method updates the protege-owl structures that hold this information, meaning that methods on RDFSClass such as getInferredSuperClasses will return meaningful results.

Specified by:
classifyTaxonomy in interface ProtegeReasoner
Throws:
ProtegeReasonerException

computeInferredHierarchy

public void computeInferredHierarchy()
                              throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
For each named class in the ontology, this method queries the reasoner to obtain its inferred superclasses. This information is then pieced together to form the inferred hierarchy. The method updates the protege-owl structures that hold information about inferred superclasses, which means that methods such as getInferredSuperClasses on RDFSClass will return meaningful results.

Specified by:
computeInferredHierarchy in interface ProtegeReasoner
Throws:
ProtegeReasonerException

computeInconsistentConcepts

public void computeInconsistentConcepts()
                                 throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
This method queries the reasoner for the consistency of all classes in the ontology, and updates protege-owl with the information.

Specified by:
computeInconsistentConcepts in interface ProtegeReasoner
Throws:
ProtegeReasonerException

computeInferredIndividualTypes

public void computeInferredIndividualTypes()
                                    throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
This method queries the reasoner for the types of all individuals in the ontology, and updates protege-owl with the information.

Specified by:
computeInferredIndividualTypes in interface ProtegeReasoner
Throws:
ProtegeReasonerException

computeEquivalentConcepts

public void computeEquivalentConcepts()
                               throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
This method queries the reasoner the equivalent classes for each class in the ontology, and updates protege-owl with the information.

Specified by:
computeEquivalentConcepts in interface ProtegeReasoner
Throws:
ProtegeReasonerException

getEquivalentClasses

public Collection<OWLClass> getEquivalentClasses(OWLClass class1)
                                          throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the equivalent classes of the specified class.

Specified by:
getEquivalentClasses in interface ProtegeReasoner
Parameters:
class1 - The class whose equivalent classes are to be retrieved.
Returns:
A Collection containing the inferred equivalent classes of the specified class.
Throws:
ProtegeReasonerException

getAncestorClasses

public Collection<OWLClass> getAncestorClasses(OWLClass class1)
                                        throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the inferred ancestor classes of the specified class. The inferred ancestor classes is equivalent to the transitive closure of the inferred superclasses.

Specified by:
getAncestorClasses in interface ProtegeReasoner
Parameters:
class1 - The class whose inferred ancestor classes are to be retrieved.
Returns:
A Collection containing the inferred ancestor classes of the specified class.
Throws:
ProtegeReasonerException

getDescendantClasses

public Collection<OWLClass> getDescendantClasses(OWLClass class1)
                                          throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the inferred descendant classes of the specified class. The inferred descendant classes is equivalent to the transitive closure of the inferred subclasses.

Specified by:
getDescendantClasses in interface ProtegeReasoner
Parameters:
class1 - The class whose descendent classes are to be retrieved.
Returns:
A Collection containing the inferred descendent classes.
Throws:
ProtegeReasonerException

getIndividualTypes

public Collection<OWLClass> getIndividualTypes(OWLIndividual individual)
                                        throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Get the inferred types (direct and indirect) for the specified individual.

Specified by:
getIndividualTypes in interface ProtegeReasoner
Parameters:
individual - The individual whose inferred types are to be retrieved.
Returns:
A Collection of OWLClasses that represent the inferred types for the specified individual.
Throws:
ProtegeReasonerException

getIndividualDirectTypes

public Collection<OWLClass> getIndividualDirectTypes(OWLIndividual owlIndividual)
                                              throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Get the direct inferred types for the specified individual.

Specified by:
getIndividualDirectTypes in interface ProtegeReasoner
Parameters:
owlIndividual - The individual whose inferred direct types are to be retrieved.
Returns:
A Collection of OWLClasses that represent the inferred direct types for the specified individual.
Throws:
ProtegeReasonerException

getIndividualsBelongingToClass

public Collection<OWLIndividual> getIndividualsBelongingToClass(OWLClass class1)
                                                         throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the individuals that are inferred to be members of the specified class.

Specified by:
getIndividualsBelongingToClass in interface ProtegeReasoner
Parameters:
class1 - The class whose members are to be retrieved.
Returns:
A Collection containing the OWLIndividuals that are members of the specified class.
Throws:
ProtegeReasonerException

getOWLModel

public OWLModel getOWLModel()
Description copied from interface: ProtegeReasoner
Returns the OWL model to which this reasoner is attached to.

Specified by:
getOWLModel in interface ProtegeReasoner

getRelatedIndividuals

public Collection<OWLIndividual> getRelatedIndividuals(OWLIndividual subject,
                                                       OWLObjectProperty objectProperty)
                                                throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Get the individuals that are related to the subject individual through the object property objectProperty.

Specified by:
getRelatedIndividuals in interface ProtegeReasoner
Parameters:
subject - - An OWLIndividual
objectProperty - - A OWLObjectProperty
Returns:
A Collection of OWLIndividuals that are related to the subject individual through objectProperty
Throws:
ProtegeReasonerException

getRelatedValues

public Collection getRelatedValues(OWLIndividual subject,
                                   OWLDatatypeProperty datatypeProperty)
                            throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Get the values that are related to the subject individual through the datatype property datatypeProperty.

Specified by:
getRelatedValues in interface ProtegeReasoner
Parameters:
subject - - An OWLIndividual
Returns:
A Collection of values that are related to the subject individual through datatypeProperty
Throws:
ProtegeReasonerException

getSubclasses

public Collection<OWLClass> getSubclasses(OWLClass class1)
                                   throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the (direct) inferred subclasses of the specified class.

Specified by:
getSubclasses in interface ProtegeReasoner
Parameters:
class1 - The class whose inferred subclasses are to be retrieved.
Returns:
A Collection containing the inferred subclasses of the specified class.
Throws:
ProtegeReasonerException

getSubsumptionRelationship

public int getSubsumptionRelationship(OWLClass cls1,
                                      OWLClass cls2)
                               throws ProtegeReasonerException
Throws:
ProtegeReasonerException

getSuperclasses

public Collection<OWLClass> getSuperclasses(OWLClass class1)
                                     throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Gets the (direct) inferred superclasses of the specified class.

Specified by:
getSuperclasses in interface ProtegeReasoner
Parameters:
class1 - The class whose inferred superclasses are to be retrieved.
Returns:
A Collection containing the classes that are the inferred superclasses of the specified class.
Throws:
ProtegeReasonerException

getSuperclassesOfIntersection

public Collection<OWLClass> getSuperclassesOfIntersection(OWLClass[] clses)
                                                   throws ProtegeReasonerException
Throws:
ProtegeReasonerException

getSubProperties

public Collection<OWLProperty> getSubProperties(OWLProperty property)
                                         throws ProtegeReasonerException
Specified by:
getSubProperties in interface ProtegeReasoner
Throws:
ProtegeReasonerException

getSuperProperties

public Collection<OWLProperty> getSuperProperties(OWLProperty property)
                                           throws ProtegeReasonerException
Specified by:
getSuperProperties in interface ProtegeReasoner
Throws:
ProtegeReasonerException

getAncestorProperties

public Collection<OWLProperty> getAncestorProperties(OWLProperty property)
                                              throws ProtegeReasonerException
Specified by:
getAncestorProperties in interface ProtegeReasoner
Throws:
ProtegeReasonerException

getDescendantProperties

public Collection<OWLProperty> getDescendantProperties(OWLProperty property)
                                                throws ProtegeReasonerException
Specified by:
getDescendantProperties in interface ProtegeReasoner
Throws:
ProtegeReasonerException

isDisjointTo

public boolean isDisjointTo(OWLClass cls1,
                            OWLClass cls2)
                     throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Determines if the specified classes are disjoint from each other. Note that because disjointedness is a symmetric property, the order of the specified classes does not matter.

Specified by:
isDisjointTo in interface ProtegeReasoner
Parameters:
cls1 - An OWLClass
cls2 - An OWLClass
Returns:
true if cls1 is disjoint with cls2.
Throws:
ProtegeReasonerException

isIntersectionSatisfiable

public boolean isIntersectionSatisfiable(OWLClass[] clses)
                                  throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Determines if the intersection of the list of specified classes is satisfiable.

Specified by:
isIntersectionSatisfiable in interface ProtegeReasoner
Parameters:
clses - An array of OWLClasses, of which the satisfiablity of the intersection will be determined.
Returns:
true if the intersection of the list of classes is satisfiable (consistent) or false if the intersection of the list of classes is not satisfiable (not consistent)
Throws:
ProtegeReasonerException

isSatisfiable

public boolean isSatisfiable(OWLClass class1)
                      throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
This method queries the reasoner to determine if the specified concept is satisfiable.

Specified by:
isSatisfiable in interface ProtegeReasoner
Parameters:
class1 - The OWLClass whose satisfiablity is to be determined.
Returns:
true if the specified class is satisfiable (consistent) , or false if the specified class is not satisfiable (not consistent).
Throws:
ProtegeReasonerException

isSubsumedBy

public boolean isSubsumedBy(OWLClass cls1,
                            OWLClass cls2)
                     throws ProtegeReasonerException
Description copied from interface: ProtegeReasoner
Determines if one class (cls1) is subsumed by another class (cls2). In other words, determines if cls2 is a superclass of cls1.

Specified by:
isSubsumedBy in interface ProtegeReasoner
Parameters:
cls1 - The subsumee (the expected subclass)
cls2 - The subsumer (the expected superclass)
Returns:
true if cls1 is subsumed by cls2, or false if cls1 is not subsumed by cls2.
Throws:
ProtegeReasonerException

performTask

public void performTask(ReasonerTask task)
                 throws ProtegeReasonerException
Throws:
ProtegeReasonerException

performTask

public void performTask(ReasonerTask task,
                        ReasonerTaskListener taskListener)
                 throws ProtegeReasonerException
Throws:
ProtegeReasonerException

removeListeners

protected void removeListeners()

addListeners

protected void addListeners()

getClassListener

protected ClassListener getClassListener()

getPropertyListener

protected PropertyListener getPropertyListener()

getPropertyValueListener

protected PropertyValueListener getPropertyValueListener()

getResourceListener

protected ResourceListener getResourceListener()

getModelListener

protected ModelListener getModelListener()

getProjectListener

protected edu.stanford.smi.protege.event.ProjectListener getProjectListener()

synchronizeReasoner

protected void synchronizeReasoner(ReasonerTaskListener taskListener)
                            throws ProtegeReasonerException
Throws:
ProtegeReasonerException

reactToKnowledgeBaseChange

protected void reactToKnowledgeBaseChange()

forceReasonerReSynchronization

public void forceReasonerReSynchronization()
Description copied from interface: ProtegeReasoner
Depending on the implementation of the ProtegeGenericReasoner, some kind of caching may be used. This method will force the ProtegeOWLReasoner to synchronize the contents of the reasoner prior to the next query. (Note that this will not cause the reasoner to be resynchronized immediately - synchronisation will take place the next time the reasoner is queried).

Specified by:
forceReasonerReSynchronization in interface ProtegeReasoner

setAutoSynchronizationEnabled

public void setAutoSynchronizationEnabled(boolean b)
Description copied from interface: ProtegeReasoner
Depending on the implementation of the ProtegeOWLReasoner, the DIG reasoner may automatically be sunchronized with changes in the Protege-OWL knowledgebase. This method will enable/disable this autosynchronization (if it is used). Note that if reasoner synchronisation is disabled, and then it is subsequently necessary to resynchronise the reasoner, the forceReasonerReSynchronization method should be used.

Specified by:
setAutoSynchronizationEnabled in interface ProtegeReasoner
Parameters:
b - true to enable autosync, or false to disable autosync.

isAutoSynchronizationEnabled

public boolean isAutoSynchronizationEnabled()
Specified by:
isAutoSynchronizationEnabled in interface ProtegeReasoner

Protégé-OWL 3.4.1

Submit a bug report or feature request
Copyright (c) 1998-2009 Stanford University.