diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/query')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | 26 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 5 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java index 291af27..d88376f 100644 --- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java +++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | |||
| @@ -171,14 +171,10 @@ public class QueryRecord extends Disposable { | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | public String getQueryText() { | 173 | public String getQueryText() { |
| 174 | if(isDisposed()) throw new DisposedException(); | ||
| 175 | |||
| 176 | return queryText; | 174 | return queryText; |
| 177 | } | 175 | } |
| 178 | 176 | ||
| 179 | public String getQueryID() { | 177 | public String getQueryID() { |
| 180 | if(isDisposed()) throw new DisposedException(); | ||
| 181 | |||
| 182 | return stringQueryID; | 178 | return stringQueryID; |
| 183 | } | 179 | } |
| 184 | 180 | ||
| @@ -193,8 +189,6 @@ public class QueryRecord extends Disposable { | |||
| 193 | } | 189 | } |
| 194 | 190 | ||
| 195 | public String toString() { | 191 | public String toString() { |
| 196 | if(isDisposed()) throw new DisposedException(); | ||
| 197 | |||
| 198 | return queryText; | 192 | return queryText; |
| 199 | } | 193 | } |
| 200 | 194 | ||
| @@ -281,6 +275,20 @@ public class QueryRecord extends Disposable { | |||
| 281 | } | 275 | } |
| 282 | } | 276 | } |
| 283 | 277 | ||
| 278 | public Map<String, String> getStatistics() { | ||
| 279 | HashMap<String, String> result = new HashMap<>(); | ||
| 280 | |||
| 281 | double totalTime = 0.0; | ||
| 282 | for(Step step : Step.values()) { | ||
| 283 | result.put(step.toString(), Double.toString(timer[step.ordinal()])); | ||
| 284 | totalTime += timer[step.ordinal()]; | ||
| 285 | } | ||
| 286 | result.put("totalTime", Double.toString(totalTime)); | ||
| 287 | result.put("difficulty", difficulty.toString()); | ||
| 288 | |||
| 289 | return result; | ||
| 290 | } | ||
| 291 | |||
| 284 | public String outputSoundAnswerTuple() { | 292 | public String outputSoundAnswerTuple() { |
| 285 | if(isDisposed()) throw new DisposedException(); | 293 | if(isDisposed()) throw new DisposedException(); |
| 286 | 294 | ||
| @@ -359,6 +367,8 @@ public class QueryRecord extends Disposable { | |||
| 359 | Utility.logError("The answer (" + answer + ") cannot be removed, because it is not in the upper bound."); | 367 | Utility.logError("The answer (" + answer + ") cannot be removed, because it is not in the upper bound."); |
| 360 | gapAnswerTuples.remove(answer); | 368 | gapAnswerTuples.remove(answer); |
| 361 | } | 369 | } |
| 370 | int numOfUpperBoundAnswers = soundAnswerTuples.size() + gapAnswerTuples.size(); | ||
| 371 | Utility.logInfo("Upper bound answers updated: " + numOfUpperBoundAnswers); | ||
| 362 | } | 372 | } |
| 363 | 373 | ||
| 364 | public void addLowerBoundAnswers(Collection<AnswerTuple> answers) { | 374 | public void addLowerBoundAnswers(Collection<AnswerTuple> answers) { |
| @@ -722,7 +732,9 @@ public class QueryRecord extends Disposable { | |||
| 722 | 732 | ||
| 723 | @Override | 733 | @Override |
| 724 | public String toString() { | 734 | public String toString() { |
| 725 | return WordUtils.capitalizeFully(super.toString(), new char[]{'_'}).replace("_", ""); | 735 | String s = super.toString(); |
| 736 | if(s == null) return null; | ||
| 737 | return WordUtils.capitalizeFully(s, new char[]{'_'}).replace("_", ""); | ||
| 726 | } | 738 | } |
| 727 | } | 739 | } |
| 728 | 740 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java index a09cf5b..116e724 100644 --- a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java +++ b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | |||
| @@ -102,16 +102,17 @@ public class QueryGraph { | |||
| 102 | // return axioms; | 102 | // return axioms; |
| 103 | // } | 103 | // } |
| 104 | 104 | ||
| 105 | public Set<OWLAxiom> getExistentialAxioms() { | 105 | public Set<OWLAxiom> getExistentialAxioms(Map<Variable, Term> assignment) { |
| 106 | if(!rollable_edges.isEmpty()) return null; | 106 | if(!rollable_edges.isEmpty()) return null; |
| 107 | 107 | ||
| 108 | Visitor visitor = new Visitor(factory, assignment); | ||
| 108 | Set<OWLAxiom> axioms = new HashSet<>(); | 109 | Set<OWLAxiom> axioms = new HashSet<>(); |
| 109 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { | 110 | for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { |
| 110 | if(existVars.contains(entry.getKey())) { | 111 | if(existVars.contains(entry.getKey())) { |
| 111 | OWLClassExpression conjunction = | 112 | OWLClassExpression conjunction = |
| 112 | factory.getOWLObjectIntersectionOf(factory.getOWLThing()); | 113 | factory.getOWLObjectIntersectionOf(factory.getOWLThing()); |
| 113 | for(OWLClassExpression owlClassExpression : entry.getValue()) { | 114 | for(OWLClassExpression owlClassExpression : entry.getValue()) { |
| 114 | conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression); | 115 | conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); |
| 115 | } | 116 | } |
| 116 | axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); | 117 | axioms.add(factory.getOWLSubClassOfAxiom(conjunction, factory.getOWLNothing())); |
| 117 | } | 118 | } |
