From 6e8ee40e41d84e0466153802a2c9b4ae88af3544 Mon Sep 17 00:00:00 2001 From: RncLsn Date: Tue, 9 Jun 2015 18:23:15 +0100 Subject: Fixed marking original individuals in the relevant upper store. --- .../ox/cs/pagoda/global_tests/TestPagodaFLY.java | 60 ++++++++++++++++++++-- test/uk/ac/ox/cs/pagoda/util/TestUtil.java | 18 ++++++- 2 files changed, 73 insertions(+), 5 deletions(-) (limited to 'test/uk/ac/ox') 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; import uk.ac.ox.cs.pagoda.Pagoda; import uk.ac.ox.cs.pagoda.query.CheckAnswers; import uk.ac.ox.cs.pagoda.util.TestUtil; +import uk.ac.ox.cs.pagoda.util.Timer; import java.io.File; import java.io.IOException; @@ -20,8 +21,8 @@ public class TestPagodaFLY { Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); Pagoda pagoda = Pagoda.builder() - .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) - .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql")) + .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) @@ -39,9 +40,10 @@ public class TestPagodaFLY { Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); Pagoda pagoda = Pagoda.builder() - .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_rolledUp.owl")) - .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly_rolledUp.sparql")) + .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(); @@ -49,4 +51,54 @@ public class TestPagodaFLY { 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..."); + } } 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; public class TestUtil { public static final String CONFIG_FILE = "test.properties"; - + private static final Logger LOGGER = Logger.getLogger("Tester"); private static boolean isConfigLoaded = false; private static Properties config; @@ -71,4 +71,20 @@ public class TestUtil { return Paths.get(givenAnswersURL.getPath()); } + public static void logInfo(Object msg) { + LOGGER.info(msg); + } + + public static void logDebug(Object msg) { + LOGGER.debug(msg); + } + + public static void logError(Object msg) { + LOGGER.error(msg); + } + + public static void logError(Object msg, Throwable t) { + LOGGER.error(msg, t); + } + } -- cgit v1.2.3