diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner')
6 files changed, 55 insertions, 53 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ELHOQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/ELHOQueryReasoner.java index 2285b5f..f5a8093 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/ELHOQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/ELHOQueryReasoner.java | |||
| @@ -34,9 +34,9 @@ class ELHOQueryReasoner extends QueryReasoner { | |||
| 34 | } finally { | 34 | } finally { |
| 35 | if (elAnswer != null) elAnswer.dispose(); | 35 | if (elAnswer != null) elAnswer.dispose(); |
| 36 | } | 36 | } |
| 37 | queryRecord.addProcessingTime(Step.ELLowerBound, t.duration()); | 37 | queryRecord.addProcessingTime(Step.EL_LOWER_BOUND, t.duration()); |
| 38 | 38 | ||
| 39 | queryRecord.setDifficulty(Step.ELLowerBound); | 39 | queryRecord.setDifficulty(Step.EL_LOWER_BOUND); |
| 40 | queryRecord.markAsProcessed(); | 40 | queryRecord.markAsProcessed(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ELHOUQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/ELHOUQueryReasoner.java index a4fa7c3..34742c8 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/ELHOUQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/ELHOUQueryReasoner.java | |||
| @@ -50,7 +50,7 @@ class ELHOUQueryReasoner extends QueryReasoner { | |||
| 50 | } finally { | 50 | } finally { |
| 51 | if(rlAnswer != null) rlAnswer.dispose(); | 51 | if(rlAnswer != null) rlAnswer.dispose(); |
| 52 | } | 52 | } |
| 53 | queryRecord.addProcessingTime(Step.LowerBound, t.duration()); | 53 | queryRecord.addProcessingTime(Step.LOWER_BOUND, t.duration()); |
| 54 | 54 | ||
| 55 | String extendedQueryText = queryRecord.getExtendedQueryText().get(0); | 55 | String extendedQueryText = queryRecord.getExtendedQueryText().get(0); |
| 56 | String[] toQuery = queryRecord.getQueryText().equals(extendedQueryText) ? | 56 | String[] toQuery = queryRecord.getQueryText().equals(extendedQueryText) ? |
| @@ -66,10 +66,10 @@ class ELHOUQueryReasoner extends QueryReasoner { | |||
| 66 | } finally { | 66 | } finally { |
| 67 | if(rlAnswer != null) rlAnswer.dispose(); | 67 | if(rlAnswer != null) rlAnswer.dispose(); |
| 68 | } | 68 | } |
| 69 | queryRecord.addProcessingTime(Step.UpperBound, t.duration()); | 69 | queryRecord.addProcessingTime(Step.UPPER_BOUND, t.duration()); |
| 70 | 70 | ||
| 71 | if (queryRecord.processed()) { | 71 | if (queryRecord.processed()) { |
| 72 | queryRecord.setDifficulty(Step.UpperBound); | 72 | queryRecord.setDifficulty(Step.UPPER_BOUND); |
| 73 | return; | 73 | return; |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| @@ -83,7 +83,7 @@ class ELHOUQueryReasoner extends QueryReasoner { | |||
| 83 | } finally { | 83 | } finally { |
| 84 | if (elAnswer != null) elAnswer.dispose(); | 84 | if (elAnswer != null) elAnswer.dispose(); |
| 85 | } | 85 | } |
| 86 | queryRecord.addProcessingTime(Step.ELLowerBound, t.duration()); | 86 | queryRecord.addProcessingTime(Step.EL_LOWER_BOUND, t.duration()); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | @Override | 89 | @Override |
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 | } |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java index d4f4596..64945e8 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java | |||
| @@ -6,7 +6,7 @@ import uk.ac.ox.cs.pagoda.owl.OWLHelper; | |||
| 6 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | 6 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; |
| 7 | import uk.ac.ox.cs.pagoda.query.QueryManager; | 7 | import uk.ac.ox.cs.pagoda.query.QueryManager; |
| 8 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 8 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| 9 | import uk.ac.ox.cs.pagoda.util.Properties; | 9 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; |
| 10 | import uk.ac.ox.cs.pagoda.util.Timer; | 10 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 11 | import uk.ac.ox.cs.pagoda.util.Utility; | 11 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 12 | 12 | ||
| @@ -26,11 +26,11 @@ public abstract class QueryReasoner { | |||
| 26 | public boolean fullReasoner = this instanceof MyQueryReasoner; | 26 | public boolean fullReasoner = this instanceof MyQueryReasoner; |
| 27 | protected StringBuilder importedData = new StringBuilder(); | 27 | protected StringBuilder importedData = new StringBuilder(); |
| 28 | // protected boolean forSemFacet = false; | 28 | // protected boolean forSemFacet = false; |
| 29 | Properties properties; | 29 | PagodaProperties properties; |
| 30 | BufferedWriter answerWriter = null; | 30 | BufferedWriter answerWriter = null; |
| 31 | private QueryManager m_queryManager = new QueryManager(); | 31 | private QueryManager m_queryManager = new QueryManager(); |
| 32 | 32 | ||
| 33 | public static QueryReasoner getInstance(Properties p) { | 33 | public static QueryReasoner getInstance(PagodaProperties p) { |
| 34 | OWLOntology ontology = OWLHelper.loadOntology(p.getOntologyPath()); | 34 | OWLOntology ontology = OWLHelper.loadOntology(p.getOntologyPath()); |
| 35 | QueryReasoner pagoda = getInstance(ontology, p); | 35 | QueryReasoner pagoda = getInstance(ontology, p); |
| 36 | pagoda.properties = p; | 36 | pagoda.properties = p; |
| @@ -49,11 +49,11 @@ public abstract class QueryReasoner { | |||
| 49 | 49 | ||
| 50 | public static QueryReasoner getInstance(OWLOntology o) { | 50 | public static QueryReasoner getInstance(OWLOntology o) { |
| 51 | QueryReasoner pagoda = getInstance(Type.Full, o, DEFAULT_MULTI_STAGES, DEFAULT_EQUALITIES); | 51 | QueryReasoner pagoda = getInstance(Type.Full, o, DEFAULT_MULTI_STAGES, DEFAULT_EQUALITIES); |
| 52 | pagoda.properties = new Properties(); | 52 | pagoda.properties = new PagodaProperties(); |
| 53 | return pagoda; | 53 | return pagoda; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | private static QueryReasoner getInstance(OWLOntology o, Properties p) { | 56 | private static QueryReasoner getInstance(OWLOntology o, PagodaProperties p) { |
| 57 | return getInstance(Type.Full, o, DEFAULT_MULTI_STAGES, DEFAULT_EQUALITIES); | 57 | return getInstance(Type.Full, o, DEFAULT_MULTI_STAGES, DEFAULT_EQUALITIES); |
| 58 | } | 58 | } |
| 59 | 59 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/RLQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/RLQueryReasoner.java index 60f34c6..bea5bbf 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/RLQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/RLQueryReasoner.java | |||
| @@ -31,8 +31,8 @@ class RLQueryReasoner extends QueryReasoner { | |||
| 31 | } finally { | 31 | } finally { |
| 32 | if (rlAnswer != null) rlAnswer.dispose(); | 32 | if (rlAnswer != null) rlAnswer.dispose(); |
| 33 | } | 33 | } |
| 34 | queryRecord.addProcessingTime(Step.LowerBound, t.duration()); | 34 | queryRecord.addProcessingTime(Step.LOWER_BOUND, t.duration()); |
| 35 | queryRecord.setDifficulty(Step.LowerBound); | 35 | queryRecord.setDifficulty(Step.LOWER_BOUND); |
| 36 | queryRecord.markAsProcessed(); | 36 | queryRecord.markAsProcessed(); |
| 37 | } | 37 | } |
| 38 | 38 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java index e5564d9..bdef436 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/RLUQueryReasoner.java | |||
| @@ -41,7 +41,7 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 41 | } finally { | 41 | } finally { |
| 42 | if (ans != null) ans.dispose(); | 42 | if (ans != null) ans.dispose(); |
| 43 | } | 43 | } |
| 44 | queryRecord.addProcessingTime(Step.LowerBound, t.duration()); | 44 | queryRecord.addProcessingTime(Step.LOWER_BOUND, t.duration()); |
| 45 | 45 | ||
| 46 | ans = null; | 46 | ans = null; |
| 47 | t.reset(); | 47 | t.reset(); |
| @@ -52,10 +52,10 @@ class RLUQueryReasoner extends QueryReasoner { | |||
| 52 | } finally { | 52 | } finally { |
| 53 | if (ans != null) ans.dispose(); | 53 | if (ans != null) ans.dispose(); |
| 54 | } | 54 | } |
| 55 | queryRecord.addProcessingTime(Step.UpperBound, t.duration()); | 55 | queryRecord.addProcessingTime(Step.UPPER_BOUND, t.duration()); |
| 56 | 56 | ||
| 57 | if (queryRecord.processed()) | 57 | if (queryRecord.processed()) |
| 58 | queryRecord.setDifficulty(Step.UpperBound); | 58 | queryRecord.setDifficulty(Step.UPPER_BOUND); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | @Override | 61 | @Override |
