org.semanticweb.owl.util
Class OWLOntologyChangeFilter
java.lang.Object
org.semanticweb.owl.util.OWLOntologyChangeFilter
- All Implemented Interfaces:
- OWLAxiomVisitor
- Direct Known Subclasses:
- FilteringOWLOntologyChangeListener
public class OWLOntologyChangeFilter
- extends java.lang.Object
- implements OWLAxiomVisitor
Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 17-Dec-2006
Provides a convenient method to filter add/remove axiom changes based
on the type of axiom that is being added or removed from an ontology.
The general pattern of use is to simply create an instance of the OWLOntologyChangeFilter
and override the appropriate visit methods corresponding to the types of axioms that are of interest.
Each visit corresponds to a single change and the isAdd
or isRemove
methods can
be used to determine if the axiom corresponding to the change is being added or removed from an ontology
- the ontology can be obtained via the getOntology
method.
Example: Suppose we are interested in changes that alter the domain of an object property. We receive
a list of changes, ontChanges
, from an ontology change listener. We can use the
OWLOntologyChangeFilter
to filter out the changes that alter the domain of an object
property in the following way:
OWLOntologyChangeFilter filter = new OWLOntologyChangeFilter() {
// Override the object property domain visit method
public void visit(OWLObjectPropertyDomainAxiom axiom) {
// Determine if the axiom is being added or removed
if(isAdd()) {
// Get hold of the ontology that the change applied to
OWLOntology ont = getOntology();
// Do something here
}
}
}
// Process the list of changes
filter.processChanges(ontChanges);
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OWLOntologyChangeFilter
public OWLOntologyChangeFilter()
processChanges
public final void processChanges(java.util.List<? extends OWLOntologyChange> changes)
isAdd
protected final boolean isAdd()
- Determines if the current change caused an axiom to be added to an ontology.
isRemove
protected final boolean isRemove()
- Determines if the current change caused an axiom to be removed from an ontology.
getOntology
protected final OWLOntology getOntology()
- Gets the ontology which the current change being visited was applied to.
- Returns:
- The ontology or
null
if the filter is not in a change
visit cycle. When called from within a visit
method, the
return value is guarenteed not to be null
.
visit
public void visit(OWLAntiSymmetricObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLAxiomAnnotationAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLClassAssertionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDataPropertyAssertionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDataPropertyDomainAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDataPropertyRangeAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDataSubPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDeclarationAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDifferentIndividualsAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDisjointClassesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDisjointDataPropertiesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDisjointObjectPropertiesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLDisjointUnionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLEntityAnnotationAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLEquivalentClassesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLEquivalentDataPropertiesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLEquivalentObjectPropertiesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLFunctionalDataPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLFunctionalObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLImportsDeclaration axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLInverseFunctionalObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLInverseObjectPropertiesAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLIrreflexiveObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLNegativeDataPropertyAssertionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLNegativeObjectPropertyAssertionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLObjectPropertyAssertionAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLObjectPropertyChainSubPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLObjectPropertyDomainAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLObjectPropertyRangeAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLObjectSubPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLReflexiveObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLSameIndividualsAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLSubClassAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLSymmetricObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLTransitiveObjectPropertyAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(SWRLRule rule)
- Specified by:
visit
in interface OWLAxiomVisitor
visit
public void visit(OWLOntologyAnnotationAxiom axiom)
- Specified by:
visit
in interface OWLAxiomVisitor