aboutsummaryrefslogtreecommitdiff
path: root/src/org/semanticweb/karma2/profile
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-10 18:17:06 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-11 12:34:47 +0100
commit17bd9beaf7f358a44e5bf36a5855fe6727d506dc (patch)
tree47e9310a0cff869d9ec017dcb2c81876407782c8 /src/org/semanticweb/karma2/profile
parent8651164cd632a5db310b457ce32d4fbc97bdc41c (diff)
downloadACQuA-17bd9beaf7f358a44e5bf36a5855fe6727d506dc.tar.gz
ACQuA-17bd9beaf7f358a44e5bf36a5855fe6727d506dc.zip
[pagoda] Move project to Scala
This commit includes a few changes: - The repository still uses Maven to manage dependency but it is now a Scala project. - The code has been ported from OWLAPI 3.4.10 to 5.1.20 - A proof of concept program using both RSAComb and PAGOdA has been added.
Diffstat (limited to 'src/org/semanticweb/karma2/profile')
-rw-r--r--src/org/semanticweb/karma2/profile/ELHOProfile.java281
-rw-r--r--src/org/semanticweb/karma2/profile/MyOWLOntologyWalker.java913
2 files changed, 0 insertions, 1194 deletions
diff --git a/src/org/semanticweb/karma2/profile/ELHOProfile.java b/src/org/semanticweb/karma2/profile/ELHOProfile.java
deleted file mode 100644
index fb68b05..0000000
--- a/src/org/semanticweb/karma2/profile/ELHOProfile.java
+++ /dev/null
@@ -1,281 +0,0 @@
1package org.semanticweb.karma2.profile;
2
3import java.util.HashSet;
4import java.util.Iterator;
5import java.util.Set;
6
7import org.semanticweb.owlapi.model.AxiomType;
8import org.semanticweb.owlapi.model.IRI;
9import org.semanticweb.owlapi.model.OWLAxiom;
10import org.semanticweb.owlapi.model.OWLClassExpression;
11import org.semanticweb.owlapi.model.OWLDataHasValue;
12import org.semanticweb.owlapi.model.OWLDataIntersectionOf;
13import org.semanticweb.owlapi.model.OWLDataOneOf;
14import org.semanticweb.owlapi.model.OWLDataProperty;
15import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
16import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom;
17import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom;
18import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom;
19import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom;
20import org.semanticweb.owlapi.model.OWLFunctionalDataPropertyAxiom;
21import org.semanticweb.owlapi.model.OWLHasKeyAxiom;
22import org.semanticweb.owlapi.model.OWLNegativeDataPropertyAssertionAxiom;
23import org.semanticweb.owlapi.model.OWLNegativeObjectPropertyAssertionAxiom;
24import org.semanticweb.owlapi.model.OWLObjectHasSelf;
25import org.semanticweb.owlapi.model.OWLObjectMinCardinality;
26import org.semanticweb.owlapi.model.OWLObjectOneOf;
27import org.semanticweb.owlapi.model.OWLOntology;
28import org.semanticweb.owlapi.model.OWLOntologyCreationException;
29import org.semanticweb.owlapi.model.OWLOntologyManager;
30import org.semanticweb.owlapi.model.OWLReflexiveObjectPropertyAxiom;
31import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom;
32import org.semanticweb.owlapi.model.OWLSubPropertyChainOfAxiom;
33import org.semanticweb.owlapi.model.OWLTransitiveObjectPropertyAxiom;
34import org.semanticweb.owlapi.profiles.OWL2ELProfile;
35import org.semanticweb.owlapi.profiles.OWLProfile;
36import org.semanticweb.owlapi.profiles.OWLProfileReport;
37import org.semanticweb.owlapi.profiles.OWLProfileViolation;
38import org.semanticweb.owlapi.profiles.UseOfDataOneOfWithMultipleLiterals;
39import org.semanticweb.owlapi.profiles.UseOfIllegalAxiom;
40import org.semanticweb.owlapi.profiles.UseOfIllegalClassExpression;
41import org.semanticweb.owlapi.profiles.UseOfObjectOneOfWithMultipleIndividuals;
42import org.semanticweb.owlapi.util.OWLObjectPropertyManager;
43import org.semanticweb.owlapi.util.OWLOntologyWalker;
44import org.semanticweb.owlapi.util.OWLOntologyWalkerVisitor;
45import uk.ac.ox.cs.pagoda.util.Utility;
46
47public class ELHOProfile implements OWLProfile {
48
49 public OWLOntology getFragment(OWLOntology ontology) {
50 OWLOntologyManager manager = ontology.getOWLOntologyManager();
51 OWLOntology elhoOntology = null;
52 try {
53 Utility.logDebug("OntologyID: " + ontology.getOntologyID());
54 try {
55 String ontologyIRI = ontology.getOntologyID().getOntologyIRI().toString();
56 if (ontologyIRI.contains(".owl"))
57 ontologyIRI = ontologyIRI.replace(".owl", "-elho.owl");
58 else
59 ontologyIRI = ontologyIRI + "elho";
60 elhoOntology = manager.createOntology(IRI.create(ontologyIRI));
61 } catch (NullPointerException e) {
62// e.printStackTrace();
63 elhoOntology = manager.createOntology();
64 }
65
66 } catch (OWLOntologyCreationException e) {
67 e.printStackTrace();
68 }
69 for (OWLOntology onto: ontology.getImportsClosure())
70 manager.addAxioms(elhoOntology, onto.getAxioms());
71
72 // TODO to be checked ...
73 manager.removeAxioms(elhoOntology, elhoOntology.getAxioms(AxiomType.DIFFERENT_INDIVIDUALS));
74
75 OWLProfileReport report = checkOntology(elhoOntology);
76
77 for (OWLProfileViolation violation: report.getViolations()) {
78 OWLAxiom axiom = violation.getAxiom();
79 manager.removeAxiom(elhoOntology, axiom);
80 }
81 Utility.logDebug("ELHO fragment extracted ... ");
82
83 return elhoOntology;
84 }
85
86 @Override
87 public OWLProfileReport checkOntology(OWLOntology ontology) {
88 OWL2ELProfile profile = new OWL2ELProfile();
89 OWLProfileReport report = profile.checkOntology(ontology);
90 Set<OWLProfileViolation> violations = new HashSet<OWLProfileViolation>();
91 violations.addAll(report.getViolations());
92 MyOWLOntologyWalker ontologyWalker = new MyOWLOntologyWalker(ontology.getImportsClosure());
93 ELHOProfileObjectVisitor visitor = new ELHOProfileObjectVisitor(ontologyWalker, ontology.getOWLOntologyManager());
94 ontologyWalker.walkStructure(visitor);
95
96 for (Iterator<OWLProfileViolation> iter = violations.iterator(); iter.hasNext(); ) {
97 OWLProfileViolation vio = iter.next();
98 if (vio instanceof UseOfIllegalClassExpression) {
99 OWLClassExpression exp = ((UseOfIllegalClassExpression) vio).getOWLClassExpression();
100 if (exp instanceof OWLObjectMinCardinality && ((OWLObjectMinCardinality) exp).getCardinality() == 1)
101 iter.remove();
102 }
103 }
104
105 violations.addAll(visitor.getProfileViolations());
106 return new OWLProfileReport(this, violations);
107 }
108
109 @Override
110 public String getName() {
111 return "ELHO";
112 }
113
114 protected class ELHOProfileObjectVisitor extends OWLOntologyWalkerVisitor<Object> {
115
116 private final OWLOntologyManager man;
117
118 private OWLObjectPropertyManager propertyManager;
119
120 private final Set<OWLProfileViolation> profileViolations = new HashSet<OWLProfileViolation>();
121
122 public ELHOProfileObjectVisitor(OWLOntologyWalker walker, OWLOntologyManager man) {
123 super(walker);
124 this.man = man;
125 }
126
127 public Set<OWLProfileViolation> getProfileViolations() {
128 return new HashSet<OWLProfileViolation>(profileViolations);
129 }
130
131 @SuppressWarnings("unused")
132 private OWLObjectPropertyManager getPropertyManager() {
133 if (propertyManager == null) {
134 propertyManager = new OWLObjectPropertyManager(man, getCurrentOntology());
135 }
136 return propertyManager;
137 }
138
139
140
141 @Override
142 public Object visit(OWLDataProperty p) {
143 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
144 return null;
145 }
146
147
148 @Override
149 public Object visit(OWLObjectOneOf desc) {
150 if (desc.getIndividuals().size() != 1) {
151 profileViolations.add(new UseOfObjectOneOfWithMultipleIndividuals(getCurrentOntology(), getCurrentAxiom(), desc));
152 }
153 return null;
154 }
155
156 @Override
157 public Object visit(OWLDataHasValue desc) {
158 profileViolations.add(new UseOfIllegalClassExpression(getCurrentOntology(), getCurrentAxiom(), desc));
159 return null;
160 }
161
162 @Override
163 public Object visit(OWLDataSomeValuesFrom desc) {
164 profileViolations.add(new UseOfIllegalClassExpression(getCurrentOntology(), getCurrentAxiom(), desc));
165 return null;
166 }
167
168 @Override
169 public Object visit(OWLDataIntersectionOf desc) {
170 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
171 return null;
172 }
173
174 @Override
175 public Object visit(OWLSubDataPropertyOfAxiom desc) {
176 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
177 return null;
178 }
179
180 @Override
181 public Object visit(OWLEquivalentDataPropertiesAxiom desc) {
182 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
183 return null;
184 }
185
186 @Override
187 public Object visit(OWLTransitiveObjectPropertyAxiom desc) {
188 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
189 return null;
190 }
191
192 @Override
193 public Object visit(OWLReflexiveObjectPropertyAxiom desc) {
194 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
195 return null;
196 }
197
198 @Override
199 public Object visit(OWLDataPropertyDomainAxiom desc) {
200 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
201 return null;
202 }
203
204 @Override
205 public Object visit(OWLDataPropertyRangeAxiom desc) {
206 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
207 return null;
208 }
209
210
211
212 @Override
213 public Object visit(OWLDataPropertyAssertionAxiom desc) {
214 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
215 return null;
216 }
217
218 @Override
219 public Object visit(OWLNegativeDataPropertyAssertionAxiom desc) {
220 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
221 return null;
222 }
223
224 @Override
225 public Object visit(OWLNegativeObjectPropertyAssertionAxiom desc) {
226 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
227 return null;
228 }
229
230 @Override
231 public Object visit(OWLFunctionalDataPropertyAxiom desc) {
232 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
233 return null;
234 }
235
236 @Override
237 public Object visit(OWLHasKeyAxiom desc) {
238 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
239 return null;
240 }
241
242
243
244
245 @Override
246 public Object visit(OWLObjectHasSelf node) {
247 profileViolations.add(new UseOfIllegalClassExpression(getCurrentOntology(), getCurrentAxiom(), node));
248 return null;
249 }
250
251
252 @Override
253 public Object visit(OWLDataOneOf node) {
254 profileViolations.add(new UseOfDataOneOfWithMultipleLiterals(getCurrentOntology(), getCurrentAxiom(), node));
255 return null;
256 }
257
258
259
260 @Override
261 public Object visit(OWLSubPropertyChainOfAxiom axiom) {
262 profileViolations.add(new UseOfIllegalAxiom(getCurrentOntology(), getCurrentAxiom()));
263
264 return null;
265 }
266
267 @Override
268 public Object visit(OWLOntology ontology) {
269 propertyManager = null;
270 return null;
271 }
272 }
273
274 @Override
275 public IRI getIRI() {
276 return null;
277 }
278
279
280}
281
diff --git a/src/org/semanticweb/karma2/profile/MyOWLOntologyWalker.java b/src/org/semanticweb/karma2/profile/MyOWLOntologyWalker.java
deleted file mode 100644
index 508632f..0000000
--- a/src/org/semanticweb/karma2/profile/MyOWLOntologyWalker.java
+++ /dev/null
@@ -1,913 +0,0 @@
1package org.semanticweb.karma2.profile;
2
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.HashSet;
6import java.util.Set;
7
8import org.semanticweb.owlapi.model.IRI;
9import org.semanticweb.owlapi.model.OWLAnnotation;
10import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom;
11import org.semanticweb.owlapi.model.OWLAnnotationProperty;
12import org.semanticweb.owlapi.model.OWLAnnotationPropertyDomainAxiom;
13import org.semanticweb.owlapi.model.OWLAnnotationPropertyRangeAxiom;
14import org.semanticweb.owlapi.model.OWLAnonymousIndividual;
15import org.semanticweb.owlapi.model.OWLAsymmetricObjectPropertyAxiom;
16import org.semanticweb.owlapi.model.OWLAxiom;
17import org.semanticweb.owlapi.model.OWLClass;
18import org.semanticweb.owlapi.model.OWLClassAssertionAxiom;
19import org.semanticweb.owlapi.model.OWLClassExpression;
20import org.semanticweb.owlapi.model.OWLDataAllValuesFrom;
21import org.semanticweb.owlapi.model.OWLDataComplementOf;
22import org.semanticweb.owlapi.model.OWLDataExactCardinality;
23import org.semanticweb.owlapi.model.OWLDataHasValue;
24import org.semanticweb.owlapi.model.OWLDataIntersectionOf;
25import org.semanticweb.owlapi.model.OWLDataMaxCardinality;
26import org.semanticweb.owlapi.model.OWLDataMinCardinality;
27import org.semanticweb.owlapi.model.OWLDataOneOf;
28import org.semanticweb.owlapi.model.OWLDataProperty;
29import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
30import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom;
31import org.semanticweb.owlapi.model.OWLDataPropertyExpression;
32import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom;
33import org.semanticweb.owlapi.model.OWLDataRange;
34import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom;
35import org.semanticweb.owlapi.model.OWLDataUnionOf;
36import org.semanticweb.owlapi.model.OWLDatatype;
37import org.semanticweb.owlapi.model.OWLDatatypeDefinitionAxiom;
38import org.semanticweb.owlapi.model.OWLDatatypeRestriction;
39import org.semanticweb.owlapi.model.OWLDeclarationAxiom;
40import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom;
41import org.semanticweb.owlapi.model.OWLDisjointClassesAxiom;
42import org.semanticweb.owlapi.model.OWLDisjointDataPropertiesAxiom;
43import org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom;
44import org.semanticweb.owlapi.model.OWLDisjointUnionAxiom;
45import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom;
46import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom;
47import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom;
48import org.semanticweb.owlapi.model.OWLFacetRestriction;
49import org.semanticweb.owlapi.model.OWLFunctionalDataPropertyAxiom;
50import org.semanticweb.owlapi.model.OWLFunctionalObjectPropertyAxiom;
51import org.semanticweb.owlapi.model.OWLHasKeyAxiom;
52import org.semanticweb.owlapi.model.OWLIndividual;
53import org.semanticweb.owlapi.model.OWLInverseFunctionalObjectPropertyAxiom;
54import org.semanticweb.owlapi.model.OWLInverseObjectPropertiesAxiom;
55import org.semanticweb.owlapi.model.OWLIrreflexiveObjectPropertyAxiom;
56import org.semanticweb.owlapi.model.OWLLiteral;
57import org.semanticweb.owlapi.model.OWLNamedIndividual;
58import org.semanticweb.owlapi.model.OWLNegativeDataPropertyAssertionAxiom;
59import org.semanticweb.owlapi.model.OWLNegativeObjectPropertyAssertionAxiom;
60import org.semanticweb.owlapi.model.OWLObject;
61import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom;
62import org.semanticweb.owlapi.model.OWLObjectComplementOf;
63import org.semanticweb.owlapi.model.OWLObjectExactCardinality;
64import org.semanticweb.owlapi.model.OWLObjectHasSelf;
65import org.semanticweb.owlapi.model.OWLObjectHasValue;
66import org.semanticweb.owlapi.model.OWLObjectIntersectionOf;
67import org.semanticweb.owlapi.model.OWLObjectInverseOf;
68import org.semanticweb.owlapi.model.OWLObjectMaxCardinality;
69import org.semanticweb.owlapi.model.OWLObjectMinCardinality;
70import org.semanticweb.owlapi.model.OWLObjectOneOf;
71import org.semanticweb.owlapi.model.OWLObjectProperty;
72import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
73import org.semanticweb.owlapi.model.OWLObjectPropertyDomainAxiom;
74import org.semanticweb.owlapi.model.OWLObjectPropertyExpression;
75import org.semanticweb.owlapi.model.OWLObjectPropertyRangeAxiom;
76import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom;
77import org.semanticweb.owlapi.model.OWLObjectUnionOf;
78import org.semanticweb.owlapi.model.OWLObjectVisitor;
79import org.semanticweb.owlapi.model.OWLObjectVisitorEx;
80import org.semanticweb.owlapi.model.OWLOntology;
81import org.semanticweb.owlapi.model.OWLReflexiveObjectPropertyAxiom;
82import org.semanticweb.owlapi.model.OWLSameIndividualAxiom;
83import org.semanticweb.owlapi.model.OWLSubAnnotationPropertyOfAxiom;
84import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
85import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom;
86import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom;
87import org.semanticweb.owlapi.model.OWLSubPropertyChainOfAxiom;
88import org.semanticweb.owlapi.model.OWLSymmetricObjectPropertyAxiom;
89import org.semanticweb.owlapi.model.OWLTransitiveObjectPropertyAxiom;
90import org.semanticweb.owlapi.model.SWRLAtom;
91import org.semanticweb.owlapi.model.SWRLBuiltInAtom;
92import org.semanticweb.owlapi.model.SWRLClassAtom;
93import org.semanticweb.owlapi.model.SWRLDArgument;
94import org.semanticweb.owlapi.model.SWRLDataPropertyAtom;
95import org.semanticweb.owlapi.model.SWRLDataRangeAtom;
96import org.semanticweb.owlapi.model.SWRLDifferentIndividualsAtom;
97import org.semanticweb.owlapi.model.SWRLIndividualArgument;
98import org.semanticweb.owlapi.model.SWRLLiteralArgument;
99import org.semanticweb.owlapi.model.SWRLObjectPropertyAtom;
100import org.semanticweb.owlapi.model.SWRLRule;
101import org.semanticweb.owlapi.model.SWRLSameIndividualAtom;
102import org.semanticweb.owlapi.model.SWRLVariable;
103import org.semanticweb.owlapi.util.OWLOntologyWalker;
104
105
106public class MyOWLOntologyWalker extends OWLOntologyWalker {
107
108 private final Collection<OWLOntology> ontologies;
109
110 /**
111 * @param objects the set of objects to visit
112 */
113 public MyOWLOntologyWalker(Set<OWLOntology> objects) {
114 this(objects, true);
115 }
116 /**
117 * @param visitDuplicates true if duplicates should be visited
118 * @param objects the set of objects to visit
119 */
120 public MyOWLOntologyWalker(Set<OWLOntology> objects, boolean visitDuplicates) {
121 super(objects);
122 this.ontologies = new ArrayList<OWLOntology>(objects);
123 }
124
125 /**
126 * @param v visitor to use over the objects
127 */
128 public void walkStructure(OWLObjectVisitorEx<?> v) {
129 this.visitor = v;
130 StructureWalker walker = new StructureWalker();
131 for (OWLOntology o : ontologies) {
132 o.accept(walker);
133 }
134 }
135
136 private class StructureWalker implements OWLObjectVisitor {
137
138 private final Set<OWLObject> visited = new HashSet<OWLObject>();
139
140 public StructureWalker() {}
141
142 private void process(OWLObject object) {
143 if (!visitDuplicates) {
144 if (!visited.contains(object)) {
145 visited.add(object);
146 object.accept(visitor);
147 }
148 }
149 else {
150 object.accept(visitor);
151 }
152 }
153
154 @Override
155 public void visit(IRI iri) {
156 process(iri);
157 }
158
159 @Override
160 public void visit(OWLOntology ontologyToVisit) {
161 MyOWLOntologyWalker.this.ontology = ontologyToVisit;
162 MyOWLOntologyWalker.this.ax = null;
163 process(ontologyToVisit);
164 for (OWLAnnotation anno : ontologyToVisit.getAnnotations()) {
165 anno.accept(this);
166 }
167 for (OWLAxiom a : ontologyToVisit.getAxioms()) {
168 a.accept(this);
169 }
170 }
171
172
173 @Override
174 public void visit(OWLAsymmetricObjectPropertyAxiom axiom) {
175 MyOWLOntologyWalker.this.ax = axiom;
176 process(axiom);
177 axiom.getProperty().accept(this);
178 }
179
180
181 @Override
182 public void visit(OWLClassAssertionAxiom axiom) {
183 MyOWLOntologyWalker.this.ax = axiom;
184 process(axiom);
185 axiom.getIndividual().accept(this);
186 axiom.getClassExpression().accept(this);
187 }
188
189
190 @Override
191 public void visit(OWLDataPropertyAssertionAxiom axiom) {
192 MyOWLOntologyWalker.this.ax = axiom;
193 process(axiom);
194 axiom.getSubject().accept(this);
195 axiom.getProperty().accept(this);
196 axiom.getObject().accept(this);
197 }
198
199
200 @Override
201 public void visit(OWLDataPropertyDomainAxiom axiom) {
202 MyOWLOntologyWalker.this.ax = axiom;
203 process(axiom);
204 axiom.getDomain().accept(this);
205 axiom.getProperty().accept(this);
206 }
207
208
209 @Override
210 public void visit(OWLDataPropertyRangeAxiom axiom) {
211 MyOWLOntologyWalker.this.ax = axiom;
212 process(axiom);
213 axiom.getRange().accept(this);
214 axiom.getProperty().accept(this);
215 }
216
217
218 @Override
219 public void visit(OWLSubDataPropertyOfAxiom axiom) {
220 MyOWLOntologyWalker.this.ax = axiom;
221 process(axiom);
222 axiom.getSubProperty().accept(this);
223 axiom.getSuperProperty().accept(this);
224 }
225
226
227 @Override
228 public void visit(OWLDeclarationAxiom axiom) {
229 MyOWLOntologyWalker.this.ax = axiom;
230 process(axiom);
231 axiom.getEntity().accept(this);
232 }
233
234
235 @Override
236 public void visit(OWLDifferentIndividualsAxiom axiom) {
237 MyOWLOntologyWalker.this.ax = axiom;
238 process(axiom);
239 for (OWLIndividual ind : axiom.getIndividuals()) {
240 ind.accept(this);
241 }
242 }
243
244
245 @Override
246 public void visit(OWLDisjointClassesAxiom axiom) {
247 MyOWLOntologyWalker.this.ax = axiom;
248 process(axiom);
249 for (OWLClassExpression desc : axiom.getClassExpressions()) {
250 desc.accept(this);
251 }
252 }
253
254
255 @Override
256 public void visit(OWLDisjointDataPropertiesAxiom axiom) {
257 MyOWLOntologyWalker.this.ax = axiom;
258 process(axiom);
259 for (OWLDataPropertyExpression prop : axiom.getProperties()) {
260 prop.accept(this);
261 }
262 }
263
264
265 @Override
266 public void visit(OWLDisjointObjectPropertiesAxiom axiom) {
267 MyOWLOntologyWalker.this.ax = axiom;
268 process(axiom);
269 for (OWLObjectPropertyExpression prop : axiom.getProperties()) {
270 prop.accept(this);
271 }
272 }
273
274
275 @Override
276 public void visit(OWLDisjointUnionAxiom axiom) {
277 MyOWLOntologyWalker.this.ax = axiom;
278 process(axiom);
279 axiom.getOWLClass().accept(this);
280 for (OWLClassExpression desc : axiom.getClassExpressions()) {
281 desc.accept(this);
282 }
283 }
284
285
286 @Override
287 public void visit(OWLAnnotationAssertionAxiom axiom) {
288 MyOWLOntologyWalker.this.ax = axiom;
289 process(axiom);
290 axiom.getSubject().accept(this);
291 axiom.getAnnotation().accept(this);
292 }
293
294 @Override
295 public void visit(OWLAnnotationPropertyDomainAxiom axiom) {
296 MyOWLOntologyWalker.this.ax = axiom;
297 process(axiom);
298 axiom.getProperty().accept(this);
299 axiom.getDomain().accept(this);
300 }
301
302 @Override
303 public void visit(OWLAnnotationPropertyRangeAxiom axiom) {
304 MyOWLOntologyWalker.this.ax = axiom;
305 process(axiom);
306 axiom.getProperty().accept(this);
307 axiom.getRange().accept(this);
308 }
309
310 @Override
311 public void visit(OWLSubAnnotationPropertyOfAxiom axiom) {
312 MyOWLOntologyWalker.this.ax = axiom;
313 process(axiom);
314 axiom.getSubProperty().accept(this);
315 axiom.getSuperProperty().accept(this);
316 }
317
318 @Override
319 public void visit(OWLAnnotation node) {
320 process(node);
321 annotation = node;
322 node.getProperty().accept(this);
323 node.getValue().accept(this);
324 }
325
326 @Override
327 public void visit(OWLEquivalentClassesAxiom axiom) {
328 MyOWLOntologyWalker.this.ax = axiom;
329 process(axiom);
330 for (OWLClassExpression desc : axiom.getClassExpressions()) {
331 desc.accept(this);
332 }
333 }
334
335
336 @Override
337 public void visit(OWLEquivalentDataPropertiesAxiom axiom) {
338 MyOWLOntologyWalker.this.ax = axiom;
339 process(axiom);
340 for (OWLDataPropertyExpression prop : axiom.getProperties()) {
341 prop.accept(this);
342 }
343 }
344
345
346 @Override
347 public void visit(OWLEquivalentObjectPropertiesAxiom axiom) {
348 MyOWLOntologyWalker.this.ax = axiom;
349 process(axiom);
350 for (OWLObjectPropertyExpression prop : axiom.getProperties()) {
351 prop.accept(this);
352 }
353 }
354
355
356 @Override
357 public void visit(OWLFunctionalDataPropertyAxiom axiom) {
358 MyOWLOntologyWalker.this.ax = axiom;
359 process(axiom);
360 axiom.getProperty().accept(this);
361 }
362
363
364 @Override
365 public void visit(OWLFunctionalObjectPropertyAxiom axiom) {
366 MyOWLOntologyWalker.this.ax = axiom;
367 process(axiom);
368 axiom.getProperty().accept(this);
369 }
370
371 @Override
372 public void visit(OWLInverseFunctionalObjectPropertyAxiom axiom) {
373 MyOWLOntologyWalker.this.ax = axiom;
374 process(axiom);
375 axiom.getProperty().accept(this);
376 }
377
378
379 @Override
380 public void visit(OWLInverseObjectPropertiesAxiom axiom) {
381 MyOWLOntologyWalker.this.ax = axiom;
382 process(axiom);
383 axiom.getFirstProperty().accept(this);
384 axiom.getSecondProperty().accept(this);
385 }
386
387
388 @Override
389 public void visit(OWLIrreflexiveObjectPropertyAxiom axiom) {
390 MyOWLOntologyWalker.this.ax = axiom;
391 process(axiom);
392 axiom.getProperty().accept(this);
393 }
394
395
396 @Override
397 public void visit(OWLNegativeDataPropertyAssertionAxiom axiom) {
398 MyOWLOntologyWalker.this.ax = axiom;
399 process(axiom);
400 axiom.getSubject().accept(this);
401 axiom.getProperty().accept(this);
402 axiom.getObject().accept(this);
403 }
404
405
406 @Override
407 public void visit(OWLNegativeObjectPropertyAssertionAxiom axiom) {
408 MyOWLOntologyWalker.this.ax = axiom;
409 process(axiom);
410 axiom.getSubject().accept(this);
411 axiom.getProperty().accept(this);
412 axiom.getObject().accept(this);
413 }
414
415
416 @Override
417 public void visit(OWLObjectPropertyAssertionAxiom axiom) {
418 MyOWLOntologyWalker.this.ax = axiom;
419 process(axiom);
420 axiom.getSubject().accept(this);
421 axiom.getProperty().accept(this);
422 axiom.getObject().accept(this);
423 }
424
425
426 @Override
427 public void visit(OWLSubPropertyChainOfAxiom axiom) {
428 MyOWLOntologyWalker.this.ax = axiom;
429 process(axiom);
430 for (OWLObjectPropertyExpression prop : axiom.getPropertyChain()) {
431 prop.accept(this);
432 }
433 axiom.getSuperProperty().accept(this);
434 }
435
436
437 @Override
438 public void visit(OWLObjectPropertyDomainAxiom axiom) {
439 MyOWLOntologyWalker.this.ax = axiom;
440 process(axiom);
441 axiom.getDomain().accept(this);
442 axiom.getProperty().accept(this);
443 }
444
445
446 @Override
447 public void visit(OWLObjectPropertyRangeAxiom axiom) {
448 MyOWLOntologyWalker.this.ax = axiom;
449 process(axiom);
450 axiom.getProperty().accept(this);
451 axiom.getRange().accept(this);
452 }
453
454
455 @Override
456 public void visit(OWLSubObjectPropertyOfAxiom axiom) {
457 MyOWLOntologyWalker.this.ax = axiom;
458 process(axiom);
459 axiom.getSubProperty().accept(this);
460 axiom.getSuperProperty().accept(this);
461 }
462
463
464 @Override
465 public void visit(OWLReflexiveObjectPropertyAxiom axiom) {
466 MyOWLOntologyWalker.this.ax = axiom;
467 process(axiom);
468 axiom.getProperty().accept(this);
469 }
470
471
472 @Override
473 public void visit(OWLSameIndividualAxiom axiom) {
474 MyOWLOntologyWalker.this.ax = axiom;
475 process(axiom);
476 for (OWLIndividual ind : axiom.getIndividuals()) {
477 ind.accept(this);
478 }
479 }
480
481
482 @Override
483 public void visit(OWLSubClassOfAxiom axiom) {
484 MyOWLOntologyWalker.this.ax = axiom;
485 process(axiom);
486 // -ve polarity
487 axiom.getSubClass().accept(this);
488 // +ve polarity
489 axiom.getSuperClass().accept(this);
490 }
491
492
493 @Override
494 public void visit(OWLSymmetricObjectPropertyAxiom axiom) {
495 MyOWLOntologyWalker.this.ax = axiom;
496 process(axiom);
497 axiom.getProperty().accept(this);
498 }
499
500
501 @Override
502 public void visit(OWLTransitiveObjectPropertyAxiom axiom) {
503 MyOWLOntologyWalker.this.ax = axiom;
504 process(axiom);
505 axiom.getProperty().accept(this);
506 }
507
508
509 @Override
510 public void visit(SWRLRule rule) {
511 MyOWLOntologyWalker.this.ax = rule;
512 process(rule);
513 for (SWRLAtom at : rule.getBody()) {
514 at.accept(this);
515 }
516 for (SWRLAtom at : rule.getHead()) {
517 at.accept(this);
518 }
519 }
520
521 @Override
522 public void visit(OWLHasKeyAxiom axiom) {
523 MyOWLOntologyWalker.this.ax = axiom;
524 process(axiom);
525 axiom.getClassExpression().accept(this);
526 for (OWLObjectPropertyExpression prop : axiom.getObjectPropertyExpressions()) {
527 prop.accept(this);
528 }
529 for (OWLDataPropertyExpression prop : axiom.getDataPropertyExpressions()) {
530 prop.accept(this);
531 }
532 }
533
534 @Override
535 public void visit(OWLClass desc) {
536 pushClassExpression(desc);
537 process(desc);
538 desc.getIRI().accept(this);
539 popClassExpression();
540 }
541
542
543 @Override
544 public void visit(OWLDataAllValuesFrom desc) {
545 pushClassExpression(desc);
546 process(desc);
547 desc.getProperty().accept(this);
548 desc.getFiller().accept(this);
549 popClassExpression();
550 }
551
552
553 @Override
554 public void visit(OWLDataExactCardinality desc) {
555 pushClassExpression(desc);
556 process(desc);
557 desc.getProperty().accept(this);
558 desc.getFiller().accept(this);
559 popClassExpression();
560 }
561
562
563 @Override
564 public void visit(OWLDataMaxCardinality desc) {
565 pushClassExpression(desc);
566 process(desc);
567 desc.getProperty().accept(this);
568 desc.getFiller().accept(this);
569 popClassExpression();
570 }
571
572
573 @Override
574 public void visit(OWLDataMinCardinality desc) {
575 pushClassExpression(desc);
576 process(desc);
577 desc.getProperty().accept(this);
578 desc.getFiller().accept(this);
579 popClassExpression();
580 }
581
582
583 @Override
584 public void visit(OWLDataSomeValuesFrom desc) {
585 pushClassExpression(desc);
586 process(desc);
587 desc.getProperty().accept(this);
588 desc.getFiller().accept(this);
589 popClassExpression();
590 }
591
592
593 @Override
594 public void visit(OWLDataHasValue desc) {
595 pushClassExpression(desc);
596 process(desc);
597 desc.getProperty().accept(this);
598 desc.getValue().accept(this);
599 popClassExpression();
600 }
601
602
603 @Override
604 public void visit(OWLObjectAllValuesFrom desc) {
605 pushClassExpression(desc);
606 process(desc);
607 desc.getProperty().accept(this);
608 desc.getFiller().accept(this);
609 popClassExpression();
610 }
611
612
613 @Override
614 public void visit(OWLObjectComplementOf desc) {
615 pushClassExpression(desc);
616 process(desc);
617 desc.getOperand().accept(this);
618 popClassExpression();
619 }
620
621
622 @Override
623 public void visit(OWLObjectExactCardinality desc) {
624 pushClassExpression(desc);
625 process(desc);
626 desc.getProperty().accept(this);
627 desc.getFiller().accept(this);
628 popClassExpression();
629 }
630
631
632 @Override
633 public void visit(OWLObjectIntersectionOf desc) {
634 pushClassExpression(desc);
635 process(desc);
636
637 for (OWLClassExpression op : desc.getOperands()) {
638 op.accept(this);
639 }
640 popClassExpression();
641 }
642
643
644 @Override
645 public void visit(OWLObjectMaxCardinality desc) {
646 pushClassExpression(desc);
647 process(desc);
648 desc.getProperty().accept(this);
649 desc.getFiller().accept(this);
650 popClassExpression();
651 }
652
653
654 @Override
655 public void visit(OWLObjectMinCardinality desc) {
656 pushClassExpression(desc);
657 process(desc);
658 desc.getProperty().accept(this);
659 desc.getFiller().accept(this);
660 popClassExpression();
661 }
662
663
664 @Override
665 public void visit(OWLObjectOneOf desc) {
666 pushClassExpression(desc);
667 process(desc);
668 for (OWLIndividual ind : desc.getIndividuals()) {
669 ind.accept(this);
670 }
671 popClassExpression();
672 }
673
674
675 @Override
676 public void visit(OWLObjectHasSelf desc) {
677 pushClassExpression(desc);
678 process(desc);
679 desc.getProperty().accept(this);
680 popClassExpression();
681 }
682
683
684 @Override
685 public void visit(OWLObjectSomeValuesFrom desc) {
686 pushClassExpression(desc);
687 process(desc);
688 desc.getProperty().accept(this);
689 desc.getFiller().accept(this);
690 popClassExpression();
691 }
692
693
694 @Override
695 public void visit(OWLObjectUnionOf desc) {
696 pushClassExpression(desc);
697 process(desc);
698 for (OWLClassExpression op : desc.getOperands()) {
699 op.accept(this);
700 }
701 popClassExpression();
702 }
703
704
705 @Override
706 public void visit(OWLObjectHasValue desc) {
707 pushClassExpression(desc);
708 process(desc);
709 desc.getProperty().accept(this);
710 desc.getValue().accept(this);
711 popClassExpression();
712 }
713
714
715 @Override
716 public void visit(OWLDataComplementOf node) {
717 pushDataRange(node);
718 process(node);
719 node.getDataRange().accept(this);
720 popDataRange();
721 }
722
723
724 @Override
725 public void visit(OWLDataOneOf node) {
726 pushDataRange(node);
727 process(node);
728 for (OWLLiteral con : node.getValues()) {
729 con.accept(this);
730 }
731 popDataRange();
732 }
733
734 @Override
735 public void visit(OWLDataIntersectionOf node) {
736 pushDataRange(node);
737 process(node);
738 for (OWLDataRange rng : node.getOperands()) {
739 rng.accept(this);
740 }
741 popDataRange();
742 }
743
744 @Override
745 public void visit(OWLDataUnionOf node) {
746 pushDataRange(node);
747 process(node);
748 for (OWLDataRange rng : node.getOperands()) {
749 rng.accept(this);
750 }
751 popDataRange();
752 }
753
754 @Override
755 public void visit(OWLFacetRestriction node) {
756 process(node);
757 node.getFacetValue().accept(this);
758 }
759
760
761 @Override
762 public void visit(OWLDatatypeRestriction node) {
763 pushDataRange(node);
764 process(node);
765 node.getDatatype().accept(this);
766 for (OWLFacetRestriction fr : node.getFacetRestrictions()) {
767 fr.accept(this);
768 }
769 popDataRange();
770 }
771
772
773 @Override
774 public void visit(OWLDatatype node) {
775 pushDataRange(node);
776 process(node);
777 popDataRange();
778 }
779
780 @Override
781 public void visit(OWLLiteral node) {
782 process(node);
783 node.getDatatype().accept(this);
784 popDataRange();
785 }
786
787 @Override
788 public void visit(OWLAnnotationProperty property) {
789 process(property);
790 property.getIRI().accept(this);
791 }
792
793 @Override
794 public void visit(OWLDataProperty property) {
795 process(property);
796 property.getIRI().accept(this);
797 }
798
799
800 @Override
801 public void visit(OWLObjectProperty property) {
802 process(property);
803 property.getIRI().accept(this);
804 }
805
806
807 @Override
808 public void visit(OWLObjectInverseOf property) {
809 process(property);
810 property.getInverse().accept(this);
811 }
812
813
814 @Override
815 public void visit(OWLNamedIndividual individual) {
816 process(individual);
817 individual.getIRI().accept(this);
818 }
819
820 @Override
821 public void visit(OWLAnonymousIndividual individual) {
822 process(individual);
823 }
824
825 @Override
826 public void visit(SWRLLiteralArgument node) {
827 process(node);
828 node.getLiteral().accept(this);
829 }
830
831
832 @Override
833 public void visit(SWRLVariable node) {
834 process(node);
835 }
836
837
838 @Override
839 public void visit(SWRLIndividualArgument node) {
840 process(node);
841 node.getIndividual().accept(this);
842 }
843
844
845 @Override
846 public void visit(SWRLBuiltInAtom node) {
847 process(node);
848 for (SWRLDArgument at : node.getArguments()) {
849 at.accept(this);
850 }
851 }
852
853
854 @Override
855 public void visit(SWRLClassAtom node) {
856 process(node);
857 node.getArgument().accept(this);
858 node.getPredicate().accept(this);
859 }
860
861
862 @Override
863 public void visit(SWRLDataRangeAtom node) {
864 process(node);
865 node.getArgument().accept(this);
866 node.getPredicate().accept(this);
867 }
868
869
870 @Override
871 public void visit(SWRLDataPropertyAtom node) {
872 process(node);
873 node.getPredicate().accept(this);
874 node.getFirstArgument().accept(this);
875 node.getSecondArgument().accept(this);
876 }
877
878
879 @Override
880 public void visit(SWRLDifferentIndividualsAtom node) {
881 process(node);
882 node.getFirstArgument().accept(this);
883 node.getSecondArgument().accept(this);
884 }
885
886
887 @Override
888 public void visit(SWRLObjectPropertyAtom node) {
889 process(node);
890 node.getPredicate().accept(this);
891 node.getFirstArgument().accept(this);
892 node.getSecondArgument().accept(this);
893 }
894
895
896 @Override
897 public void visit(SWRLSameIndividualAtom node) {
898 process(node);
899 node.getFirstArgument().accept(this);
900 node.getSecondArgument().accept(this);
901 }
902
903
904 @Override
905 public void visit(OWLDatatypeDefinitionAxiom axiom) {
906 MyOWLOntologyWalker.this.ax = axiom;
907 process(axiom);
908 axiom.getDatatype().accept(this);
909 axiom.getDataRange().accept(this);
910 }
911 }
912}
913