uk.ac.manchester.cs.owlapi.inference.dig11
Class DIGReasoner

java.lang.Object
  extended by org.semanticweb.owlapi.inference.OWLReasonerAdapter
      extended by uk.ac.manchester.cs.owlapi.inference.dig11.DIGReasoner
All Implemented Interfaces:
OWLClassReasoner, OWLConsistencyChecker, OWLIndividualReasoner, OWLPropertyReasoner, OWLReasoner, OWLReasonerBase, OWLSatisfiabilityChecker, OWLOntologyChangeListener

public class DIGReasoner
extends OWLReasonerAdapter

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

A DIG reasoner supports queries about classes and individual. This particular implementation does not support role queries, because the current version of DIG (1.1) is lacking with respect to role query functionality (e.g. domain/range and role characteristic queries are not supported).


Constructor Summary
DIGReasoner(OWLOntologyManager owlOntologyManager)
          Creates a reasoner that is backed by a DIG server.
 
Method Summary
 void classify()
          Asks the reasoner to classify the ontology.
 void disposeReasoner()
          This method should be called to dispose of the reasoner.
 java.util.Set<java.util.Set<OWLClass>> getAncestorClasses(OWLClassExpression classExpression)
          Returns the collection of all superclasses of the given class expression.
 java.util.Set<java.util.Set<OWLDataProperty>> getAncestorProperties(OWLDataProperty property)
           
 java.util.Set<java.util.Set<OWLObjectProperty>> getAncestorProperties(OWLObjectProperty property)
           
 java.util.Map<OWLDataProperty,java.util.Set<OWLLiteral>> getDataPropertyRelationships(OWLNamedIndividual individual)
           
 java.util.Set<java.util.Set<OWLClass>> getDescendantClasses(OWLClassExpression classExpression)
          Returns the collection of all subclasses of the given class expression.
 java.util.Set<java.util.Set<OWLDataProperty>> getDescendantProperties(OWLDataProperty property)
           
 java.util.Set<java.util.Set<OWLObjectProperty>> getDescendantProperties(OWLObjectProperty property)
           
 java.util.Set<java.util.Set<OWLClassExpression>> getDomains(OWLDataProperty property)
           
 java.util.Set<java.util.Set<OWLClassExpression>> getDomains(OWLObjectProperty property)
          Gets the domains of a particular property.
 java.util.Set<OWLClass> getEquivalentClasses(OWLClassExpression classExpression)
          Returns the collection of (named) classes which are equivalent to the given class expression.
 java.util.Set<OWLDataProperty> getEquivalentProperties(OWLDataProperty property)
           
 java.util.Set<OWLObjectProperty> getEquivalentProperties(OWLObjectProperty property)
           
 java.util.Set<OWLNamedIndividual> getIndividuals(OWLClassExpression clsC, boolean direct)
           
 java.util.Set<java.util.Set<OWLObjectProperty>> getInverseProperties(OWLObjectProperty property)
           
 java.lang.String getKbURI()
          Gets the DIG server kb URI that this reasoner uses as a handle.
 java.util.Map<OWLObjectProperty,java.util.Set<OWLNamedIndividual>> getObjectPropertyRelationships(OWLNamedIndividual individual)
           
 java.util.Set<OWLDataRange> getRanges(OWLDataProperty property)
           
 java.util.Set<OWLClassExpression> getRanges(OWLObjectProperty property)
           
 HTTPReasoner getReasoner()
          Gets the HTTPReasoner that backs this DIG reasoner.
 java.util.Set<OWLNamedIndividual> getRelatedIndividuals(OWLNamedIndividual subject, OWLObjectPropertyExpression property)
           
 java.util.Set<OWLLiteral> getRelatedValues(OWLNamedIndividual subject, OWLDataPropertyExpression property)
           
 java.util.Set<java.util.Set<OWLClass>> getSubClasses(OWLClassExpression classExpression)
          Returns the collection of (named) most general subclasses of the given class expression.
 java.util.Set<java.util.Set<OWLDataProperty>> getSubProperties(OWLDataProperty property)
           
 java.util.Set<java.util.Set<OWLObjectProperty>> getSubProperties(OWLObjectProperty property)
           
 java.util.Set<java.util.Set<OWLClass>> getSuperClasses(OWLClassExpression classExpression)
          Returns the collection of (named) most specific superclasses of the given class expression.
 java.util.Set<java.util.Set<OWLDataProperty>> getSuperProperties(OWLDataProperty property)
           
 java.util.Set<java.util.Set<OWLObjectProperty>> getSuperProperties(OWLObjectProperty property)
           
 DIGTranslator getTranslator()
          Gets the translator that translates back and forth between DIG documents and OWLAPI objects.
 java.util.Set<java.util.Set<OWLClass>> getTypes(OWLNamedIndividual individual, boolean direct)
           
 java.util.Set<OWLClass> getUnsatisfiableClasses()
          A convenience methods for obtaining all classes which are inconsistent.
