diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-19 13:35:52 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-19 13:35:52 +0100 |
| commit | 5d54af2638a53721b414a41356a93686a9616272 (patch) | |
| tree | e28c64b1887e7e964661d12d96df5b09abd4d9ee /test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | |
| parent | c7dbc7c61c7094ea4ec49bd630023f23b92fd9d1 (diff) | |
| download | ACQuA-5d54af2638a53721b414a41356a93686a9616272.tar.gz ACQuA-5d54af2638a53721b414a41356a93686a9616272.zip | |
Backup before changes in MyQueryReasoner.
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java')
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | 45 |
1 files changed, 27 insertions, 18 deletions
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 61235d3..23d79ab 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | |||
| @@ -6,48 +6,57 @@ import uk.ac.ox.cs.pagoda.Pagoda; | |||
| 6 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | 6 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; |
| 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; | 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; |
| 8 | 8 | ||
| 9 | import java.io.File; | ||
| 9 | import java.io.IOException; | 10 | import java.io.IOException; |
| 11 | import java.nio.file.Path; | ||
| 10 | import java.nio.file.Paths; | 12 | import java.nio.file.Paths; |
| 11 | 13 | ||
| 12 | import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; | 14 | import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; |
| 13 | 15 | ||
| 14 | public class TestPagodaUOBM { | 16 | public class TestPagodaUOBM { |
| 15 | 17 | ||
| 16 | public void test(int number) throws IOException { | 18 | |
| 19 | private static final int N_1 = 1; | ||
| 20 | private static final int N_2 = 10; | ||
| 21 | |||
| 22 | @DataProvider(name = "uobmNumbers") | ||
| 23 | public static Object[][] uobmNumbers() { | ||
| 24 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 25 | for(int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 26 | integers[i][0] = N_1 + i; | ||
| 27 | return integers; | ||
| 28 | } | ||
| 29 | |||
| 30 | public void answersCorrectness(int number) throws IOException { | ||
| 17 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 31 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 32 | Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 33 | new File(computedAnswers.toString()).deleteOnExit(); | ||
| 34 | |||
| 18 | Pagoda pagoda = Pagoda.builder() | 35 | Pagoda pagoda = Pagoda.builder() |
| 19 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | 36 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) |
| 20 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | 37 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) |
| 21 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) | 38 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) |
| 39 | .answer(computedAnswers) | ||
| 22 | .classify(true) | 40 | .classify(true) |
| 23 | .hermit(true) | 41 | .hermit(true) |
| 24 | .build(); | 42 | .build(); |
| 25 | CheckAnswersOverDataset.check(pagoda, | 43 | pagoda.run(); |
| 26 | Paths.get(ontoDir, "uobm/uobm" + number + ".json")); | ||
| 27 | } | ||
| 28 | 44 | ||
| 29 | @Test | 45 | String given_answers = "uobm/uobm" + number + ".json"; |
| 30 | public void test_1() throws IOException { | 46 | CheckAnswers.assertSameAnswers(computedAnswers, Paths.get(ontoDir, given_answers)); |
| 31 | test(1); | ||
| 32 | } | 47 | } |
| 33 | 48 | ||
| 34 | private static final int N_1 = 1; | 49 | @Test(groups = {"light"}) |
| 35 | private static final int N_2 = 10; | 50 | public void answersCorrectness_1() throws IOException { |
| 36 | 51 | answersCorrectness(1); | |
| 37 | @DataProvider(name = "uobmNumbers") | ||
| 38 | public static Object[][] uobmNumbers() { | ||
| 39 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 40 | for (int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 41 | integers[i][0]= N_1 + i; | ||
| 42 | return integers; | ||
| 43 | } | 52 | } |
| 44 | 53 | ||
| 45 | @Test(dataProvider = "uobmNumbers") | 54 | @Test(groups = {"heavy"}, dataProvider = "uobmNumbers") |
| 46 | public void justExecute(int number) { | 55 | public void justExecute(int number) { |
| 47 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 56 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 48 | PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | 57 | PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), |
| 49 | combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | 58 | combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), |
| 50 | combinePaths(ontoDir, "uobm/queries/test.sparql")); | 59 | combinePaths(ontoDir, "uobm/queries/answersCorrectness.sparql")); |
| 51 | } | 60 | } |
| 52 | 61 | ||
| 53 | } | 62 | } |
