aboutsummaryrefslogtreecommitdiff
path: root/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java')
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java35
1 files changed, 25 insertions, 10 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
index bb58681..8cbe022 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
@@ -4,42 +4,57 @@ import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda; 4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil; 5import uk.ac.ox.cs.pagoda.util.TestUtil;
6 6
7import java.io.File;
7import java.io.IOException; 8import java.io.IOException;
9import java.nio.file.Path;
8import java.nio.file.Paths; 10import java.nio.file.Paths;
9 11
10public class TestPagodaLUBM { 12public class TestPagodaLUBM {
11 13
12 public void test(int number) throws IOException { 14 /**
15 * Just execute on LUBM 100
16 */
17 public static void main(String... args) {
18 new TestPagodaLUBM().justExecute_100();
19 }
20
21 public void answersCorrecntess(int number) throws IOException {
13 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 22 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
23 Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
24 new File(computedAnswers.toString()).deleteOnExit();
25
14 Pagoda pagoda = Pagoda.builder() 26 Pagoda pagoda = Pagoda.builder()
15 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) 27 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
16 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) 28 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
17 .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) 29 .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
30 .answer(computedAnswers)
18 .classify(true) 31 .classify(true)
19 .hermit(true) 32 .hermit(true)
20 .build(); 33 .build();
21 CheckAnswersOverDataset.check(pagoda, Paths.get(ontoDir, "lubm/lubm" + number + ".json")); 34 pagoda.run();
35
36 Path givenAnswers = Paths.get(ontoDir, "lubm/lubm" + number + ".json");
37 CheckAnswers.assertSameAnswers(computedAnswers, givenAnswers);
22 } 38 }
23 39
24 @Test 40 @Test(groups = {"light"})
25 public void test_1() throws IOException { 41 public void answersCorrectness_1() throws IOException {
26 test(1); 42 answersCorrecntess(1);
27 } 43 }
28 44
45 /**
46 * Just execute on LUBM 100
47 * */
29 public void justExecute_100() { 48 public void justExecute_100() {
30 int number = 100; 49 int number = 100;
31 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 50 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
32 Pagoda pagoda = Pagoda.builder() 51 Pagoda pagoda = Pagoda.builder()
33 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) 52 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
34 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) 53 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
35 .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) 54 .query(Paths.get(ontoDir, "lubm/queries/answersCorrectness.sparql"))
36 .classify(true) 55 .classify(true)
37 .hermit(true) 56 .hermit(true)
38 .build(); 57 .build();
39 pagoda.run(); 58 pagoda.run();
40 } 59 }
41
42 public static void main(String... args) {
43 new TestPagodaLUBM().justExecute_100();
44 }
45} 60}