diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index 6adbd37..2a49e24 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | |||
| @@ -198,26 +198,31 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 198 | return satisfiable == SatisfiabilityStatus.SATISFIABLE; | 198 | return satisfiable == SatisfiabilityStatus.SATISFIABLE; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | // TODO why the following??? | 201 | /** |
| 202 | private void queryUpperStore(BasicQueryEngine upperStore, QueryRecord queryRecord, Tuple<String> extendedQuery) { | 202 | * It deals with blanks nodes differently from variables |
| 203 | * according to SPARQL semantics for OWL2 Entailment Regime. | ||
| 204 | * <p> | ||
| 205 | * In particular variables are matched only against named individuals, | ||
| 206 | * and blank nodes against named and anonymous individuals. | ||
| 207 | */ | ||
| 208 | private boolean queryUpperStore(BasicQueryEngine upperStore, QueryRecord queryRecord, | ||
| 209 | Tuple<String> extendedQuery, Step step) { | ||
| 210 | |||
| 211 | queryUpperBound(upperStore, queryRecord, queryRecord.getQueryText(), queryRecord.getAnswerVariables()); | ||
| 212 | |||
| 213 | if(queryRecord.hasNonAnsDistinguishedVariables()) { | ||
| 214 | if(!queryRecord.processed()) | ||
| 215 | queryUpperBound(upperStore, queryRecord, extendedQuery.get(0), queryRecord.getAnswerVariables()); | ||
| 216 | if(!queryRecord.processed()) | ||
| 217 | queryUpperBound(upperStore, queryRecord, extendedQuery.get(1), queryRecord.getDistinguishedVariables()); | ||
| 218 | } | ||
| 203 | 219 | ||
| 204 | // Utility.logInfo("1"); | 220 | queryRecord.addProcessingTime(step, t.duration()); |
| 205 | // queryUpperBound(upperStore, queryRecord, queryRecord.getQueryText(), queryRecord.getAnswerVariables()); | 221 | if(queryRecord.processed()) { |
| 206 | // | 222 | queryRecord.setDifficulty(step); |
| 207 | // boolean conditionA = !queryRecord.processed() && !queryRecord.getQueryText().equals(extendedQuery.get(0)); | 223 | return true; |
| 208 | // boolean conditionB = !queryRecord.processed() && queryRecord.hasNonAnsDistinguishedVariables(); | 224 | } |
| 209 | // | 225 | return false; |
| 210 | // if(conditionA ^ conditionB) | ||
| 211 | // throw new Error("It really happened! I thought it was impossible"); | ||
| 212 | // | ||
| 213 | // if (conditionA) { | ||
| 214 | // Utility.logInfo("2"); | ||
| 215 | queryUpperBound(upperStore, queryRecord, extendedQuery.get(0), queryRecord.getAnswerVariables()); | ||
| 216 | // } | ||
| 217 | // if (conditionB) { | ||
| 218 | // Utility.logInfo("3"); | ||
| 219 | // queryUpperBound(upperStore, queryRecord, extendedQuery.get(1), queryRecord.getDistinguishedVariables()); | ||
| 220 | // } | ||
| 221 | } | 226 | } |
| 222 | 227 | ||
| 223 | /** | 228 | /** |
| @@ -234,7 +239,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 234 | } finally { | 239 | } finally { |
| 235 | if (rlAnswer != null) rlAnswer.dispose(); | 240 | if (rlAnswer != null) rlAnswer.dispose(); |
| 236 | } | 241 | } |
| 237 | queryRecord.addProcessingTime(Step.LowerBound, t.duration()); | 242 | queryRecord.addProcessingTime(Step.LOWER_BOUND, t.duration()); |
| 238 | 243 | ||
| 239 | t.reset(); | 244 | t.reset(); |
| 240 | 245 | ||
| @@ -249,17 +254,14 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 249 | // queryUpperStore(trackingStore, queryRecord, extendedQueryTexts); | 254 | // queryUpperStore(trackingStore, queryRecord, extendedQueryTexts); |
| 250 | // else { | 255 | // else { |
| 251 | 256 | ||
| 252 | queryUpperStore(trackingStore, queryRecord, extendedQueryTexts); | 257 | if(queryUpperStore(trackingStore, queryRecord, extendedQueryTexts, Step.SIMPLE_UPPER_BOUND)) |
| 253 | if(!(queryRecord.isBottom() || (lazyUpperStore == null && limitedSkolemUpperStore == null))) { | ||
| 254 | if(lazyUpperStore != null) queryUpperStore(lazyUpperStore, queryRecord, extendedQueryTexts); | ||
| 255 | if(limitedSkolemUpperStore != null) | ||
| 256 | queryUpperStore(limitedSkolemUpperStore, queryRecord, extendedQueryTexts); | ||
| 257 | } | ||
| 258 | |||
| 259 | queryRecord.addProcessingTime(Step.UpperBound, t.duration()); | ||
| 260 | if (queryRecord.processed()) { | ||
| 261 | queryRecord.setDifficulty(Step.UpperBound); | ||
| 262 | return null; | 258 | return null; |
| 259 | |||
| 260 | if(!queryRecord.isBottom()) { | ||
| 261 | if(lazyUpperStore != null && queryUpperStore(lazyUpperStore, queryRecord, extendedQueryTexts, Step.LAZY_UPPER_BOUND)) | ||
| 262 | return null; | ||
| 263 | if(limitedSkolemUpperStore != null && queryUpperStore(limitedSkolemUpperStore, queryRecord, extendedQueryTexts, Step.L_SKOLEM_UPPER_BOUND)) | ||
| 264 | return null; | ||
| 263 | } | 265 | } |
| 264 | 266 | ||
| 265 | t.reset(); | 267 | t.reset(); |
| @@ -271,10 +273,10 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 271 | } finally { | 273 | } finally { |
| 272 | if (elAnswer != null) elAnswer.dispose(); | 274 | if (elAnswer != null) elAnswer.dispose(); |
| 273 | } | 275 | } |
| 274 | queryRecord.addProcessingTime(Step.ELLowerBound, t.duration()); | 276 | queryRecord.addProcessingTime(Step.EL_LOWER_BOUND, t.duration()); |
| 275 | 277 | ||
| 276 | if (queryRecord.processed()) { | 278 | if (queryRecord.processed()) { |
| 277 | queryRecord.setDifficulty(Step.ELLowerBound); | 279 | queryRecord.setDifficulty(Step.EL_LOWER_BOUND); |
| 278 | return null; | 280 | return null; |
| 279 | } | 281 | } |
| 280 | 282 | ||
| @@ -291,7 +293,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 291 | // } | 293 | // } |
| 292 | // else { | 294 | // else { |
| 293 | knowledgeBase = tracker.extract(trackingStore, consistency.getQueryRecords(), true); | 295 | knowledgeBase = tracker.extract(trackingStore, consistency.getQueryRecords(), true); |
| 294 | queryRecord.addProcessingTime(Step.Fragment, t.duration()); | 296 | queryRecord.addProcessingTime(Step.FRAGMENT, t.duration()); |
| 295 | // } | 297 | // } |
| 296 | 298 | ||
| 297 | if(knowledgeBase.isEmpty() || queryRecord.isBottom()) | 299 | if(knowledgeBase.isEmpty() || queryRecord.isBottom()) |
| @@ -307,10 +309,10 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 307 | // knowledgebase = iterativeRefinement.extractWithFullABox(importedData.toString(), program.getUpperBottomStrategy()); | 309 | // knowledgebase = iterativeRefinement.extractWithFullABox(importedData.toString(), program.getUpperBottomStrategy()); |
| 308 | // } | 310 | // } |
| 309 | // | 311 | // |
| 310 | // queryRecord.addProcessingTime(Step.FragmentRefinement, t.duration()); | 312 | // queryRecord.addProcessingTime(Step.FRAGMENT_REFINEMENT, t.duration()); |
| 311 | // | 313 | // |
| 312 | // if (knowledgebase == null) | 314 | // if (knowledgebase == null) |
| 313 | // queryRecord.setDifficulty(Step.FragmentRefinement); | 315 | // queryRecord.setDifficulty(Step.FRAGMENT_REFINEMENT); |
| 314 | 316 | ||
| 315 | return knowledgeBase; | 317 | return knowledgeBase; |
| 316 | } | 318 | } |
