aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-05-15 17:32:22 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-05-15 17:32:22 +0100
commit1b6a128137e5d7a6ff75566869232fc054afabef (patch)
tree3def49c3c9c1e2ebebc49b82d9eb562b6d097cad /src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java
parentbd995407098d1b0c79c17a28b0b23a2c24a493c6 (diff)
downloadACQuA-1b6a128137e5d7a6ff75566869232fc054afabef.tar.gz
ACQuA-1b6a128137e5d7a6ff75566869232fc054afabef.zip
Testing and fixing. Executed successfully on UOBM{1,2,3,4,5,6,7,8}.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java68
1 files changed, 27 insertions, 41 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java
index b7a3667..409a2c9 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java
@@ -15,6 +15,7 @@ import uk.ac.ox.cs.pagoda.query.AnswerTuples;
15import uk.ac.ox.cs.pagoda.query.QueryManager; 15import uk.ac.ox.cs.pagoda.query.QueryManager;
16import uk.ac.ox.cs.pagoda.query.QueryRecord; 16import uk.ac.ox.cs.pagoda.query.QueryRecord;
17import uk.ac.ox.cs.pagoda.reasoner.full.Checker; 17import uk.ac.ox.cs.pagoda.reasoner.full.Checker;
18import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine;
18import uk.ac.ox.cs.pagoda.rules.UpperDatalogProgram; 19import uk.ac.ox.cs.pagoda.rules.UpperDatalogProgram;
19import uk.ac.ox.cs.pagoda.summary.HermitSummaryFilter; 20import uk.ac.ox.cs.pagoda.summary.HermitSummaryFilter;
20import uk.ac.ox.cs.pagoda.tracking.QueryTracker; 21import uk.ac.ox.cs.pagoda.tracking.QueryTracker;
@@ -54,7 +55,7 @@ public class ConsistencyManager {
54 55
55 if (fullQueryRecord.getNoOfSoundAnswers() > 0) { 56 if (fullQueryRecord.getNoOfSoundAnswers() > 0) {
56 Utility.logInfo("Answers to bottom in the lower bound: ", fullQueryRecord.outputSoundAnswerTuple()); 57 Utility.logInfo("Answers to bottom in the lower bound: ", fullQueryRecord.outputSoundAnswerTuple());
57 return unsatisfiability(t.duration()); 58 return false;
58 } 59 }
59 return true; 60 return true;
60 } 61 }
@@ -63,39 +64,20 @@ public class ConsistencyManager {
63 fullQueryRecord.updateLowerBoundAnswers(m_reasoner.elLowerStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables())); 64 fullQueryRecord.updateLowerBoundAnswers(m_reasoner.elLowerStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables()));
64 if (fullQueryRecord.getNoOfSoundAnswers() > 0) { 65 if (fullQueryRecord.getNoOfSoundAnswers() > 0) {
65 Utility.logInfo("Answers to bottom in the lower bound: ", fullQueryRecord.outputSoundAnswerTuple()); 66 Utility.logInfo("Answers to bottom in the lower bound: ", fullQueryRecord.outputSoundAnswerTuple());
66 return unsatisfiability(t.duration()); 67 return true;
67 } 68 }
68 return true; 69 return true;
69 } 70 }
70
71 boolean checkLazyUpper() {
72 if (m_reasoner.lazyUpperStore != null) {
73 AnswerTuples tuples = null;
74 try {
75 tuples = m_reasoner.lazyUpperStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables());
76
77 Utility.logDebug("CheckLazyUpperBound: answerVars=" + fullQueryRecord.getAnswerVariables());
78
79 if (!tuples.isValid()) {
80 Utility.logInfo("There are no contradictions derived in the lazy upper bound materialisation.");
81 return satisfiability(t.duration());
82 }
83 }
84 finally {
85 if (tuples != null) tuples.dispose();
86 }
87 }
88 return false;
89 }
90 71
91 boolean checkSkolemUpper() { 72 boolean checkUpper(BasicQueryEngine upperStore) {
92 if (m_reasoner.limitedSkolemUpperStore != null) { 73 if (upperStore != null) {
93 AnswerTuples tuples = null; 74 AnswerTuples tuples = null;
94 try { 75 try {
95 tuples = m_reasoner.limitedSkolemUpperStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables()); 76 tuples = upperStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables());
96 if (!tuples.isValid()) { 77 if (!tuples.isValid()) {
97 Utility.logInfo("There are no contradictions derived in the limited-skolem upper bound materialisation."); 78 Utility.logInfo("There are no contradictions derived in "+ upperStore.getName() +" materialisation.");
98 return satisfiability(t.duration()); 79 Utility.logDebug("The ontology and dataset is satisfiable.");
80 return true;
99 } 81 }
100 } 82 }
101 finally { 83 finally {
@@ -104,7 +86,11 @@ public class ConsistencyManager {
104 } 86 }
105 return false; 87 return false;
106 } 88 }
107 89
90 void dispose() {
91 fullQueryRecord.dispose();
92 }
93
108 boolean check() { 94 boolean check() {
109// if (!checkRLLowerBound()) return false; 95// if (!checkRLLowerBound()) return false;
110// if (!checkELLowerBound()) return false; 96// if (!checkELLowerBound()) return false;
@@ -119,7 +105,7 @@ public class ConsistencyManager {
119 } 105 }
120 106
121 if (fullQueryRecord.getNoOfCompleteAnswers() == 0) 107 if (fullQueryRecord.getNoOfCompleteAnswers() == 0)
122 return satisfiability(t.duration()); 108 return true;
123 109
124 extractBottomFragment(); 110 extractBottomFragment();
125 111
@@ -139,7 +125,7 @@ public class ConsistencyManager {
139 checker = new HermitSummaryFilter(r, true); // m_reasoner.factory.getSummarisedReasoner(r); 125 checker = new HermitSummaryFilter(r, true); // m_reasoner.factory.getSummarisedReasoner(r);
140 satisfiability = checker.isConsistent(); 126 satisfiability = checker.isConsistent();
141 checker.dispose(); 127 checker.dispose();
142 if (!satisfiability) return unsatisfiability(t.duration()); 128 if (!satisfiability) return false;
143 } 129 }
144 130
145// Checker checker = m_reasoner.factory.getSummarisedReasoner(fullQueryRecord); 131// Checker checker = m_reasoner.factory.getSummarisedReasoner(fullQueryRecord);
@@ -147,20 +133,20 @@ public class ConsistencyManager {
147// checker.dispose(); 133// checker.dispose();
148// if (!satisfiable) return unsatisfiability(t.duration()); 134// if (!satisfiable) return unsatisfiability(t.duration());
149 135
150 return satisfiability(t.duration()); 136 return true;
151 } 137 }
152 138
153 protected boolean unsatisfiability(double duration) { 139// protected boolean unsatisfiability(double duration) {
154 fullQueryRecord.dispose(); 140// fullQueryRecord.dispose();
155 Utility.logDebug("The ontology and dataset is unsatisfiable."); 141// Utility.logDebug("The ontology and dataset is unsatisfiable.");
156 return false; 142// return false;
157 } 143// }
158 144
159 protected boolean satisfiability(double duration) { 145// protected boolean satisfiability(double duration) {
160 fullQueryRecord.dispose(); 146// fullQueryRecord.dispose();
161 Utility.logDebug("The ontology and dataset is satisfiable."); 147// Utility.logDebug("The ontology and dataset is satisfiable.");
162 return true; 148// return true;
163 } 149// }
164 150
165 boolean fragmentExtracted = false; 151 boolean fragmentExtracted = false;
166 152