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 | |
| parent | dcdf7f8062919e5746b0b15c77ba8279d5f526c1 (diff) | |
| download | ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.tar.gz ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.zip | |
Fixed marking original individuals in the relevant upper store.
| -rw-r--r-- | pom.xml | 10 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/Pagoda.java | 6 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java | 4 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | 8 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | 7 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java | 1 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java | 2 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/tuples/Tuple.java | 5 | ||||
| -rw-r--r-- | test/resources/ComparisonTests.xml | 24 | ||||
| -rw-r--r-- | test/resources/LightTests.xml | 4 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java | 60 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/util/TestUtil.java | 18 |
12 files changed, 132 insertions, 17 deletions
| @@ -172,11 +172,11 @@ | |||
| 172 | <artifactId>jrdfox</artifactId> | 172 | <artifactId>jrdfox</artifactId> |
| 173 | <version>1.0</version> | 173 | <version>1.0</version> |
| 174 | </dependency> | 174 | </dependency> |
| 175 | <!--<dependency>--> | 175 | <dependency> |
| 176 | <!--<groupId>commons-lang</groupId>--> | 176 | <groupId>commons-lang</groupId> |
| 177 | <!--<artifactId>commons-lang</artifactId>--> | 177 | <artifactId>commons-lang</artifactId> |
| 178 | <!--<version>2.1</version>--> | 178 | <version>2.1</version> |
| 179 | <!--</dependency>--> | 179 | </dependency> |
| 180 | <!--<dependency>--> | 180 | <!--<dependency>--> |
| 181 | <!--<groupId>org.codehaus.plexus</groupId>--> | 181 | <!--<groupId>org.codehaus.plexus</groupId>--> |
| 182 | <!--<artifactId>plexus-utils</artifactId>--> | 182 | <!--<artifactId>plexus-utils</artifactId>--> |
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 | } |
diff --git a/test/resources/ComparisonTests.xml b/test/resources/ComparisonTests.xml new file mode 100644 index 0000000..0095724 --- /dev/null +++ b/test/resources/ComparisonTests.xml | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
| 3 | |||
| 4 | <!-- | ||
| 5 | Compare different configurations of the system. | ||
| 6 | |||
| 7 | Actually it is not a great idea to test performances in this way, | ||
| 8 | because all the different configurations are executed on the same JVM. | ||
| 9 | --> | ||
| 10 | |||
| 11 | <suite name="ComparisonTests"> | ||
| 12 | <test name="comparison"> | ||
| 13 | <groups> | ||
| 14 | <run> | ||
| 15 | <include name="comparison"/> | ||
| 16 | </run> | ||
| 17 | </groups> | ||
| 18 | <classes> | ||
| 19 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/>--> | ||
| 20 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/>--> | ||
| 21 | <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaFLY"/> | ||
| 22 | </classes> | ||
| 23 | </test> | ||
| 24 | </suite> \ No newline at end of file | ||
diff --git a/test/resources/LightTests.xml b/test/resources/LightTests.xml index 859e3fa..8d9a700 100644 --- a/test/resources/LightTests.xml +++ b/test/resources/LightTests.xml | |||
| @@ -5,10 +5,10 @@ | |||
| 5 | <test name="light"> | 5 | <test name="light"> |
| 6 | <groups> | 6 | <groups> |
| 7 | <run> | 7 | <run> |
| 8 | <include name="light"/> | 8 | <!--<include name="light"/>--> |
| 9 | <include name="justExecute"/> | ||
| 9 | </run> | 10 | </run> |
| 10 | </groups> | 11 | </groups> |
| 11 | |||
| 12 | <classes> | 12 | <classes> |
| 13 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/>--> | 13 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/>--> |
| 14 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/>--> | 14 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/>--> |
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java index 4fdccf8..42827a0 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java | |||
| @@ -4,6 +4,7 @@ import org.testng.annotations.Test; | |||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | 4 | import uk.ac.ox.cs.pagoda.Pagoda; |
| 5 | import uk.ac.ox.cs.pagoda.query.CheckAnswers; | 5 | import uk.ac.ox.cs.pagoda.query.CheckAnswers; |
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; |
| 7 | import uk.ac.ox.cs.pagoda.util.Timer; | ||
| 7 | 8 | ||
| 8 | import java.io.File; | 9 | import java.io.File; |
| 9 | import java.io.IOException; | 10 | import java.io.IOException; |
| @@ -20,8 +21,8 @@ public class TestPagodaFLY { | |||
| 20 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); | 21 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); |
| 21 | 22 | ||
| 22 | Pagoda pagoda = Pagoda.builder() | 23 | Pagoda pagoda = Pagoda.builder() |
| 23 | .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) | 24 | .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) |
| 24 | .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql")) | 25 | .query(Paths.get(ontoDir, "fly/queries/fly.sparql")) |
| 25 | .answer(answers) | 26 | .answer(answers) |
| 26 | .classify(false) | 27 | .classify(false) |
| 27 | .hermit(true) | 28 | .hermit(true) |
| @@ -39,9 +40,10 @@ public class TestPagodaFLY { | |||
| 39 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); | 40 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); |
| 40 | 41 | ||
| 41 | Pagoda pagoda = Pagoda.builder() | 42 | Pagoda pagoda = Pagoda.builder() |
| 42 | .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_rolledUp.owl")) | 43 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) |
| 43 | .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly_rolledUp.sparql")) | 44 | .query(Paths.get(ontoDir, "fly/queries/fly_rolledUp.sparql")) |
| 44 | .answer(answers) | 45 | .answer(answers) |
| 46 | .answer(Paths.get("/home/alessandro/Desktop/answers.json")) | ||
| 45 | .classify(false) | 47 | .classify(false) |
| 46 | .hermit(true) | 48 | .hermit(true) |
| 47 | .build(); | 49 | .build(); |
| @@ -49,4 +51,54 @@ public class TestPagodaFLY { | |||
| 49 | pagoda.run(); | 51 | pagoda.run(); |
| 50 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | 52 | CheckAnswers.assertSameAnswers(answers, givenAnswers); |
| 51 | } | 53 | } |
| 54 | |||
| 55 | @Test(groups = {"light", "justExecute"}) | ||
| 56 | public void justExecute_newQueries() throws IOException { | ||
| 57 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 58 | |||
| 59 | Pagoda pagoda = Pagoda.builder() | ||
| 60 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 61 | // .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) | ||
| 62 | .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 63 | // .answer(Paths.get("/home/alessandro/Desktop/answers.json")) | ||
| 64 | .classify(false) | ||
| 65 | .hermit(true) | ||
| 66 | .skolem(false) | ||
| 67 | .build(); | ||
| 68 | |||
| 69 | pagoda.run(); | ||
| 70 | } | ||
| 71 | |||
| 72 | @Test(groups = {"light", "comparison"}) | ||
| 73 | public void compare_newQueries() throws IOException { | ||
| 74 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 75 | |||
| 76 | Timer timer = new Timer(); | ||
| 77 | Pagoda.builder() | ||
| 78 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 79 | .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 80 | .classify(false) | ||
| 81 | .hermit(true) | ||
| 82 | .skolem(true) // <----<< Skolem upper bound is ENABLED <<< | ||
| 83 | .build() | ||
| 84 | .run(); | ||
| 85 | double t1 = timer.duration(); | ||
| 86 | |||
| 87 | timer.reset(); | ||
| 88 | |||
| 89 | Pagoda.builder() | ||
| 90 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 91 | .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 92 | .classify(false) | ||
| 93 | .hermit(true) | ||
| 94 | .skolem(false) // <----<< Skolem upper bound is DISABLED <<< | ||
| 95 | .build() | ||
| 96 | .run(); | ||
| 97 | double t2 = timer.duration(); | ||
| 98 | |||
| 99 | if(t1 < t2) | ||
| 100 | TestUtil.logInfo("Overall reasoning with Skolem upper bound was " + (int) (t2 / t1 * 100 - 100) + "x faster!"); | ||
| 101 | else | ||
| 102 | TestUtil.logInfo("Overall reasoning with Skolem upper bound was " + (int) (t1 / t2 * 100 - 100) + "x slower..."); | ||
| 103 | } | ||
| 52 | } | 104 | } |
diff --git a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java index c3909d5..fdd242a 100644 --- a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java +++ b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java | |||
| @@ -22,7 +22,7 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; | |||
| 22 | public class TestUtil { | 22 | public class TestUtil { |
| 23 | 23 | ||
| 24 | public static final String CONFIG_FILE = "test.properties"; | 24 | public static final String CONFIG_FILE = "test.properties"; |
| 25 | 25 | private static final Logger LOGGER = Logger.getLogger("Tester"); | |
| 26 | private static boolean isConfigLoaded = false; | 26 | private static boolean isConfigLoaded = false; |
| 27 | private static Properties config; | 27 | private static Properties config; |
| 28 | 28 | ||
| @@ -71,4 +71,20 @@ public class TestUtil { | |||
| 71 | return Paths.get(givenAnswersURL.getPath()); | 71 | return Paths.get(givenAnswersURL.getPath()); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | public static void logInfo(Object msg) { | ||
| 75 | LOGGER.info(msg); | ||
| 76 | } | ||
| 77 | |||
| 78 | public static void logDebug(Object msg) { | ||
| 79 | LOGGER.debug(msg); | ||
| 80 | } | ||
| 81 | |||
| 82 | public static void logError(Object msg) { | ||
| 83 | LOGGER.error(msg); | ||
| 84 | } | ||
| 85 | |||
| 86 | public static void logError(Object msg, Throwable t) { | ||
| 87 | LOGGER.error(msg, t); | ||
| 88 | } | ||
| 89 | |||
| 74 | } | 90 | } |
