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.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()
default constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected OWLOntology |
getOntology()
Gets the ontology which the current change being visited was applied to.
|
protected boolean |
isAdd() |
protected boolean |
isRemove() |
protected void |
processChange(OWLAxiomChange change) |
void |
processChanges(List<? extends OWLOntologyChange> changes) |
handleDefault, 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, visitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisit, 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, visitvisit, visit, visit, visitprotected boolean add
protected OWLOntology ontology
protected final OWLOntologyChangeVisitor changeVisitor
public void processChanges(List<? extends OWLOntologyChange> changes)
changes - changes to processprotected void processChange(OWLAxiomChange change)
protected boolean isAdd()
protected boolean isRemove()
protected 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.Copyright © 2014 The University of Manchester. All Rights Reserved.