-
Notifications
You must be signed in to change notification settings - Fork 14
/
SubjectPropertyRemove.java
44 lines (36 loc) · 1.4 KB
/
SubjectPropertyRemove.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cz.cvut.kbss.ontodriver.owlapi.change;
import org.semanticweb.owlapi.model.OWLNamedIndividual;
import org.semanticweb.owlapi.model.OWLProperty;
import org.semanticweb.owlapi.model.OWLPropertyAssertionAxiom;
public abstract class SubjectPropertyRemove<T extends OWLProperty> implements TransactionalChange {
protected final OWLNamedIndividual subject;
protected final T property;
public SubjectPropertyRemove(OWLNamedIndividual subject, T property) {
this.subject = subject;
this.property = property;
}
@Override
public boolean overrides(TransactionalChange existing) {
if (existing instanceof MutableAddAxiom) {
final MutableAddAxiom ax = (MutableAddAxiom) existing;
if (ax.getAxiom() instanceof OWLPropertyAssertionAxiom) {
final OWLPropertyAssertionAxiom<?, ?> assertionAxiom = (OWLPropertyAssertionAxiom<?, ?>) ax.getAxiom();
return subject.equals(assertionAxiom.getSubject()) && property.equals(assertionAxiom.getProperty());
}
}
return false;
}
public OWLNamedIndividual getSubject() {
return subject;
}
public T getProperty() {
return property;
}
@Override
public String toString() {
return "SubjectPropertyRemove{" +
"subject=" + subject +
", property=" + property +
'}';
}
}