diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-06-09 18:23:15 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-06-09 18:23:15 +0100 |
| commit | 6e8ee40e41d84e0466153802a2c9b4ae88af3544 (patch) | |
| tree | 74d5d4fa04f2c8339433fffd6ababc2b21afc2e1 /src/uk | |
| parent | dcdf7f8062919e5746b0b15c77ba8279d5f526c1 (diff) | |
| download | ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.tar.gz ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.zip | |
Fixed marking original individuals in the relevant upper store.
Diffstat (limited to 'src/uk')
7 files changed, 28 insertions, 5 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/Pagoda.java b/src/uk/ac/ox/cs/pagoda/Pagoda.java index aeb85a7..f5dce15 100644 --- a/src/uk/ac/ox/cs/pagoda/Pagoda.java +++ b/src/uk/ac/ox/cs/pagoda/Pagoda.java | |||
| @@ -177,6 +177,12 @@ public class Pagoda implements Runnable { | |||
| 177 | return this; | 177 | return this; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | public PagodaBuilder skolem(Boolean isEnabled) { | ||
| 181 | if(instance == null) return null; | ||
| 182 | instance.properties.setUseSkolemUpperBound(isEnabled); | ||
| 183 | return this; | ||
| 184 | } | ||
| 185 | |||
| 180 | public Pagoda build() { | 186 | public Pagoda build() { |
| 181 | Pagoda builtInstance = instance; | 187 | Pagoda builtInstance = instance; |
| 182 | instance = null; | 188 | instance = null; |
diff --git a/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java b/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java index 479905d..2471c80 100644 --- a/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java +++ b/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java | |||
| @@ -10,6 +10,7 @@ import uk.ac.ox.cs.pagoda.query.GapByStore4ID; | |||
| 10 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 10 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| 11 | import uk.ac.ox.cs.pagoda.rules.DatalogProgram; | 11 | import uk.ac.ox.cs.pagoda.rules.DatalogProgram; |
| 12 | import uk.ac.ox.cs.pagoda.rules.Program; | 12 | import uk.ac.ox.cs.pagoda.rules.Program; |
| 13 | import uk.ac.ox.cs.pagoda.rules.approximators.SkolemTermsManager; | ||
| 13 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; | 14 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; |
| 14 | import uk.ac.ox.cs.pagoda.util.Timer; | 15 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 15 | import uk.ac.ox.cs.pagoda.util.Utility; | 16 | import uk.ac.ox.cs.pagoda.util.Utility; |
| @@ -216,6 +217,9 @@ public class MultiStageQueryEngine extends StageQueryEngine { | |||
| 216 | Utility.logDebug(name + " store after adding facts for violations: " + (tripleCount = | 217 | Utility.logDebug(name + " store after adding facts for violations: " + (tripleCount = |
| 217 | store.getTriplesCount()) + " (" + (tripleCount - oldTripleCount) + " new)"); | 218 | store.getTriplesCount()) + " (" + (tripleCount - oldTripleCount) + " new)"); |
| 218 | Utility.logDebug("Time to add triples for violations: " + subTimer.duration()); | 219 | Utility.logDebug("Time to add triples for violations: " + subTimer.duration()); |
| 220 | |||
| 221 | Utility.logDebug("Number of Skolem individuals: " + SkolemTermsManager.getInstance() | ||
| 222 | .getSkolemIndividualsCount()); | ||
| 219 | } | 223 | } |
| 220 | } catch(JRDFStoreException e) { | 224 | } catch(JRDFStoreException e) { |
| 221 | e.printStackTrace(); | 225 | e.printStackTrace(); |
diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java index 7f02741..5878a57 100644 --- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java +++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | |||
| @@ -2,6 +2,7 @@ package uk.ac.ox.cs.pagoda.query; | |||
| 2 | 2 | ||
| 3 | import com.google.gson.*; | 3 | import com.google.gson.*; |
| 4 | import com.google.gson.reflect.TypeToken; | 4 | import com.google.gson.reflect.TypeToken; |
| 5 | import org.apache.commons.lang.WordUtils; | ||
| 5 | import org.semanticweb.HermiT.model.*; | 6 | import org.semanticweb.HermiT.model.*; |
| 6 | import org.semanticweb.owlapi.model.*; | 7 | import org.semanticweb.owlapi.model.*; |
| 7 | import uk.ac.ox.cs.pagoda.hermit.DLClauseHelper; | 8 | import uk.ac.ox.cs.pagoda.hermit.DLClauseHelper; |
| @@ -713,7 +714,12 @@ public class QueryRecord extends Disposable { | |||
| 713 | FRAGMENT_REFINEMENT, | 714 | FRAGMENT_REFINEMENT, |
| 714 | SUMMARISATION, | 715 | SUMMARISATION, |
| 715 | DEPENDENCY, | 716 | DEPENDENCY, |
| 716 | FULL_REASONING | 717 | FULL_REASONING; |
| 718 | |||
| 719 | @Override | ||
| 720 | public String toString() { | ||
| 721 | return WordUtils.capitalizeFully(super.toString(), new char[]{'_'}).replace("_", ""); | ||
| 722 | } | ||
| 717 | } | 723 | } |
| 718 | 724 | ||
| 719 | /** | 725 | /** |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index e6e508a..e689de6 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | |||
| @@ -19,7 +19,6 @@ import uk.ac.ox.cs.pagoda.tracking.QueryTracker; | |||
| 19 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoder; | 19 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoder; |
| 20 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoderDisjVar1; | 20 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoderDisjVar1; |
| 21 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoderWithGap; | 21 | import uk.ac.ox.cs.pagoda.tracking.TrackingRuleEncoderWithGap; |
| 22 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; | ||
| 23 | import uk.ac.ox.cs.pagoda.util.Timer; | 22 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 24 | import uk.ac.ox.cs.pagoda.util.Utility; | 23 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 25 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; | 24 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; |
| @@ -192,7 +191,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 192 | OWLOntology relevantOntologySubset = extractRelevantOntologySubset(queryRecord); | 191 | OWLOntology relevantOntologySubset = extractRelevantOntologySubset(queryRecord); |
| 193 | // queryRecord.saveRelevantOntology("./fragment_query" + queryRecord.getQueryID() + ".owl"); | 192 | // queryRecord.saveRelevantOntology("./fragment_query" + queryRecord.getQueryID() + ".owl"); |
| 194 | 193 | ||
| 195 | if(PagodaProperties.getDefaultUseSkolemUpperBound() && | 194 | if(properties.getUseSkolemUpperBound() && |
| 196 | querySkolemisedRelevantSubset(relevantOntologySubset, queryRecord)) | 195 | querySkolemisedRelevantSubset(relevantOntologySubset, queryRecord)) |
| 197 | return; | 196 | return; |
| 198 | 197 | ||
| @@ -297,7 +296,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 297 | 296 | ||
| 298 | Tuple<String> extendedQueryTexts = queryRecord.getExtendedQueryText(); | 297 | Tuple<String> extendedQueryTexts = queryRecord.getExtendedQueryText(); |
| 299 | 298 | ||
| 300 | if(PagodaProperties.getDefaultUseAlwaysSimpleUpperBound() || lazyUpperStore == null) { | 299 | if(properties.getUseAlwaysSimpleUpperBound() || lazyUpperStore == null) { |
| 301 | Utility.logDebug("Tracking store"); | 300 | Utility.logDebug("Tracking store"); |
| 302 | if(queryUpperStore(trackingStore, queryRecord, extendedQueryTexts, Step.SIMPLE_UPPER_BOUND)) | 301 | if(queryUpperStore(trackingStore, queryRecord, extendedQueryTexts, Step.SIMPLE_UPPER_BOUND)) |
| 303 | return true; | 302 | return true; |
| @@ -369,8 +368,10 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 369 | new MultiStageQueryEngine("Relevant-store", true); // checkValidity is true | 368 | new MultiStageQueryEngine("Relevant-store", true); // checkValidity is true |
| 370 | 369 | ||
| 371 | relevantStore.importDataFromABoxOf(relevantSubset); | 370 | relevantStore.importDataFromABoxOf(relevantSubset); |
| 371 | String relevantOriginalMarkProgram = OWLHelper.getOriginalMarkProgram(relevantSubset); | ||
| 372 | 372 | ||
| 373 | int queryDependentMaxTermDepth = 5; // TODO make it dynamic | 373 | int queryDependentMaxTermDepth = 5; // TODO make it dynamic |
| 374 | relevantStore.materialise("Mark original individuals", relevantOriginalMarkProgram); | ||
| 374 | int materialisationTag = relevantStore.materialiseSkolemly(relevantProgram, null, | 375 | int materialisationTag = relevantStore.materialiseSkolemly(relevantProgram, null, |
| 375 | queryDependentMaxTermDepth); | 376 | queryDependentMaxTermDepth); |
| 376 | queryRecord.addProcessingTime(Step.SKOLEM_UPPER_BOUND, t.duration()); | 377 | queryRecord.addProcessingTime(Step.SKOLEM_UPPER_BOUND, t.duration()); |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java index eab6a1b..3a057ec 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java | |||
| @@ -193,6 +193,7 @@ public abstract class QueryReasoner extends Disposable { | |||
| 193 | if(!record.isProcessed()) | 193 | if(!record.isProcessed()) |
| 194 | evaluate(record); | 194 | evaluate(record); |
| 195 | Utility.logInfo("Total time to answer this query: " + t.duration()); | 195 | Utility.logInfo("Total time to answer this query: " + t.duration()); |
| 196 | Utility.logInfo("Difficulty of this query: " + record.getDifficulty()); | ||
| 196 | if(!fullReasoner && !record.isProcessed()) { | 197 | if(!fullReasoner && !record.isProcessed()) { |
| 197 | Utility.logInfo("The query has not been fully answered in " + t.duration() + " seconds."); | 198 | Utility.logInfo("The query has not been fully answered in " + t.duration() + " seconds."); |
| 198 | continue; | 199 | continue; |
diff --git a/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java b/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java index 44daf7a..a78aabe 100644 --- a/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java +++ b/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java | |||
| @@ -83,7 +83,7 @@ public class SkolemTermsManager { | |||
| 83 | /** | 83 | /** |
| 84 | * Get the number of individuals generated by this manager. | 84 | * Get the number of individuals generated by this manager. |
| 85 | */ | 85 | */ |
| 86 | public int getNumberOfSkolemisedIndividual() { | 86 | public int getSkolemIndividualsCount() { |
| 87 | return individualToDepth_map.keySet().size(); | 87 | return individualToDepth_map.keySet().size(); |
| 88 | } | 88 | } |
| 89 | 89 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/util/tuples/Tuple.java b/src/uk/ac/ox/cs/pagoda/util/tuples/Tuple.java index 9139a5d..0a5983c 100644 --- a/src/uk/ac/ox/cs/pagoda/util/tuples/Tuple.java +++ b/src/uk/ac/ox/cs/pagoda/util/tuples/Tuple.java | |||
| @@ -46,4 +46,9 @@ public class Tuple<T> implements Iterable<T> { | |||
| 46 | public int hashCode() { | 46 | public int hashCode() { |
| 47 | return elements.hashCode() + getClass().hashCode(); | 47 | return elements.hashCode() + getClass().hashCode(); |
| 48 | } | 48 | } |
| 49 | |||
| 50 | @Override | ||
| 51 | public String toString() { | ||
| 52 | return elements.toString(); | ||
| 53 | } | ||
| 49 | } | 54 | } |
