diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-07-08 18:53:00 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-07-08 18:53:00 +0100 |
| commit | 8241a535a55508b6c504f4f0b426612fe95d15a5 (patch) | |
| tree | 720a6572bbdf303b9ddfe69dd461b6640b36e6a0 /src/uk/ac/ox/cs/pagoda/endomorph | |
| parent | 77dd8849f8e79d324c8e12cd699912f284a8fdba (diff) | |
| download | ACQuA-8241a535a55508b6c504f4f0b426612fe95d15a5.tar.gz ACQuA-8241a535a55508b6c504f4f0b426612fe95d15a5.zip | |
Internalisation: added condition for existential variables (classes HermitChecker and QueryGraph).
Answer dependencies: found bug, trying to solve; excluding dependency analysis solve the problem.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/endomorph')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java | 12 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java | 29 |
2 files changed, 30 insertions, 11 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java b/src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java index e7f1c96..8514808 100644 --- a/src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java +++ b/src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java | |||
| @@ -114,23 +114,23 @@ public class DependencyGraph { | |||
| 114 | 114 | ||
| 115 | // print(); | 115 | // print(); |
| 116 | 116 | ||
| 117 | topolocialOrder = null; | 117 | topologicalOrder = null; |
| 118 | Utility.logDebug("link: " + link); | 118 | Utility.logDebug("link: " + link); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | LinkedList<Clique> topolocialOrder = null; | 121 | LinkedList<Clique> topologicalOrder = null; |
| 122 | 122 | ||
| 123 | public LinkedList<Clique> getTopologicalOrder() { | 123 | public LinkedList<Clique> getTopologicalOrder() { |
| 124 | if (topolocialOrder != null) return topolocialOrder; | 124 | if (topologicalOrder != null) return topologicalOrder; |
| 125 | 125 | ||
| 126 | topolocialOrder = new LinkedList<Clique>(); | 126 | topologicalOrder = new LinkedList<Clique>(); |
| 127 | Queue<Clique> toVisit = new LinkedList<Clique>(entrances); | 127 | Queue<Clique> toVisit = new LinkedList<Clique>(entrances); |
| 128 | Map<Clique, Integer> toVisitedInComingDegree = new HashMap<Clique, Integer>(); | 128 | Map<Clique, Integer> toVisitedInComingDegree = new HashMap<Clique, Integer>(); |
| 129 | 129 | ||
| 130 | int count; | 130 | int count; |
| 131 | while (!toVisit.isEmpty()) { | 131 | while (!toVisit.isEmpty()) { |
| 132 | Clique cu = toVisit.remove(); | 132 | Clique cu = toVisit.remove(); |
| 133 | topolocialOrder.add(cu); | 133 | topologicalOrder.add(cu); |
| 134 | if (outGoingEdges.containsKey(cu)) | 134 | if (outGoingEdges.containsKey(cu)) |
| 135 | for (Clique cv: outGoingEdges.get(cu)) { | 135 | for (Clique cv: outGoingEdges.get(cu)) { |
| 136 | if (toVisitedInComingDegree.containsKey(cv)) { | 136 | if (toVisitedInComingDegree.containsKey(cv)) { |
| @@ -144,7 +144,7 @@ public class DependencyGraph { | |||
| 144 | } | 144 | } |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | return topolocialOrder; | 147 | return topologicalOrder; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | private void addNodeTuple(NodeTuple u) { | 150 | private void addNodeTuple(NodeTuple u) { |
diff --git a/src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java b/src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java index 1c853d7..9ca73a1 100644 --- a/src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java +++ b/src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java | |||
| @@ -34,7 +34,11 @@ public class Endomorph extends Checker { | |||
| 34 | graph = new Graph(record.getRelevantOntology()); | 34 | graph = new Graph(record.getRelevantOntology()); |
| 35 | dGraph = new DependencyGraph(graph); | 35 | dGraph = new DependencyGraph(graph); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /* | ||
| 39 | * FIXME | ||
| 40 | * The result is unsound. The output is not deterministic. | ||
| 41 | * */ | ||
| 38 | @Override | 42 | @Override |
| 39 | public int check(AnswerTuples answerTuples) { | 43 | public int check(AnswerTuples answerTuples) { |
| 40 | if(isDisposed()) throw new DisposedException(); | 44 | if(isDisposed()) throw new DisposedException(); |
| @@ -57,11 +61,26 @@ public class Endomorph extends Checker { | |||
| 57 | Utility.logInfo("The number of individuals to be checked by Homomorphism checker: " + counter); | 61 | Utility.logInfo("The number of individuals to be checked by Homomorphism checker: " + counter); |
| 58 | // CheckPlan plan = new PlainPlan(this.checker, dGraph.cliques); | 62 | // CheckPlan plan = new PlainPlan(this.checker, dGraph.cliques); |
| 59 | // CheckPlan plan = new OpenEndMultiThreadPlan(this.checker, dGraph); | 63 | // CheckPlan plan = new OpenEndMultiThreadPlan(this.checker, dGraph); |
| 60 | CheckPlan plan = new OpenEndPlan(fullReasoner, dGraph, m_record); | 64 | |
| 61 | int answerCounter = plan.check(); | 65 | CheckPlan plan = new OpenEndPlan(fullReasoner, dGraph, m_record); |
| 62 | 66 | int answerCounter = plan.check(); | |
| 67 | |||
| 68 | |||
| 69 | // // BEGIN: debugging code | ||
| 70 | // Set<AnswerTuple> validatedAnswers = new HashSet<>(); | ||
| 71 | // for (answerTuples.reset(); answerTuples.isValid(); answerTuples.moveNext()) { | ||
| 72 | // if(fullReasoner.check(answerTuples.getTuple())) { | ||
| 73 | // validatedAnswers.add(answerTuples.getTuple()); | ||
| 74 | // } | ||
| 75 | // } | ||
| 76 | // m_record.addLowerBoundAnswers(validatedAnswers); | ||
| 77 | // | ||
| 78 | // Utility.logDebug("The number of correct answers: " + validatedAnswers.size()); | ||
| 79 | // return validatedAnswers.size(); | ||
| 80 | //// END: debugging code | ||
| 81 | |||
| 63 | Utility.logDebug("The number of correct answers: " + answerCounter); | 82 | Utility.logDebug("The number of correct answers: " + answerCounter); |
| 64 | return answerCounter; | 83 | return answerCounter; |
| 65 | } | 84 | } |
| 66 | 85 | ||
| 67 | public OWLOntology getOntology() { | 86 | public OWLOntology getOntology() { |
