aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-05-28 19:14:03 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-05-28 19:14:03 +0100
commitb8212705e65db860bbb899b16fa0e7bc9e8536cf (patch)
tree7343b7349904717a4b99840f44e802e401650044 /src/uk/ac/ox/cs
parent1055e67727b1aca80ae7ffaceabce3aacb00b6d2 (diff)
downloadACQuA-b8212705e65db860bbb899b16fa0e7bc9e8536cf.tar.gz
ACQuA-b8212705e65db860bbb899b16fa0e7bc9e8536cf.zip
Bug-fix in tester.
Diffstat (limited to 'src/uk/ac/ox/cs')
-rw-r--r--src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java27
-rw-r--r--src/uk/ac/ox/cs/pagoda/query/AnswerTuple.java3
-rw-r--r--src/uk/ac/ox/cs/pagoda/query/QueryRecord.java4
3 files changed, 15 insertions, 19 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java b/src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java
index a740833..4022c1d 100644
--- a/src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java
+++ b/src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java
@@ -1,12 +1,7 @@
1package uk.ac.ox.cs.pagoda.endomorph.plan; 1package uk.ac.ox.cs.pagoda.endomorph.plan;
2 2
3import java.util.Collection; 3import uk.ac.ox.cs.pagoda.endomorph.Clique;
4import java.util.HashSet; 4import uk.ac.ox.cs.pagoda.endomorph.DependencyGraph;
5import java.util.LinkedList;
6import java.util.Map;
7import java.util.Set;
8
9import uk.ac.ox.cs.pagoda.endomorph.*;
10import uk.ac.ox.cs.pagoda.query.AnswerTuple; 5import uk.ac.ox.cs.pagoda.query.AnswerTuple;
11import uk.ac.ox.cs.pagoda.query.QueryRecord; 6import uk.ac.ox.cs.pagoda.query.QueryRecord;
12import uk.ac.ox.cs.pagoda.query.QueryRecord.Step; 7import uk.ac.ox.cs.pagoda.query.QueryRecord.Step;
@@ -15,6 +10,8 @@ import uk.ac.ox.cs.pagoda.summary.NodeTuple;
15import uk.ac.ox.cs.pagoda.util.Timer; 10import uk.ac.ox.cs.pagoda.util.Timer;
16import uk.ac.ox.cs.pagoda.util.Utility; 11import uk.ac.ox.cs.pagoda.util.Utility;
17 12
13import java.util.*;
14
18public class OpenEndPlan implements CheckPlan { 15public class OpenEndPlan implements CheckPlan {
19 16
20 public static final int TIME_OUT_MIN = 1; 17 public static final int TIME_OUT_MIN = 1;
@@ -23,18 +20,16 @@ public class OpenEndPlan implements CheckPlan {
23 DependencyGraph dGraph; 20 DependencyGraph dGraph;
24 QueryRecord m_record; 21 QueryRecord m_record;
25 int m_answerArity; 22 int m_answerArity;
26 23 Set<Clique> validated = new HashSet<Clique>();
24 Set<Clique> falsified = new HashSet<Clique>();
25 Set<AnswerTuple> passedAnswers = new HashSet<AnswerTuple>();
27 public OpenEndPlan(Checker checker, DependencyGraph dGraph, QueryRecord record) { 26 public OpenEndPlan(Checker checker, DependencyGraph dGraph, QueryRecord record) {
28 this.checker = checker; 27 this.checker = checker;
29 this.dGraph = dGraph; 28 this.dGraph = dGraph;
30 m_record = record; 29 m_record = record;
31 m_answerArity = record.getAnswerVariables().length; 30 m_answerArity = record.getAnswerVariables().length;
32 } 31 }
33 32
34 Set<Clique> validated = new HashSet<Clique>();
35 Set<Clique> falsified = new HashSet<Clique>();
36 Set<AnswerTuple> passedAnswers = new HashSet<AnswerTuple>();
37
38 @Override 33 @Override
39 public int check() { 34 public int check() {
40 LinkedList<Clique> topo = new LinkedList<Clique>(dGraph.getTopologicalOrder()); 35 LinkedList<Clique> topo = new LinkedList<Clique>(dGraph.getTopologicalOrder());
@@ -93,20 +88,20 @@ public class OpenEndPlan implements CheckPlan {
93 } 88 }
94 89
95 m_record.addLowerBoundAnswers(validAnswers); 90 m_record.addLowerBoundAnswers(validAnswers);
96 m_record.addProcessingTime(Step.FullReasoning, t.duration()); 91 m_record.addProcessingTime(Step.FULL_REASONING, t.duration());
97 return count; 92 return count;
98 } 93 }
99 94
100 private boolean redundant(Clique clique) { 95 private boolean redundant(Clique clique) {
101 for (NodeTuple nodeTuple: clique.getNodeTuples()) 96 for (NodeTuple nodeTuple: clique.getNodeTuples())
102 if (!passedAnswers.contains(AnswerTuple.create(nodeTuple.getAnswerTuple(), m_answerArity))) 97 if (!passedAnswers.contains(AnswerTuple.getInstance(nodeTuple.getAnswerTuple(), m_answerArity)))
103 return false; 98 return false;
104 return true; 99 return true;
105 } 100 }
106 101
107 private void addProjections(Clique clique) { 102 private void addProjections(Clique clique) {
108 for (NodeTuple nodeTuple: clique.getNodeTuples()) 103 for (NodeTuple nodeTuple: clique.getNodeTuples())
109 passedAnswers.add(AnswerTuple.create(nodeTuple.getAnswerTuple(), m_answerArity)); 104 passedAnswers.add(AnswerTuple.getInstance(nodeTuple.getAnswerTuple(), m_answerArity));
110 } 105 }
111 106
112 private void setMarkCascadelyValidated(Clique clique) { 107 private void setMarkCascadelyValidated(Clique clique) {
diff --git a/src/uk/ac/ox/cs/pagoda/query/AnswerTuple.java b/src/uk/ac/ox/cs/pagoda/query/AnswerTuple.java
index 54e4837..cb2b0a3 100644
--- a/src/uk/ac/ox/cs/pagoda/query/AnswerTuple.java
+++ b/src/uk/ac/ox/cs/pagoda/query/AnswerTuple.java
@@ -156,7 +156,8 @@ public class AnswerTuple {
156 public AnswerTuple deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) 156 public AnswerTuple deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
157 throws JsonParseException { 157 throws JsonParseException {
158 String tuplesString = json.getAsJsonPrimitive().getAsString(); 158 String tuplesString = json.getAsJsonPrimitive().getAsString();
159 StringTokenizer tokenizer = new StringTokenizer(SEPARATOR); 159// StringTokenizer tokenizer = new StringTokenizer(tuplesString, SEPARATOR);
160 StringTokenizer tokenizer = new StringTokenizer(tuplesString);
160 GroundTerm[] terms = new GroundTerm[tokenizer.countTokens()]; 161 GroundTerm[] terms = new GroundTerm[tokenizer.countTokens()];
161 162
162 // TODO test parsing 163 // TODO test parsing
diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
index fd20af1..1f81a78 100644
--- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
+++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java
@@ -30,11 +30,11 @@ public class QueryRecord {
30 double[] timer; 30 double[] timer;
31 int subID; 31 int subID;
32 DLClause queryClause = null; 32 DLClause queryClause = null;
33 int queryID = -1;
34 Set<AnswerTuple> soundAnswerTuples = new HashSet<AnswerTuple>();
33 private Step difficulty; 35 private Step difficulty;
34 private String queryText; 36 private String queryText;
35 private int queryID = -1;
36 private String[][] answerVariables = null; 37 private String[][] answerVariables = null;
37 private Set<AnswerTuple> soundAnswerTuples = new HashSet<AnswerTuple>();
38 private Set<AnswerTuple> gapAnswerTuples = null; 38 private Set<AnswerTuple> gapAnswerTuples = null;
39 private QueryManager m_manager; 39 private QueryManager m_manager;
40 40