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 /test | |
| parent | dcdf7f8062919e5746b0b15c77ba8279d5f526c1 (diff) | |
| download | ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.tar.gz ACQuA-6e8ee40e41d84e0466153802a2c9b4ae88af3544.zip | |
Fixed marking original individuals in the relevant upper store.
Diffstat (limited to 'test')
| -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 |
4 files changed, 99 insertions, 7 deletions
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 | } |