protected  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.
 boolean hasDataPropertyRelationship(OWLNamedIndividual subject, OWLDataPropertyExpression property, OWLLiteral object)
           
 boolean hasObjectPropertyRelationship(OWLNamedIndividual subject, OWLObjectPropertyExpression property, OWLNamedIndividual object)
           
 boolean hasType(OWLNamedIndividual individual, OWLClassExpression type, boolean direct)
           
 boolean isAsymmetric(OWLObjectProperty property)
           
 boolean isClassified()
          Determines if the reasoner has classified the ontology.
 boolean isConsistent(OWLOntology ontology)
          Checks to see if the ontology that have been loaded into the reasoner are consistent in combination.
 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(OWLClassExpression clsC, OWLClassExpression clsD)
          Checks whether the first class is equivalent to the second class
 boolean isFunctional(OWLDataProperty property)
           
 boolean isFunctional(OWLObjectProperty property)
           
 boolean isInverseFunctional(OWLObjectProperty property)
           
 boolean isIrreflexive(OWLObjectProperty property)
           
 boolean isRealised()
          Determines if the types of individuals have been computed by this reasoner (if supported).
 boolean isReasonerSynchonised()
           
 boolean isReflexive(OWLObjectProperty property)
           
 boolean isSatisfiable(OWLClassExpression cls)
          Determines if the specified class is satisfiable.
 boolean isSubClassOf(OWLClassExpression clsC, OWLClassExpression clsD)
          Checks whether the first class is a subclass of the second class
 boolean isSymmetric(OWLObjectProperty property)
           
 boolean isTransitive(OWLObjectProperty property)
           
protected  void ontologiesChanged()
          This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has changed.
protected  void ontologiesCleared()
          This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has been cleared.
protected  org.w3c.dom.Document performRequest(org.w3c.dom.Document doc)
          Performs a request using the DIG HTTP Reasoner.
 void realise()
          Asks the reasoner to compute the types of individuals (if supported).
protected  void synchroniseReasoner()
          This method synchronises the reasoner if necessary.
 
Methods inherited from class org.semanticweb.owlapi.inference.OWLReasonerAdapter
clearOntologies, createSetOfSets, dispose, flattenSetOfSets, getAllAxioms, getLoadedOntologies, getOWLDataFactory, getOWLOntologyManager, loadOntologies, ontologiesChanged, unloadOntologies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DIGReasoner

public DIGReasoner(OWLOntologyManager owlOntologyManager)
            throws OWLException
Creates a reasoner that is backed by a DIG server.

Parameters:
owlOntologyManager - The OWLOntologyManager that should be used to obtain imported ontologies.
Throws:
OWLException
Method Detail

getReasoner

public HTTPReasoner getReasoner()
Gets the HTTPReasoner that backs this DIG reasoner.


getTranslator

public DIGTranslator getTranslator()
Gets the translator that translates back and forth between DIG documents and OWLAPI objects.


getKbURI

public java.lang.String getKbURI()
Gets the DIG server kb URI that this reasoner uses as a handle.


isClassified

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

Returns:
true if the ontology has been classified, or false if the ontology has not been classified.

classify

public void classify()
              throws OWLReasonerException
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.

Throws:
OWLReasonerException

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

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.

Throws:
OWLReasonerException

disposeReasoner

public void disposeReasoner()
This method should be called to dispose of the reasoner. In terms of the external DIG reasoner, this method simply releases the knowledge base corresponding to this reasoner.

Specified by:
disposeReasoner in class OWLReasonerAdapter

ontologiesCleared

protected void ontologiesCleared()
Description copied from class: OWLReasonerAdapter
This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has been cleared.

Specified by:
ontologiesCleared in class OWLReasonerAdapter

ontologiesChanged

protected void ontologiesChanged()
Description copied from class: OWLReasonerAdapter
This method will be called when the set of ontologies from which axioms should be retrieved for reasoning has changed.

Specified by:
ontologiesChanged in class OWLReasonerAdapter

handleOntologyChanges

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

Specified by:
handleOntologyChanges in class OWLReasonerAdapter
Parameters:
changes - The set of changes that represent changes to loaded ontologies.

isReasonerSynchonised

public boolean isReasonerSynchonised()

synchroniseReasoner

protected void synchroniseReasoner()
                            throws DIGReasonerException
This method synchronises the reasoner if necessary.

Throws:
DIGReasonerException

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.

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.

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.

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.

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

performRequest

protected org.w3c.dom.Document performRequest(org.w3c.dom.Document doc)
                                       throws DIGReasonerException
