From 3a276b7c7836e56a171ab753b018913ce022ba8e Mon Sep 17 00:00:00 2001 From: RncLsn Date: Wed, 10 Jun 2015 17:12:36 +0100 Subject: Small changes. --- .../ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | 2 +- test/resources/LightTests.xml | 4 +- .../ox/cs/pagoda/global_tests/TestPagodaFLY.java | 177 +++++++++++---------- .../ox/cs/pagoda/global_tests/TestPagodaUOBM.java | 17 +- 4 files changed, 108 insertions(+), 92 deletions(-) diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index e689de6..93fbc98 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java @@ -370,7 +370,7 @@ class MyQueryReasoner extends QueryReasoner { relevantStore.importDataFromABoxOf(relevantSubset); String relevantOriginalMarkProgram = OWLHelper.getOriginalMarkProgram(relevantSubset); - int queryDependentMaxTermDepth = 5; // TODO make it dynamic + int queryDependentMaxTermDepth = 10; // TODO make it dynamic relevantStore.materialise("Mark original individuals", relevantOriginalMarkProgram); int materialisationTag = relevantStore.materialiseSkolemly(relevantProgram, null, queryDependentMaxTermDepth); diff --git a/test/resources/LightTests.xml b/test/resources/LightTests.xml index 8d9a700..2bc8dac 100644 --- a/test/resources/LightTests.xml +++ b/test/resources/LightTests.xml @@ -10,10 +10,10 @@ - + - + \ No newline at end of file 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 42827a0..a0ccb1a 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java @@ -13,92 +13,93 @@ import java.nio.file.Paths; public class TestPagodaFLY { - // @Test(groups = {"light"}) - public void answersCorrectness_withGJFC() throws IOException { - String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); - Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); - new File(answers.toString()).deleteOnExit(); - Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); - - Pagoda pagoda = Pagoda.builder() - .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) - .query(Paths.get(ontoDir, "fly/queries/fly.sparql")) - .answer(answers) - .classify(false) - .hermit(true) - .build(); - - pagoda.run(); - CheckAnswers.assertSameAnswers(answers, givenAnswers); - } - - @Test(groups = {"light"}) - public void answersCorrectness_rolledUp() throws IOException { - String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); - Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); - new File(answers.toString()).deleteOnExit(); - Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); - - Pagoda pagoda = Pagoda.builder() - .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) - .query(Paths.get(ontoDir, "fly/queries/fly_rolledUp.sparql")) - .answer(answers) - .answer(Paths.get("/home/alessandro/Desktop/answers.json")) - .classify(false) - .hermit(true) - .build(); - - pagoda.run(); - CheckAnswers.assertSameAnswers(answers, givenAnswers); - } - - @Test(groups = {"light", "justExecute"}) - public void justExecute_newQueries() throws IOException { - String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); - - Pagoda pagoda = Pagoda.builder() - .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) -// .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) - .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) -// .answer(Paths.get("/home/alessandro/Desktop/answers.json")) - .classify(false) - .hermit(true) - .skolem(false) - .build(); - - pagoda.run(); - } - - @Test(groups = {"light", "comparison"}) - public void compare_newQueries() throws IOException { - String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); - - Timer timer = new Timer(); - Pagoda.builder() - .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) - .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) - .classify(false) - .hermit(true) - .skolem(true) // <----<< Skolem upper bound is ENABLED <<< - .build() - .run(); - double t1 = timer.duration(); - - timer.reset(); - - Pagoda.builder() - .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) - .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) - .classify(false) - .hermit(true) - .skolem(false) // <----<< Skolem upper bound is DISABLED <<< - .build() - .run(); - double t2 = timer.duration(); - - if(t1 < t2) - TestUtil.logInfo("Overall reasoning with Skolem upper bound was " + (int) (t2 / t1 * 100 - 100) + "x faster!"); - else - TestUtil.logInfo("Overall reasoning with Skolem upper bound was " + (int) (t1 / t2 * 100 - 100) + "x slower..."); - } + // @Test(groups = {"light"}) + public void answersCorrectness_withGJFC() throws IOException { + String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); + new File(answers.toString()).deleteOnExit(); + Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); + + Pagoda pagoda = Pagoda.builder() + .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) + .query(Paths.get(ontoDir, "fly/queries/fly.sparql")) + .answer(answers) + .classify(false) + .hermit(true) + .build(); + + pagoda.run(); + CheckAnswers.assertSameAnswers(answers, givenAnswers); + } + + @Test(groups = {"light"}) + public void answersCorrectness_rolledUp() throws IOException { + String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); + new File(answers.toString()).deleteOnExit(); + Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); + + Pagoda pagoda = Pagoda.builder() + .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) + .query(Paths.get(ontoDir, "fly/queries/fly_rolledUp.sparql")) + .answer(answers) + .answer(Paths.get("/home/alessandro/Desktop/answers.json")) + .classify(false) + .hermit(true) + .build(); + + pagoda.run(); + CheckAnswers.assertSameAnswers(answers, givenAnswers); + } + + @Test(groups = {"light", "justExecute"}) + public void justExecute_newQueries() throws IOException { + String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + + Pagoda.builder() + .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) +// .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) + .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) +// .answer(Paths.get("/home/alessandro/Desktop/answers.json")) + .classify(false) + .hermit(true) + .skolem(true) + .build() + .run(); + } + + @Test(groups = {"light", "comparison"}) + public void compare_newQueries() throws IOException { + String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + + Timer timer = new Timer(); + Pagoda.builder() + .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) + .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) + .classify(false) + .hermit(true) + .skolem(true) // <----<< Skolem upper bound is ENABLED <<< + .build() + .run(); + double t1 = timer.duration(); + + timer.reset(); + + Pagoda.builder() + .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) + .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) + .classify(false) + .hermit(true) + .skolem(false) // <----<< Skolem upper bound is DISABLED <<< + .build() + .run(); + double t2 = timer.duration(); + + if(t1 < t2) + TestUtil.logInfo( + "Overall reasoning with Skolem upper bound was " + (int) (t2 / t1 * 100 - 100) + "x faster!"); + else + TestUtil.logInfo( + "Overall reasoning with Skolem upper bound was " + (int) (t1 / t2 * 100 - 100) + "x slower..."); + } } diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java index bdfb818..1d9f1e6 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java @@ -79,7 +79,7 @@ public class TestPagodaUOBM { answersCorrectness_sygenia(1); } - @Test(groups = {"heavy",}, dataProvider = "UOBMNumbers") + @Test(groups = {"heavy"}, dataProvider = "UOBMNumbers") public void answersCorrectness_sygenia_allBlanks(int number) throws IOException { String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); // Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); @@ -99,4 +99,19 @@ public class TestPagodaUOBM { // CheckAnswers.assertSameAnswers(answers, givenAnswers); } + @Test(groups = {"justExecute"}) + public void justExecute_existentialQueries() throws IOException { + String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); + + Pagoda.builder() + .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) + .data(Paths.get(ontoDir, "uobm/data/uobm1.ttl")) + .query(Paths.get(ontoDir, "uobm/queries/existential_queries.sparql")) +// .answer(answers) + .classify(true) + .hermit(true) + .skolem(false) + .build() + .run(); + } } -- cgit v1.2.3