aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/reasoner
diff options
context:
space:
mode:
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner')
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java19
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/full/Checker.java2
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java456
3 files changed, 250 insertions, 227 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java
index 0b02e5a..51cb44d 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java
@@ -10,7 +10,6 @@ import uk.ac.ox.cs.pagoda.query.GapByStore4ID;
10import uk.ac.ox.cs.pagoda.query.GapByStore4ID2; 10import uk.ac.ox.cs.pagoda.query.GapByStore4ID2;
11import uk.ac.ox.cs.pagoda.query.QueryRecord; 11import uk.ac.ox.cs.pagoda.query.QueryRecord;
12import uk.ac.ox.cs.pagoda.query.QueryRecord.Step; 12import uk.ac.ox.cs.pagoda.query.QueryRecord.Step;
13import uk.ac.ox.cs.pagoda.reasoner.full.Checker;
14import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine; 13import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine;
15import uk.ac.ox.cs.pagoda.reasoner.light.KarmaQueryEngine; 14import uk.ac.ox.cs.pagoda.reasoner.light.KarmaQueryEngine;
16import uk.ac.ox.cs.pagoda.rules.DatalogProgram; 15import uk.ac.ox.cs.pagoda.rules.DatalogProgram;
@@ -189,25 +188,21 @@ class MyQueryReasoner extends QueryReasoner {
189 return; 188 return;
190 189
191 OWLOntology relevantOntologySubset = extractRelevantOntologySubset(queryRecord); 190 OWLOntology relevantOntologySubset = extractRelevantOntologySubset(queryRecord);
192 queryRecord.saveRelevantOntology("/home/alessandro/Desktop/test-relevant-ontology.owl"); 191// queryRecord.saveRelevantOntology("/home/alessandro/Desktop/test-relevant-ontology.owl");
193 192
194// int gapAnswersCount = queryRecord.getGapAnswersCount();
195 if(properties.getUseSkolemUpperBound() && 193 if(properties.getUseSkolemUpperBound() &&
196 querySkolemisedRelevantSubset(relevantOntologySubset, queryRecord)) 194 querySkolemisedRelevantSubset(relevantOntologySubset, queryRecord)) {
197 return; 195 return;
198 196 }
199// // TODO extract from the previous relevant ontology
200// // TODO implement details or remove it
201// if(queryRecord.getGapAnswersCount() < gapAnswersCount)
202// extractRelevantOntologySubset(queryRecord); // takes the relevant ontology from the record
203 197
204 Timer t = new Timer(); 198 Timer t = new Timer();
205 Checker summarisedChecker = new HermitSummaryFilter(queryRecord, properties.getToCallHermiT()); 199 HermitSummaryFilter summarisedChecker = new HermitSummaryFilter(queryRecord, properties.getToCallHermiT());
206 summarisedChecker.check(queryRecord.getGapAnswers()); 200 summarisedChecker.check(queryRecord.getGapAnswers());
207 summarisedChecker.dispose(); 201// summarisedChecker.checkByFullReasoner(queryRecord.getGapAnswers());
208 Utility.logDebug("Total time for full reasoner: " + t.duration()); 202 Utility.logDebug("Total time for full reasoner: " + t.duration());
203
209 queryRecord.markAsProcessed(); 204 queryRecord.markAsProcessed();
210 Utility.logDebug("Difficulty of this query: " + queryRecord.getDifficulty()); 205 summarisedChecker.dispose();
211 } 206 }
212 207
213 @Override 208 @Override
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/full/Checker.java b/src/uk/ac/ox/cs/pagoda/reasoner/full/Checker.java
index fd620a5..07adc6d 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/full/Checker.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/full/Checker.java
@@ -12,4 +12,6 @@ public abstract class Checker extends Disposable {
12 12
13 public abstract boolean isConsistent(); 13 public abstract boolean isConsistent();
14 14
15 public abstract int getNoOfCalls();
16
15} 17}
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
index 9cfc773..cfae88b 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
@@ -24,229 +24,255 @@ import java.util.Map;
24import java.util.Set; 24import java.util.Set;
25 25
26public class HermitChecker extends Checker { 26public class HermitChecker extends Checker {
27 27
28 protected OWLDataFactory factory; 28 protected OWLDataFactory factory;
29 protected String[][] answerVariable; 29 protected String[][] answerVariable;
30 protected OWLOntology ontology; 30 protected OWLOntology ontology;
31 protected QueryRecord record; 31 protected QueryRecord record;
32 protected QueryGraph qGraph = null; 32 protected QueryGraph qGraph = null;
33 boolean toCheck = true; 33 boolean toCheck = true;
34 AnswerTuple topAnswerTuple = null, botAnswerTuple = null; 34 AnswerTuple topAnswerTuple = null, botAnswerTuple = null;
35 private String queryText; 35 private String queryText;
36 private DLClause queryClause; 36 private DLClause queryClause;
37 private Reasoner hermit; 37 private Reasoner hermit;
38 private int tag = 0; 38 private int tag = 0;
39 private int counter = 0; 39
40 private DependencyGraph dGraph = null; 40 public int getNoOfCalls() {
41 public HermitChecker(Checker checker) { 41 if(isDisposed()) throw new DisposedException();
42 if (checker instanceof HermitChecker) { 42 return noOfCalls;
43 HermitChecker other = (HermitChecker) checker; 43 }
44 factory = other.factory; 44
45 queryText = other.queryText; 45 private int noOfCalls = 0;
46 queryClause = other.queryClause; 46 private DependencyGraph dGraph = null;
47 answerVariable = other.answerVariable; 47
48 ontology = other.ontology; 48 public HermitChecker(Checker checker) {
49 if(checker instanceof HermitChecker) {
50 HermitChecker other = (HermitChecker) checker;
51 factory = other.factory;
52 queryText = other.queryText;
53 queryClause = other.queryClause;
54 answerVariable = other.answerVariable;
55 ontology = other.ontology;
49// record = other.record; 56// record = other.record;
50 } 57 }
51 58
52 hermit = new Reasoner(ontology); 59 hermit = new Reasoner(ontology);
53 } 60 }
54 61
55 public HermitChecker(OWLOntology ontology, QueryRecord record, boolean toCheck) { 62 public HermitChecker(OWLOntology ontology, QueryRecord record, boolean toCheck) {
56 this.ontology = ontology; 63 this.ontology = ontology;
57 queryText = record.getQueryText(); 64 queryText = record.getQueryText();
58 answerVariable = record.getVariables(); 65 answerVariable = record.getVariables();
59 queryClause = record.getClause(); 66 queryClause = record.getClause();
60// this.record = record; 67// this.record = record;
61 this.toCheck = toCheck; 68 this.toCheck = toCheck;
62 } 69 }
63 70
64 public HermitChecker(OWLOntology ontology, String queryText) { 71 public HermitChecker(OWLOntology ontology, String queryText) {
65 this.ontology = ontology; 72 this.ontology = ontology;
66 this.queryText = queryText; 73 this.queryText = queryText;
67 answerVariable = queryText == null ? null : ConjunctiveQueryHelper.getAnswerVariables(queryText); 74 answerVariable = queryText == null ? null : ConjunctiveQueryHelper.getAnswerVariables(queryText);
68 queryClause = DLClauseHelper.getQuery(queryText, null); 75 queryClause = DLClauseHelper.getQuery(queryText, null);
69// this.record = null; 76// this.record = null;
70 } 77 }
71 78
72 @Override 79 @Override
73 public int check(AnswerTuples answers) { 80 public int check(AnswerTuples answers) {
74 if(isDisposed()) throw new DisposedException(); 81 if(isDisposed()) throw new DisposedException();
75 82
76 if(hermit == null) initialiseReasoner(); 83 if(hermit == null) initialiseReasoner();
77 int answerCounter = 0, counter = 0; 84 int answerCounter = 0, counter = 0;
78 for(; answers.isValid(); answers.moveNext()) { 85 for(; answers.isValid(); answers.moveNext()) {
79 ++counter; 86 ++counter;
80 if(check(answers.getTuple())) ++answerCounter; 87 if(check(answers.getTuple())) ++answerCounter;
81 } 88 }
82 answers.dispose(); 89 answers.dispose();
83 90
84 Utility.logDebug("The number of individuals to be checked by HermiT: " + counter, 91 Utility.logDebug("The number of individuals to be checked by HermiT: " + counter,
85 "The number of correct answers: " + answerCounter); 92 "The number of correct answers: " + answerCounter);
86 return answerCounter; 93 return answerCounter;
87 } 94 }
88 95
89 @Override 96 @Override
90 public boolean check(AnswerTuple answerTuple) { 97 public boolean check(AnswerTuple answerTuple) {
91 if(isDisposed()) throw new DisposedException(); 98 if(isDisposed()) throw new DisposedException();
92 99
93 if(!toCheck) return false; 100 if(!toCheck) return false;
94 101 ++noOfCalls;
95 if(hermit == null) initialiseReasoner(); 102
96 if(tag != 0) return tag == 1; 103 if(tag != 0) return tag == 1;
97 ++counter; 104 if(hermit == null) initialiseReasoner();
98 Timer t = new Timer(); 105
99 Map<Variable, Term> sub = answerTuple.getAssignment(answerVariable[1]); 106 Timer t = new Timer();
100 Set<OWLAxiom> toCheckAxioms = qGraph.getAssertions(sub); 107 Map<Variable, Term> sub = answerTuple.getAssignment(answerVariable[1]);
108 Set<OWLAxiom> toCheckAxioms = qGraph.getAssertions(sub);
109
110 // TODO complete
111 Set<OWLAxiom> toCheckExistentialAxioms = qGraph.getExistentialAxioms();
112
113 // TODO possibly inefficient
114 for(OWLAxiom subclassAxiom : toCheckExistentialAxioms) {
115 Utility.logDebug("Checking consistency of ontology union " + subclassAxiom);
116 ontology.getOWLOntologyManager().addAxiom(ontology, subclassAxiom);
117 if(hermit.isConsistent()) {
118 Utility.logDebug("@TIME to check one tuple: " + t.duration());
119 return false;
120 }
121 ontology.getOWLOntologyManager().removeAxiom(ontology, subclassAxiom);
122 }
123
101 124
102// for (OWLAxiom axiom: toCheckAxioms) System.out.println(axiom.toString()); 125// for (OWLAxiom axiom: toCheckAxioms) System.out.println(axiom.toString());
103 126
104// Utility.logInfo(toCheckAxioms); 127// Utility.logInfo(toCheckAxioms);
105 if(hermit.isEntailed(toCheckAxioms)) { 128
106 Utility.logDebug("@TIME to check one tuple: " + t.duration()); 129 if(hermit.isEntailed(toCheckAxioms)) {
107 return true; 130 Utility.logDebug("@TIME to check one tuple: " + t.duration());
108 } 131 return true;
109 Utility.logDebug("@TIME to check one tuple: " + t.duration()); 132 }
110 return false; 133 Utility.logDebug("@TIME to check one tuple: " + t.duration());
111 } 134 return false;
112 135 }
113 @Override 136
114 public boolean isConsistent() { 137 @Override
115 if(isDisposed()) throw new DisposedException(); 138 public boolean isConsistent() {
116 139 if(isDisposed()) throw new DisposedException();
117 if(hermit == null) initialiseReasoner(); 140
118 return hermit.isConsistent(); 141 if(hermit == null) initialiseReasoner();
119 } 142 return hermit.isConsistent();
120 143 }
121 public void dispose() { 144
122 super.dispose(); 145 public void dispose() {
123 146 super.dispose();
124 Utility.logInfo("Hermit was called " + counter + " times."); 147
125 if(hermit != null) hermit.dispose(); 148 Utility.logDebug("Disposing of an instance of Hermit after " + noOfCalls + " calls");
126 hermit = null; 149 if(hermit != null) hermit.dispose();
127 } 150 hermit = null;
128 151 }
129 public void setDependencyGraph(DependencyGraph dGraph) { 152
130 if(isDisposed()) throw new DisposedException(); 153 public void setDependencyGraph(DependencyGraph dGraph) {
131 154 if(isDisposed()) throw new DisposedException();
132 this.dGraph = dGraph; 155
133 } 156 this.dGraph = dGraph;
134 157 }
135 private void initialiseReasoner() { 158
136 qGraph = new QueryGraph(queryClause.getBodyAtoms(), answerVariable[1], ontology); 159 private void initialiseReasoner() {
137 OWLOntologyManager manager = ontology.getOWLOntologyManager(); 160 qGraph = new QueryGraph(queryClause.getBodyAtoms(), answerVariable[1], ontology);
138 factory = manager.getOWLDataFactory(); 161 OWLOntologyManager manager = ontology.getOWLOntologyManager();
139 162 factory = manager.getOWLDataFactory();
140 if(hermit != null) hermit.dispose(); 163
141 164 if(hermit != null) hermit.dispose();
142 if(dGraph != null && answerVariable[1].length == 1 && (dGraph.getExits().size() > 1 || dGraph.getEntrances() 165
143 .size() > 1)) { 166 if(dGraph != null && answerVariable[1].length == 1 && (dGraph.getExits().size() > 1 || dGraph.getEntrances()
144 Set<OWLAxiom> topAxioms = new HashSet<OWLAxiom>(); 167 .size() > 1)) {
145 Set<OWLAxiom> botAxioms = new HashSet<OWLAxiom>(); 168 Set<OWLAxiom> topAxioms = new HashSet<OWLAxiom>();
146 addTopAndBotTuple(topAxioms, botAxioms); 169 Set<OWLAxiom> botAxioms = new HashSet<OWLAxiom>();
147 manager.addAxioms(ontology, topAxioms); 170 addTopAndBotTuple(topAxioms, botAxioms);
148 manager.addAxioms(ontology, botAxioms); 171 manager.addAxioms(ontology, topAxioms);
149 hermit = new Reasoner(ontology); 172 manager.addAxioms(ontology, botAxioms);
150 boolean topValid = true; 173 hermit = new Reasoner(ontology);
151 if(!hermit.isConsistent() || topAnswerTuple != null && (topValid = check(topAnswerTuple))) { 174 boolean topValid = true;
152 hermit.dispose(); 175 if(!hermit.isConsistent() || topAnswerTuple != null && (topValid = check(topAnswerTuple))) {
153 manager.removeAxioms(ontology, topAxioms); 176 hermit.dispose();
154 hermit = new Reasoner(ontology); 177 manager.removeAxioms(ontology, topAxioms);
155 } 178 hermit = new Reasoner(ontology);
156 else { 179 }
157 if(!topValid) tag = -1; 180 else {
158 else if(botAnswerTuple != null && check(botAnswerTuple)) tag = 1; 181 if(!topValid) tag = -1;
159 } 182 else if(botAnswerTuple != null && check(botAnswerTuple)) tag = 1;
160 } 183 }
161 else 184 }
162 hermit = new Reasoner(ontology); 185 else
163 } 186 hermit = new Reasoner(ontology);
164 187 }
165 private void addTopAndBotTuple(Set<OWLAxiom> topAxioms, Set<OWLAxiom> botAxioms) { 188
166 String top_str = Namespace.PAGODA_ANONY + "top", bot_str = Namespace.PAGODA_ANONY + "bot"; 189 private void addTopAndBotTuple(Set<OWLAxiom> topAxioms, Set<OWLAxiom> botAxioms) {
167 topAnswerTuple = 190 String top_str = Namespace.PAGODA_ANONY + "top", bot_str = Namespace.PAGODA_ANONY + "bot";
168 new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[]{uk.ac.ox.cs.JRDFox.model.Individual.create(top_str)}); 191 topAnswerTuple =
169 botAnswerTuple = 192 new AnswerTuple(
170 new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[]{uk.ac.ox.cs.JRDFox.model.Individual.create(bot_str)}); 193 new uk.ac.ox.cs.JRDFox.model.Individual[]{uk.ac.ox.cs.JRDFox.model.Individual.create(top_str)});
171 OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)), bot_ind = 194 botAnswerTuple =
172 factory.getOWLNamedIndividual(IRI.create(bot_str)); 195 new AnswerTuple(
173 Map<OWLAxiom, Integer> counter = new HashMap<OWLAxiom, Integer>(); 196 new uk.ac.ox.cs.JRDFox.model.Individual[]{uk.ac.ox.cs.JRDFox.model.Individual.create(bot_str)});
174 197 OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)), bot_ind =
175 Set<String> topAnswers = new HashSet<String>(), botAnswers = new HashSet<String>(); 198 factory.getOWLNamedIndividual(IRI.create(bot_str));
176 OWLIndividual sub, obj; 199 Map<OWLAxiom, Integer> counter = new HashMap<OWLAxiom, Integer>();
177 if(dGraph.getExits().size() > 1) { 200
178 for(Clique answerClique : dGraph.getExits()) 201 Set<String> topAnswers = new HashSet<String>(), botAnswers = new HashSet<String>();
179 topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative() 202 OWLIndividual sub, obj;
180 .getAnswerTuple() 203 if(dGraph.getExits().size() > 1) {
181 .getGroundTerm(0)).getIRI()); 204 for(Clique answerClique : dGraph.getExits())
182 } 205 topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative()
183 else topAnswerTuple = null; 206 .getAnswerTuple()
184 207 .getGroundTerm(0)).getIRI());
185 if(dGraph.getEntrances().size() > 1) { 208 }
186 for(Clique answerClique : dGraph.getEntrances()) 209 else topAnswerTuple = null;
187 botAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative() 210
188 .getAnswerTuple() 211 if(dGraph.getEntrances().size() > 1) {
189 .getGroundTerm(0)).getIRI()); 212 for(Clique answerClique : dGraph.getEntrances())
190 } 213 botAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative()
191 else botAnswerTuple = null; 214 .getAnswerTuple()
192 215 .getGroundTerm(0)).getIRI());
193 for(OWLAxiom axiom : ontology.getABoxAxioms(true)) 216 }
194 if(axiom instanceof OWLClassAssertionAxiom) { 217 else botAnswerTuple = null;
195 OWLClassAssertionAxiom ca = (OWLClassAssertionAxiom) axiom; 218
196 sub = ca.getIndividual(); 219 for(OWLAxiom axiom : ontology.getABoxAxioms(true))
197 if(topAnswers.contains(sub.toStringID())) 220 if(axiom instanceof OWLClassAssertionAxiom) {
198 topAxioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind)); 221 OWLClassAssertionAxiom ca = (OWLClassAssertionAxiom) axiom;
199 if(botAnswers.contains(sub.toStringID())) 222 sub = ca.getIndividual();
200 inc(counter, factory.getOWLClassAssertionAxiom(ca.getClassExpression(), bot_ind)); 223 if(topAnswers.contains(sub.toStringID()))
201 } 224 topAxioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind));
202 else if(axiom instanceof OWLObjectPropertyAssertionAxiom) { 225 if(botAnswers.contains(sub.toStringID()))
203 OWLObjectPropertyAssertionAxiom oa = (OWLObjectPropertyAssertionAxiom) axiom; 226 inc(counter, factory.getOWLClassAssertionAxiom(ca.getClassExpression(), bot_ind));
204 sub = oa.getSubject(); 227 }
205 obj = oa.getObject(); 228 else if(axiom instanceof OWLObjectPropertyAssertionAxiom) {
206 if(topAnswers.contains(sub.toStringID())) 229 OWLObjectPropertyAssertionAxiom oa = (OWLObjectPropertyAssertionAxiom) axiom;
207 if(topAnswers.contains(obj.toStringID())) 230 sub = oa.getSubject();
208 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind)); 231 obj = oa.getObject();
209 else 232 if(topAnswers.contains(sub.toStringID()))
210 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj)); 233 if(topAnswers.contains(obj.toStringID()))
211 else { 234 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind));
212 if(topAnswers.contains(obj.toStringID())) 235 else
213 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind)); 236 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj));
214 } 237 else {
215 238 if(topAnswers.contains(obj.toStringID()))
216 if(botAnswers.contains(sub.toStringID())) 239 topAxioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind));
217 if(botAnswers.contains(obj.toStringID())) 240 }
218 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), bot_ind, bot_ind)); 241
219 else 242 if(botAnswers.contains(sub.toStringID()))
220 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), bot_ind, obj)); 243 if(botAnswers.contains(obj.toStringID()))
221 else { 244 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), bot_ind, bot_ind));
222 if(botAnswers.contains(obj.toStringID())) 245 else
223 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, bot_ind)); 246 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), bot_ind, obj));
224 } 247 else {
225 248 if(botAnswers.contains(obj.toStringID()))
226 } 249 inc(counter, factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, bot_ind));
227 else if(axiom instanceof OWLDataPropertyAssertionAxiom) { 250 }
228 OWLDataPropertyAssertionAxiom da = (OWLDataPropertyAssertionAxiom) axiom; 251
229 sub = da.getSubject(); 252 }
230 if(topAnswers.contains(sub.toStringID())) 253 else if(axiom instanceof OWLDataPropertyAssertionAxiom) {
231 topAxioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject())); 254 OWLDataPropertyAssertionAxiom da = (OWLDataPropertyAssertionAxiom) axiom;
232 255 sub = da.getSubject();
233 if(botAnswers.contains(sub.toStringID())) 256 if(topAnswers.contains(sub.toStringID()))
234 inc(counter, factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), bot_ind, da.getObject())); 257 topAxioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject()));
235 } 258
236 259 if(botAnswers.contains(sub.toStringID()))
237 int number = botAnswers.size(); 260 inc(counter, factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), bot_ind, da.getObject()));
238 for(Map.Entry<OWLAxiom, Integer> entry : counter.entrySet()) { 261 }
239 if(entry.getValue() == number) 262
240 botAxioms.add(entry.getKey()); 263 int number = botAnswers.size();
241 } 264 for(Map.Entry<OWLAxiom, Integer> entry : counter.entrySet()) {
242 } 265 if(entry.getValue() == number)
243 266 botAxioms.add(entry.getKey());
244 private void inc(Map<OWLAxiom, Integer> counter, OWLAxiom newAxiom) { 267 }
245 if(isDisposed()) throw new DisposedException(); 268 }
246 269
247 Integer number = counter.get(newAxiom); 270 private void inc(Map<OWLAxiom, Integer> counter, OWLAxiom newAxiom) {
248 if(number == null) counter.put(newAxiom, 1); 271 if(isDisposed()) throw new DisposedException();
249 else counter.put(newAxiom, number + 1); 272
250 } 273 Integer number = counter.get(newAxiom);
274 if(number == null) counter.put(newAxiom, 1);
275 else counter.put(newAxiom, number + 1);
276 }
251 277
252} 278}