Performs a request using the DIG HTTP Reasoner. This method ensures that the reasoner has been synchronised before the request is made.

Parameters:
doc - The Request DIG Document
Returns:
The response from the reasoner.
Throws:
DIGReasonerException

isConsistent

public boolean isConsistent(OWLOntology ontology)
                     throws OWLReasonerException
Description copied from interface: OWLConsistencyChecker
Checks to see if the ontology that have been loaded into the reasoner are consistent in combination.

Parameters:
ontology - Implementations should ignore this parameter. It is here for legacy reasons.
Returns:
true if the loaded ontologies in combination are consistent, or false if the loaded ontologies in combination are not consistent.
Throws:
OWLReasonerException

isSatisfiable

public boolean isSatisfiable(OWLClassExpression cls)
                      throws OWLReasonerException
Description copied from interface: OWLSatisfiabilityChecker
Determines if the specified class is satisfiable.

Throws:
OWLReasonerException

isSubClassOf

public boolean isSubClassOf(OWLClassExpression clsC,
                            OWLClassExpression clsD)
                     throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Checks whether the first class is a subclass of the second class

Returns:
true if the first class is a subclass of the second class
Throws:
OWLReasonerException

isEquivalentClass

public boolean isEquivalentClass(OWLClassExpression clsC,
                                 OWLClassExpression clsD)
                          throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Checks whether the first class is equivalent to the second class

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
Throws:
OWLReasonerException

getSuperClasses

public java.util.Set<java.util.Set<OWLClass>> getSuperClasses(OWLClassExpression classExpression)
                                                       throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Returns the collection of (named) most specific superclasses of the given class expression. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Throws:
OWLReasonerException

getAncestorClasses

public java.util.Set<java.util.Set<OWLClass>> getAncestorClasses(OWLClassExpression classExpression)
                                                          throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Returns the collection of all superclasses of the given class expression. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Throws:
OWLReasonerException

getSubClasses

public java.util.Set<java.util.Set<OWLClass>> getSubClasses(OWLClassExpression classExpression)
                                                     throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Returns the collection of (named) most general subclasses of the given class expression. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Throws:
OWLReasonerException

getDescendantClasses

public java.util.Set<java.util.Set<OWLClass>> getDescendantClasses(OWLClassExpression classExpression)
                                                            throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Returns the collection of all subclasses of the given class expression. The result of this will be a set of sets, where each set in the collection represents an equivalence class.

Throws:
OWLReasonerException

getEquivalentClasses

public java.util.Set<OWLClass> getEquivalentClasses(OWLClassExpression classExpression)
                                             throws OWLReasonerException
Description copied from interface: OWLClassReasoner
Returns the collection of (named) classes which are equivalent to the given class expression.

Throws:
OWLReasonerException

getUnsatisfiableClasses

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

Returns:
A set of classes which are inconsistent.
Throws:
OWLReasonerException

getTypes

public java.util.Set<java.util.Set<OWLClass>> getTypes(OWLNamedIndividual individual,
                                                       boolean direct)
                                                throws OWLReasonerException
Throws:
OWLReasonerException

getIndividuals

public java.util.Set<OWLNamedIndividual> getIndividuals(OWLClassExpression clsC,
                                                        boolean direct)
                                                 throws OWLReasonerException
Throws:
OWLReasonerException

getObjectPropertyRelationships

public java.util.Map<OWLObjectProperty,java.util.Set<OWLNamedIndividual>> getObjectPropertyRelationships(OWLNamedIndividual individual)
                                                                                                  throws OWLReasonerException
Throws:
OWLReasonerException

getDataPropertyRelationships

public java.util.Map<OWLDataProperty,java.util.Set<OWLLiteral>> getDataPropertyRelationships(OWLNamedIndividual individual)
                                                                                      throws OWLReasonerException
Throws:
OWLReasonerException

getRelatedIndividuals

public java.util.Set<OWLNamedIndividual> getRelatedIndividuals(OWLNamedIndividual subject,
                                                               OWLObjectPropertyExpression property)
                                                        throws OWLReasonerException
Throws:
OWLReasonerException

getRelatedValues

public java.util.Set<OWLLiteral> getRelatedValues(OWLNamedIndividual subject,
                                                  OWLDataPropertyExpression property)
                                           throws OWLReasonerException
Throws:
OWLReasonerException

hasDataPropertyRelationship

public boolean hasDataPropertyRelationship(OWLNamedIndividual subject,
                                           OWLDataPropertyExpression property,
                                           OWLLiteral object)
                                    throws OWLReasonerException
Throws:
OWLReasonerException

hasObjectPropertyRelationship

public boolean hasObjectPropertyRelationship(OWLNamedIndividual subject,
                                             OWLObjectPropertyExpression property,
                                             OWLNamedIndividual object)
                                      throws OWLReasonerException
