org.semanticweb.owlapi.metrics
Class AbstractOWLMetric<M>

java.lang.Object
  extended by org.semanticweb.owlapi.metrics.AbstractOWLMetric<M>
All Implemented Interfaces:
OWLMetric<M>, OWLOntologyChangeListener
Direct Known Subclasses:
DLExpressivity, DoubleValuedMetric, IntegerValuedMetric

public abstract class AbstractOWLMetric<M>
extends java.lang.Object
implements OWLMetric<M>, OWLOntologyChangeListener

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 27-Jul-2007


Constructor Summary
AbstractOWLMetric(OWLOntologyManager owlOntologyManager)
           
 
Method Summary
 void dispose()
          Diposes of the metric.
protected abstract  void disposeMetric()
           
 OWLOntologyManager getManager()
          Gets the ontology manager which, amongst other things can be used to obtain the imports closure of the current ontology.
 java.util.Set<OWLOntology> getOntologies()
           
 OWLOntology getOntology()
          Gets the ontology which the value of the metric should be based on.
 M getValue()
          Gets the value of this metric.
 boolean isImportsClosureUsed()
          Determines if the computation of the metric should take into account the imports closure of the current ontology.
protected abstract  boolean isMetricInvalidated(java.util.List<? extends OWLOntologyChange> changes)
          Determines if the specified list of changes will cause the value of this metric to be invalid.
 void ontologiesChanged(java.util.List<? extends OWLOntologyChange> changes)
          Called when some changes have been applied to various ontologies.
protected abstract  M recomputeMetric()
           
 void setImportsClosureUsed(boolean b)
          Sets whether this metric uses the imports closure of the current ontology
 void setOntology(OWLOntology ontology)
          Sets the "root" ontology.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.semanticweb.owlapi.metrics.OWLMetric
getName
 

Constructor Detail

AbstractOWLMetric

public AbstractOWLMetric(OWLOntologyManager owlOntologyManager)
Method Detail

getOntology

public OWLOntology getOntology()
Description copied from interface: OWLMetric
Gets the ontology which the value of the metric should be based on.

Specified by:
getOntology in interface OWLMetric<M>
Returns:
The ontology.

setOntology

public final void setOntology(OWLOntology ontology)
Description copied from interface: OWLMetric
Sets the "root" ontology. The metric will be recomputed from this ontology (and potentially its imports closure if selected).

Specified by:
setOntology in interface OWLMetric<M>
Parameters:
ontology - The ontology for which the metric should be computed.

recomputeMetric

protected abstract M recomputeMetric()

getValue

public final M getValue()
Description copied from interface: OWLMetric
Gets the value of this metric. This value is computed w.r.t. the current ontology and possibly the imports closure (if specified).

Specified by:
getValue in interface OWLMetric<M>
Returns:
An object which represents the value of this metric - calling the toString method of the object returned by this method will result in a human readable string that displays the value of the metric.

getOntologies

public java.util.Set<OWLOntology> getOntologies()

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

getManager

public OWLOntologyManager getManager()
Description copied from interface: OWLMetric
Gets the ontology manager which, amongst other things can be used to obtain the imports closure of the current ontology.

Specified by:
getManager in interface OWLMetric<M>
Returns:
An OWLOntologyManager.

dispose

public void dispose()
Description copied from interface: OWLMetric
Diposes of the metric. If the metric attaches itself as a listener to an ontology manager then this will cause the metric to detach itself and stop listening for ontology changes.

Specified by:
dispose in interface OWLMetric<M>

isImportsClosureUsed

public final boolean isImportsClosureUsed()
Description copied from interface: OWLMetric
Determines if the computation of the metric should take into account the imports closure of the current ontology.

Specified by:
isImportsClosureUsed in interface OWLMetric<M>
Returns:
true if the imports closure of the current ontology is taken into account when computing the value of this metric, or false if the imports closure isn't taken into account when computing this metric.

setImportsClosureUsed

public void setImportsClosureUsed(boolean b)
Description copied from interface: OWLMetric
Sets whether this metric uses the imports closure of the current ontology

Specified by:
setImportsClosureUsed in interface OWLMetric<M>
Parameters:
b - true if this metric uses the imports closure of the current ontology, otherwise false.

isMetricInvalidated

protected abstract boolean isMetricInvalidated(java.util.List<? extends OWLOntologyChange> changes)
Determines if the specified list of changes will cause the value of this metric to be invalid.

Parameters:
changes - The list of changes which will be examined to determine if the metric is now invalid.
Returns:
true if the metric value is invalidated by the specified list of changes, or false if the list of changes do not cause the value of this metric to be invalidated.

disposeMetric

protected abstract void disposeMetric()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object