aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-07-08 18:53:00 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-07-08 18:53:00 +0100
commit8241a535a55508b6c504f4f0b426612fe95d15a5 (patch)
tree720a6572bbdf303b9ddfe69dd461b6640b36e6a0 /src
parent77dd8849f8e79d324c8e12cd699912f284a8fdba (diff)
downloadACQuA-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')
-rw-r--r--src/uk/ac/ox/cs/pagoda/endomorph/DependencyGraph.java12
-rw-r--r--src/uk/ac/ox/cs/pagoda/endomorph/Endomorph.java29
-rw-r--r--src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java3
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java30
4 files changed, 48 insertions, 26 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() {
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 116e724..02697b8 100644
--- a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java
+++ b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java
@@ -109,8 +109,7 @@ public class QueryGraph {
109 Set<OWLAxiom> axioms = new HashSet<>(); 109 Set<OWLAxiom> axioms = new HashSet<>();
110 for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) { 110 for(Map.Entry<Term, Set<OWLClassExpression>> entry : concepts.map.entrySet()) {
111 if(existVars.contains(entry.getKey())) { 111 if(existVars.contains(entry.getKey())) {
112 OWLClassExpression conjunction = 112 OWLClassExpression conjunction = factory.getOWLThing();
113 factory.getOWLObjectIntersectionOf(factory.getOWLThing());
114 for(OWLClassExpression owlClassExpression : entry.getValue()) { 113 for(OWLClassExpression owlClassExpression : entry.getValue()) {
115 conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor)); 114 conjunction = factory.getOWLObjectIntersectionOf(conjunction, owlClassExpression.accept(visitor));
116 } 115 }
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
index 9574845..0362fc2 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java
@@ -106,19 +106,23 @@ public class HermitChecker extends Checker {
106 Map<Variable, Term> sub = answerTuple.getAssignment(answerVariable[1]); 106 Map<Variable, Term> sub = answerTuple.getAssignment(answerVariable[1]);
107 Set<OWLAxiom> toCheckAxioms = qGraph.getAssertions(sub); 107 Set<OWLAxiom> toCheckAxioms = qGraph.getAssertions(sub);
108 108
109// // TODO complete 109 // TODO complete
110// Set<OWLAxiom> toCheckExistentialAxioms = qGraph.getExistentialAxioms(sub); 110 Set<OWLAxiom> toCheckExistentialAxioms = qGraph.getExistentialAxioms(sub);
111// 111
112// // TODO possibly inefficient 112 // TODO possibly inefficient
113// for(OWLAxiom subclassAxiom : toCheckExistentialAxioms) { 113 for(OWLAxiom subclassAxiom : toCheckExistentialAxioms) {
114// Utility.logInfo("Checking consistency of ontology union " + subclassAxiom); 114 Utility.logDebug("Checking consistency of ontology union " + subclassAxiom);
115// ontology.getOWLOntologyManager().addAxiom(ontology, subclassAxiom); 115 ontology.getOWLOntologyManager().addAxiom(ontology, subclassAxiom);
116// if(hermit.isConsistent()) { 116 hermit.flush();
117// Utility.logDebug("@TIME to check one tuple: " + t.duration()); 117 if(hermit.isConsistent()) {
118// return false; 118 ontology.getOWLOntologyManager().removeAxiom(ontology, subclassAxiom);
119// } 119 hermit.flush();
120// ontology.getOWLOntologyManager().removeAxiom(ontology, subclassAxiom); 120 Utility.logDebug("@TIME to check one tuple: " + t.duration());
121// } 121 return false;
122 }
123 ontology.getOWLOntologyManager().removeAxiom(ontology, subclassAxiom);
124 hermit.flush();
125 }
122 126
123 127
124// for (OWLAxiom axiom: toCheckAxioms) System.out.println(axiom.toString()); 128// for (OWLAxiom axiom: toCheckAxioms) System.out.println(axiom.toString());