Throws:
OWLReasonerException

hasType

public boolean hasType(OWLNamedIndividual individual,
                       OWLClassExpression type,
                       boolean direct)
                throws OWLReasonerException
Throws:
OWLReasonerException

getSuperProperties

public java.util.Set<java.util.Set<OWLObjectProperty>> getSuperProperties(OWLObjectProperty property)
                                                                   throws OWLReasonerException
Throws:
OWLReasonerException

getSubProperties

public java.util.Set<java.util.Set<OWLObjectProperty>> getSubProperties(OWLObjectProperty property)
                                                                 throws OWLReasonerException
Throws:
OWLReasonerException

getAncestorProperties

public java.util.Set<java.util.Set<OWLObjectProperty>> getAncestorProperties(OWLObjectProperty property)
                                                                      throws OWLReasonerException
Throws:
OWLReasonerException

getDescendantProperties

public java.util.Set<java.util.Set<OWLObjectProperty>> getDescendantProperties(OWLObjectProperty property)
                                                                        throws OWLReasonerException
Throws:
OWLReasonerException

getInverseProperties

public java.util.Set<java.util.Set<OWLObjectProperty>> getInverseProperties(OWLObjectProperty property)
                                                                     throws OWLReasonerException
Throws:
OWLReasonerException

getEquivalentProperties

public java.util.Set<OWLObjectProperty> getEquivalentProperties(OWLObjectProperty property)
                                                         throws OWLReasonerException
Throws:
OWLReasonerException

getDomains

public java.util.Set<java.util.Set<OWLClassExpression>> getDomains(OWLObjectProperty property)
                                                            throws OWLReasonerException
Description copied from interface: OWLPropertyReasoner
Gets the domains of a particular property. A domain class, A, of a property, P, is a named class such that A is an ancestor of \exists p Top ("p some Thing").

Parameters:
property - The property whose domains are to be retrieved.
Returns:
The domains of the property. A set of sets of (named) equivalence classes.
Throws:
OWLReasonerException - If there is a problem with the reasoner.

getRanges

public java.util.Set<OWLClassExpression> getRanges(OWLObjectProperty property)
                                            throws OWLReasonerException
Throws:
OWLReasonerException

isFunctional

public boolean isFunctional(OWLObjectProperty property)
                     throws OWLReasonerException
Throws:
OWLReasonerException

isInverseFunctional

public boolean isInverseFunctional(OWLObjectProperty property)
                            throws OWLReasonerException
Throws:
OWLReasonerException

isSymmetric

public boolean isSymmetric(OWLObjectProperty property)
                    throws OWLReasonerException
Throws:
OWLReasonerException

isTransitive

public boolean isTransitive(OWLObjectProperty property)
                     throws OWLReasonerException
Throws:
OWLReasonerException

isReflexive

public boolean isReflexive(OWLObjectProperty property)
                    throws OWLReasonerException
Throws:
OWLReasonerException

isIrreflexive

public boolean isIrreflexive(OWLObjectProperty property)
                      throws OWLReasonerException
Throws:
OWLReasonerException

isAsymmetric

public boolean isAsymmetric(OWLObjectProperty property)
                     throws OWLReasonerException
Throws:
OWLReasonerException

getSuperProperties

public java.util.Set<java.util.Set<OWLDataProperty>> getSuperProperties(OWLDataProperty property)
                                                                 throws OWLReasonerException
Throws:
OWLReasonerException

getSubProperties

public java.util.Set<java.util.Set<OWLDataProperty>> getSubProperties(OWLDataProperty property)
                                                               throws OWLReasonerException
Throws:
OWLReasonerException

getAncestorProperties

public java.util.Set<java.util.Set<OWLDataProperty>> getAncestorProperties(OWLDataProperty property)
                                                                    throws OWLReasonerException
Throws:
OWLReasonerException

getDescendantProperties

public java.util.Set<java.util.Set<OWLDataProperty>> getDescendantProperties(OWLDataProperty property)
                                                                      throws OWLReasonerException
Throws:
OWLReasonerException

getEquivalentProperties

public java.util.Set<OWLDataProperty> getEquivalentProperties(OWLDataProperty property)
                                                       throws OWLReasonerException
Throws:
OWLReasonerException

getDomains

public java.util.Set<java.util.Set<OWLClassExpression>> getDomains(OWLDataProperty property)
                                                            throws OWLReasonerException
Throws:
OWLReasonerException

getRanges

public java.util.Set<OWLDataRange> getRanges(OWLDataProperty property)
                                      throws OWLReasonerException
Throws:
OWLReasonerException

isFunctional

public boolean isFunctional(OWLDataProperty property)
                     throws OWLReasonerException
Throws:
OWLReasonerException