public class OWLOntologyChangeFilter extends OWLAxiomVisitorAdapter implements OWLAxiomVisitor
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);
Modifier and Type | Field and Description |
---|---|
protected boolean |
add |
protected OWLOntologyChangeVisitor |
changeVisitor |
protected OWLOntology |
ontology |
Constructor and Description |
---|
OWLOntologyChangeFilter() |
Modifier and Type | Method and Description |
---|---|
protected OWLOntology |
getOntology()
Gets the ontology which the current change being visited was applied to.
|
protected boolean |
isAdd()
Determines if the current change caused an axiom to be added to an ontology.
|
protected boolean |
isRemove()
Determines if the current change caused an axiom to be removed from an ontology.
|
protected void |
processChange(OWLAxiomChange change) |
void |
processChanges(java.util.List<? extends OWLOntologyChange> changes) |
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
visit, visit, visit, visit
protected boolean add
protected OWLOntology ontology
protected final OWLOntologyChangeVisitor changeVisitor
public final void processChanges(java.util.List<? extends OWLOntologyChange> changes)
changes
- changes to processprotected void processChange(OWLAxiomChange change)
protected final boolean isAdd()
protected final boolean isRemove()
protected final OWLOntology getOntology()
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
.