aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/query
diff options
context:
space:
mode:
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/query')
-rw-r--r--src/uk/ac/ox/cs/pagoda/query/QueryRecord.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
index 6c87eb5..15b2c01 100644
--- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
+++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
@@ -69,7 +69,7 @@ public class QueryRecord {
69 } 69 }
70 70
71 public boolean updateLowerBoundAnswers(AnswerTuples answerTuples) { 71 public boolean updateLowerBoundAnswers(AnswerTuples answerTuples) {
72 if (answerTuples == null) return false; 72 if (answerTuples == null) return false;
73 boolean update = false; 73 boolean update = false;
74 for (AnswerTuple tuple; answerTuples.isValid(); answerTuples.moveNext()) { 74 for (AnswerTuple tuple; answerTuples.isValid(); answerTuples.moveNext()) {
75 tuple = answerTuples.getTuple(); 75 tuple = answerTuples.getTuple();
@@ -77,8 +77,12 @@ public class QueryRecord {
77 soundAnswerTuples.add(tuple); 77 soundAnswerTuples.add(tuple);
78 if (gapAnswerTuples != null) 78 if (gapAnswerTuples != null)
79 gapAnswerTuples.remove(tuple); 79 gapAnswerTuples.remove(tuple);
80 update = true; 80 update = true;
81 } 81 }
82 // TODO could be wrong, but if possible add the check
83// else if (! gapAnswerTuples.contains(tuple)) {
84// throw new IllegalArgumentException("The lower bound answers must be contained in the upper ones!");
85// }
82 } 86 }
83 Utility.logInfo("The number of answers in the lower bound: " + soundAnswerTuples.size()); 87 Utility.logInfo("The number of answers in the lower bound: " + soundAnswerTuples.size());
84 88
@@ -103,14 +107,16 @@ public class QueryRecord {
103 for (; answerTuples.isValid(); answerTuples.moveNext()) { 107 for (; answerTuples.isValid(); answerTuples.moveNext()) {
104 ++number; 108 ++number;
105 } 109 }
106 Utility.logInfo("The number of answers returned by the upper bound: " + number); 110 Utility.logInfo("The number of answers returned by an upper bound: " + number);
107 if (number <= soundAnswerTuples.size()) { 111 if (number <= soundAnswerTuples.size()) {
108 if (gapAnswerTuples != null) gapAnswerTuples.clear(); 112 if (gapAnswerTuples != null) gapAnswerTuples.clear();
109 else gapAnswerTuples = new HashSet<AnswerTuple>(); 113 else gapAnswerTuples = new HashSet<AnswerTuple>();
110 114
111 Utility.logInfo("The number of answers in the upper bound: " + (soundAnswerTuples.size() + gapAnswerTuples.size())); 115 Utility.logInfo("The number of upper bound answers: " + (soundAnswerTuples.size() + gapAnswerTuples.size()));
112 return false; 116 return false;
113 } 117 }
118 else if (number < soundAnswerTuples.size())
119 throw new IllegalArgumentException("The upper bound answers must contain all the lower bound ones!");
114 answerTuples.reset(); 120 answerTuples.reset();
115 } 121 }
116 122
@@ -362,8 +368,8 @@ public class QueryRecord {
362 } 368 }
363 369
364 public enum Step {LowerBound, UpperBound, ELLowerBound, 370 public enum Step {LowerBound, UpperBound, ELLowerBound,
365 Fragment, FragmentRefinement, Summarisation, Dependency, FullReasoning}; 371 Fragment, FragmentRefinement, Summarisation, Dependency, FullReasoning}
366 372
367 double[] timer; 373 double[] timer;
368 374
369 public void addProcessingTime(Step step, double time) { 375 public void addProcessingTime(Step step, double time) {