diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/endomorph')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/endomorph/plan/OpenEndPlan.java | 27 |
1 files changed, 11 insertions, 16 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 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.endomorph.plan; | 1 | package uk.ac.ox.cs.pagoda.endomorph.plan; |
| 2 | 2 | ||
| 3 | import java.util.Collection; | 3 | import uk.ac.ox.cs.pagoda.endomorph.Clique; |
| 4 | import java.util.HashSet; | 4 | import uk.ac.ox.cs.pagoda.endomorph.DependencyGraph; |
| 5 | import java.util.LinkedList; | ||
| 6 | import java.util.Map; | ||
| 7 | import java.util.Set; | ||
| 8 | |||
| 9 | import uk.ac.ox.cs.pagoda.endomorph.*; | ||
| 10 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | 5 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; |
| 11 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 6 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| 12 | import uk.ac.ox.cs.pagoda.query.QueryRecord.Step; | 7 | import uk.ac.ox.cs.pagoda.query.QueryRecord.Step; |
| @@ -15,6 +10,8 @@ import uk.ac.ox.cs.pagoda.summary.NodeTuple; | |||
| 15 | import uk.ac.ox.cs.pagoda.util.Timer; | 10 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 16 | import uk.ac.ox.cs.pagoda.util.Utility; | 11 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 17 | 12 | ||
| 13 | import java.util.*; | ||
| 14 | |||
| 18 | public class OpenEndPlan implements CheckPlan { | 15 | public 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) { |
