aboutsummaryrefslogtreecommitdiff
path: root/test/uk/ac/ox/cs
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-05-18 18:27:32 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-05-18 18:27:32 +0100
commitc7dbc7c61c7094ea4ec49bd630023f23b92fd9d1 (patch)
tree45ff5a535e7d519b58d60c0c214a1f9ecc5a35ef /test/uk/ac/ox/cs
parent1b6a128137e5d7a6ff75566869232fc054afabef (diff)
downloadACQuA-c7dbc7c61c7094ea4ec49bd630023f23b92fd9d1.tar.gz
ACQuA-c7dbc7c61c7094ea4ec49bd630023f23b92fd9d1.zip
Configured Maven and improved executable class and tests.
Diffstat (limited to 'test/uk/ac/ox/cs')
-rw-r--r--test/uk/ac/ox/cs/hermit/JAIR_HermiT.java69
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java (renamed from test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java)19
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java2
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java64
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java30
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java20
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java25
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java24
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java46
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java30
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java20
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java33
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java28
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java45
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java38
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java (renamed from test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java)30
-rw-r--r--test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java470
-rw-r--r--test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java39
-rw-r--r--test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java276
-rw-r--r--test/uk/ac/ox/cs/pagoda/util/TestUtil.java7
20 files changed, 221 insertions, 1094 deletions
diff --git a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
index 2fc478d..a3264ba 100644
--- a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
+++ b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
@@ -1,17 +1,17 @@
1package uk.ac.ox.cs.hermit; 1package uk.ac.ox.cs.hermit;
2 2
3import org.junit.Test; 3import org.junit.Test;
4 4import uk.ac.ox.cs.pagoda.util.TestUtil;
5import uk.ac.ox.cs.pagoda.tester.PagodaTester;
6 5
7public class JAIR_HermiT { 6public class JAIR_HermiT {
8 7
9 @Test 8 @Test
10 public void lubm1() throws Exception { 9 public void lubm1() throws Exception {
10 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
11 String[] args = new String[] { 11 String[] args = new String[] {
12 PagodaTester.onto_dir + "lubm/univ-bench.owl", 12 TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
13 PagodaTester.onto_dir + "lubm/data/lubm1_owl", 13 TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"),
14 PagodaTester.onto_dir + "lubm/queries/test.sparql" 14 TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql")
15// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit" 15// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit"
16 }; 16 };
17 HermitQueryReasoner.main(args); 17 HermitQueryReasoner.main(args);
@@ -19,10 +19,11 @@ public class JAIR_HermiT {
19 19
20 @Test 20 @Test
21 public void lubm1_rolledUp() throws Exception { 21 public void lubm1_rolledUp() throws Exception {
22 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
22 String[] args = new String[] { 23 String[] args = new String[] {
23 "/home/yzhou/backup/20141212/univ-bench-queries.owl", 24 "/home/yzhou/backup/20141212/univ-bench-queries.owl",
24 PagodaTester.onto_dir + "lubm/data/lubm1_owl", 25 TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"),
25 PagodaTester.onto_dir + "lubm/queries/atomic_lubm.sparql" 26 TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql")
26// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit_rolledUp" 27// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit_rolledUp"
27 }; 28 };
28 HermitQueryReasoner.main(args); 29 HermitQueryReasoner.main(args);
@@ -30,10 +31,11 @@ public class JAIR_HermiT {
30 31
31 @Test 32 @Test
32 public void uobm1() throws Exception { 33 public void uobm1() throws Exception {
34 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
33 String[] args = new String[] { 35 String[] args = new String[] {
34 PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", 36 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
35 PagodaTester.onto_dir + "uobm/data/uobm1_owl_withDeclaration", 37 TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"),
36 PagodaTester.onto_dir + "uobm/queries/standard.sparql" 38 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
37// , "hermit_uobm1.out" 39// , "hermit_uobm1.out"
38// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit" 40// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit"
39 }; 41 };
@@ -42,10 +44,11 @@ public class JAIR_HermiT {
42 44
43 @Test 45 @Test
44 public void uobm1_rolledUp() throws Exception { 46 public void uobm1_rolledUp() throws Exception {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
45 String[] args = new String[] { 48 String[] args = new String[] {
46 "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", 49 "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl",
47 PagodaTester.onto_dir + "uobm/data/uobm1_owl_withDeclaration", 50 TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"),
48 PagodaTester.onto_dir + "uobm/queries/atomic_uobm.sparql" 51 TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql")
49 , "hermit_uobm1_rolledUp.out" 52 , "hermit_uobm1_rolledUp.out"
50// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit_rolledUp" 53// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit_rolledUp"
51 }; 54 };
@@ -54,21 +57,23 @@ public class JAIR_HermiT {
54 57
55 @Test 58 @Test
56 public void fly_rolledUp() throws Exception { 59 public void fly_rolledUp() throws Exception {
60 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
57 HermitQueryReasoner.main( 61 HermitQueryReasoner.main(
58 PagodaTester.onto_dir + "fly/fly-all-in-one_rolledUp.owl", 62 TestUtil.combinePaths(ontoDir, "fly/fly-all-in-one_rolledUp.owl"),
59// PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", 63// TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl",
60 null, 64 null,
61 PagodaTester.onto_dir + "fly/queries/fly_atomic.sparql" 65 TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql")
62 , "hermit_fly.out" 66 , "hermit_fly.out"
63 ); 67 );
64 } 68 }
65 69
66 @Test 70 @Test
67 public void npd() throws Exception { 71 public void npd() throws Exception {
72 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
68 HermitQueryReasoner.main( 73 HermitQueryReasoner.main(
69 PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", 74 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
70 PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", 75 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
71 PagodaTester.onto_dir + "npd/queries/atomic_ground.sparql" 76 TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql")
72 , "hermit_npd.out" 77 , "hermit_npd.out"
73// , "/home/yzhou/java-workspace/test-share/results_new/npd/hermit" 78// , "/home/yzhou/java-workspace/test-share/results_new/npd/hermit"
74 ); 79 );
@@ -76,31 +81,34 @@ public class JAIR_HermiT {
76 81
77 @Test 82 @Test
78 public void dbpedia() throws Exception { 83 public void dbpedia() throws Exception {
84 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
79 HermitQueryReasoner.main( 85 HermitQueryReasoner.main(
80 PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", 86 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
81 PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", 87 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
82 PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" 88 TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql")
83 , "/home/yzhou/java-workspace/test-share/results_new/dbpedia/hermit" 89 , "/home/yzhou/java-workspace/test-share/results_new/dbpedia/hermit"
84 ); 90 );
85 } 91 }
86 92
87 @Test 93 @Test
88 public void reactome() throws Exception { 94 public void reactome() throws Exception {
95 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
89 HermitQueryReasoner.main( 96 HermitQueryReasoner.main(
90 PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", 97 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"),
91 PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl", 98 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"),
92 PagodaTester.onto_dir + "bio2rdf/reactome/queries/atomic_ground.sparql" 99 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql")
93 , "/home/yzhou/java-workspace/test-share/results_new/reactome/hermit_10p" 100 , "/home/yzhou/java-workspace/test-share/results_new/reactome/hermit_10p"
94 ); 101 );
95 } 102 }
96 103
97 @Test 104 @Test
98 public void chembl() throws Exception { 105 public void chembl() throws Exception {
106 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
99 HermitQueryReasoner.main( 107 HermitQueryReasoner.main(
100 PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", 108 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"),
101// null, 109// null,
102 PagodaTester.onto_dir + "bio2rdf/chembl/graph sampling/sample_1.nt", 110 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"),
103 PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" 111 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql")
104 , "hermit_chembl.out" 112 , "hermit_chembl.out"
105// , "/home/yzhou/java-workspace/test-share/results_new/chembl/hermit_1p" 113// , "/home/yzhou/java-workspace/test-share/results_new/chembl/hermit_1p"
106 ); 114 );
@@ -108,10 +116,11 @@ public class JAIR_HermiT {
108 116
109 @Test 117 @Test
110 public void uniprot() throws Exception { 118 public void uniprot() throws Exception {
119 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
111 HermitQueryReasoner.main( 120 HermitQueryReasoner.main(
112 PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat.owl", 121 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat.owl"),
113 PagodaTester.onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt", 122 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"),
114 PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" 123 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql")
115 , "hermit_uniprot.out" 124 , "hermit_uniprot.out"
116// , "/home/yzhou/java-workspace/test-share/results_new/uniprot/hermit_1p" 125// , "/home/yzhou/java-workspace/test-share/results_new/uniprot/hermit_1p"
117 ); 126 );
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java
index dff2366..424afa2 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java
@@ -2,11 +2,9 @@ package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import com.google.gson.Gson; 3import com.google.gson.Gson;
4import com.google.gson.reflect.TypeToken; 4import com.google.gson.reflect.TypeToken;
5import org.apache.log4j.Level;
6import org.testng.Assert; 5import org.testng.Assert;
6import uk.ac.ox.cs.pagoda.Pagoda;
7import uk.ac.ox.cs.pagoda.query.QueryRecord; 7import uk.ac.ox.cs.pagoda.query.QueryRecord;
8import uk.ac.ox.cs.pagoda.tester.PagodaTester;
9import uk.ac.ox.cs.pagoda.util.Utility;
10 8
11import java.io.BufferedReader; 9import java.io.BufferedReader;
12import java.io.File; 10import java.io.File;
@@ -18,18 +16,17 @@ import java.nio.file.Paths;
18import java.util.Set; 16import java.util.Set;
19 17
20/** 18/**
21 * This is a unit test for TestNG. 19 * Given an instance of Pagoda, it checks the returned answers.
22 * <p>
23 * It tests the correctness on the final output.
24 * */ 20 * */
25public class TestGlobalCorrectness { 21public class CheckAnswersOverDataset {
26 22
27 public static void test(Path ontology, Path data, Path queries, Path givenAnswers) { 23 public static void check(Pagoda pagoda, Path givenAnswers) {
28 try { 24 try {
29 Utility.setLogLevel(Level.DEBUG); 25// Utility.setLogLevel(Level.DEBUG); // uncomment for outputting partial results
30 Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); 26 Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
31 new File(computedAnswers.toString()).deleteOnExit(); 27 new File(computedAnswers.toString()).deleteOnExit();
32 PagodaTester.main(ontology.toString(), data.toString(), queries.toString(), computedAnswers.toString()); 28
29 pagoda.run();
33 assertSameContent(computedAnswers, givenAnswers); 30 assertSameContent(computedAnswers, givenAnswers);
34 } catch (IOException e) { 31 } catch (IOException e) {
35 e.printStackTrace(); 32 e.printStackTrace();
@@ -48,6 +45,4 @@ public class TestGlobalCorrectness {
48 45
49 Assert.assertEquals(computedAnswers, givenAnswers); 46 Assert.assertEquals(computedAnswers, givenAnswers);
50 } 47 }
51
52
53} 48}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
index cdf55bd..687ffee 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
@@ -84,7 +84,7 @@ public class JAIR_Scalability {
84 } 84 }
85 85
86 public static void main(String... args) throws IOException { 86 public static void main(String... args) throws IOException {
87 Properties.ShellModeDefault = true; 87 Properties.shellModeDefault = true;
88 new JAIR_Scalability().testUniProt(50, false); 88 new JAIR_Scalability().testUniProt(50, false);
89 } 89 }
90 90
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
index 3ee268e..b073a26 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
@@ -1,67 +1,17 @@
1package uk.ac.ox.cs.pagoda.global_tests; 1package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import org.junit.Test; 3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6 4
7import java.io.IOException; 5import java.io.IOException;
8 6
9public class LightEvaluation { 7public class LightEvaluation {
10 8
11 @Test 9 @Test
12 public void uobm1() throws IOException { 10 public void evaluation() throws IOException {
13 int number = 1; 11 new TestPagodaUOBM().test(1);
14 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 12 new TestPagodaLUBM().test(100);
15 PagodaTester.main( 13 new TestPagodaFLY().test();
16 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), 14 new TestPagodaDBPedia().test();
17 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), 15 new TestPagodaNPD().testNPDwithoutDataType();
18 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
19 );
20 TestUtil.copyFile("log4j.log", "output/jair/uobm1.out");
21 } 16 }
22
23 @Test
24 public void lubm100() throws IOException {
25 int number = 100;
26 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
27 PagodaTester.main(
28 TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
29 TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"),
30 TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql")
31 );
32 TestUtil.copyFile("log4j.log", "results-backup/current/lubm100.out");
33 }
34
35 @Test
36 public void fly() throws IOException {
37 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
38 PagodaTester.main(
39 TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"),
40 TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql")
41 );
42 TestUtil.copyFile("log4j.log", "results-backup/current/fly.out");
43 }
44
45 @Test
46 public void dbpedia() throws IOException {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
48 PagodaTester.main(
49 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
50 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
51 TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql")
52 );
53 TestUtil.copyFile("log4j.log", "results-backup/current/dbpedia.out");
54 }
55
56 @Test
57 public void npdWithoutDataType() throws IOException {
58 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
59 PagodaTester.main(
60 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
61 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
62 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
63 );
64 TestUtil.copyFile("log4j.log", "results-backup/current/npd_minus.out");
65 }
66
67} 17}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java
deleted file mode 100644
index 2b9cdbd..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java
+++ /dev/null
@@ -1,30 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaDBPedia {
13
14 @Test
15 public void test() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
19 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
20 TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/dbpedia.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/dbpedia.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java
deleted file mode 100644
index da059f9..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java
+++ /dev/null
@@ -1,20 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaELU {
8
9 @Test void test() {
10 int number = 1;
11 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
12 PagodaTester.main(
13 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
14 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
15 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
16 );
17 }
18
19
20}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java
deleted file mode 100644
index d558e0f..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java
+++ /dev/null
@@ -1,25 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaFLY {
8
9 @Test
10 public void test() {
11 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
12 PagodaTester.main(
13 TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"),
14 TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql")
15 );
16
17// Statistics stat = new Statistics("output/log4j.log");
18// String diff = stat.diff("results-backup/benchmark/fly.out");
19// AllTests.copy("output/log4j.log", "results-backup/current/fly.out");
20// if (!diff.isEmpty())
21// fail(diff);
22 }
23
24
25}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java
deleted file mode 100644
index 2014ec1..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java
+++ /dev/null
@@ -1,24 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.util.TestUtil;
5
6import java.io.IOException;
7import java.nio.file.Paths;
8
9public class PagodaLUBM {
10
11 private void testN(int number ) throws IOException {
12 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
13 TestGlobalCorrectness.test(Paths.get(ontoDir, "lubm/univ-bench.owl"),
14 Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"),
15 Paths.get(ontoDir, "lubm/queries/test.sparql"),
16 Paths.get(ontoDir, "lubm/lubm" + number + ".json"));
17 }
18
19 @Test
20 public void test1() throws IOException {
21 testN(1);
22 }
23
24}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java
deleted file mode 100644
index 17d1e82..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java
+++ /dev/null
@@ -1,46 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaNPD {
13
14 @Test
15 public void testNPDwithoutDataType() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
19 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
20 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/npd_minus.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd_minus.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30 @Test
31 public void testNPD() throws IOException {
32 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
33 PagodaTester.main(
34 TestUtil.combinePaths(ontoDir, "npd/npd-all.owl"),
35 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-processed.ttl"),
36 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
37 );
38
39 Statistics stat = new Statistics("output/log4j.log");
40 String diff = stat.diff("results-backup/benchmark/npd.out");
41 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd.out");
42 if (!diff.isEmpty())
43 fail(diff);
44 }
45
46}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java
deleted file mode 100644
index c908cb4..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java
+++ /dev/null
@@ -1,30 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaNPD_bench {
13
14 @Test
15 public void test() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.owl"),
19 TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.ttl"),
20 TestUtil.combinePaths(ontoDir, "npd-benchmark/queries/all.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/npd-bench.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd-bench.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java
deleted file mode 100644
index 88e0835..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java
+++ /dev/null
@@ -1,20 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaRLU {
8
9 @Test
10 public void testRL() {
11 int number = 1;
12 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
13 PagodaTester.main(
14 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
15 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
16 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
17 );
18 }
19
20}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java
new file mode 100644
index 0000000..04c9f3b
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java
@@ -0,0 +1,33 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaDBPedia {
11
12 public static final String ANSWER_PATH = "~/TestPagodaDEBPedia.json";
13
14 @Test
15 public void just_execute() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 Pagoda pagoda = Pagoda.builder()
18 .ontology(Paths.get(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"))
19 .data(Paths.get(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"))
20 .query(Paths.get(ontoDir, "dbpedia/atomic.sparql"))
21 .answer(ANSWER_PATH)
22 .classify(true)
23 .hermit(true)
24 .build();
25 pagoda.run();
26 }
27
28 @Test
29 public void test() {
30 // TODO implement
31 }
32
33}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java
new file mode 100644
index 0000000..623034e
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java
@@ -0,0 +1,28 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class TestPagodaFLY {
8
9 public static final String ANSWER_PATH = "~/TestPagodaFLY.json";
10
11 @Test
12 public void just_execute() {
13 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
14 Pagoda pagoda = Pagoda.builder()
15 .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"))
16 .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql"))
17// .answer(ANSWER_PATH)
18 .classify(true)
19 .hermit(true)
20 .build();
21 pagoda.run();
22 }
23
24 @Test
25 public void test() {
26 // TODO implement
27 }
28}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
new file mode 100644
index 0000000..bb58681
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
@@ -0,0 +1,45 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaLUBM {
11
12 public void test(int number) throws IOException {
13 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
14 Pagoda pagoda = Pagoda.builder()
15 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
16 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
17 .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
18 .classify(true)
19 .hermit(true)
20 .build();
21 CheckAnswersOverDataset.check(pagoda, Paths.get(ontoDir, "lubm/lubm" + number + ".json"));
22 }
23
24 @Test
25 public void test_1() throws IOException {
26 test(1);
27 }
28
29 public void justExecute_100() {
30 int number = 100;
31 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
32 Pagoda pagoda = Pagoda.builder()
33 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
34 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
35 .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
36 .classify(true)
37 .hermit(true)
38 .build();
39 pagoda.run();
40 }
41
42 public static void main(String... args) {
43 new TestPagodaLUBM().justExecute_100();
44 }
45}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java
new file mode 100644
index 0000000..939ee6e
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java
@@ -0,0 +1,38 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaNPD {
11
12 public static final String ANSWER_PATH = "~/PagodaNPDWithoutDatatype.json";
13
14 @Test
15 public void justExecuteNPDWithoutDataType() {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 Pagoda pagoda = Pagoda.builder()
18 .ontology(Paths.get(ontoDir, "npd/npd-all-minus-datatype.owl"))
19 .data(Paths.get(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"))
20 .query(Paths.get(ontoDir, "npd/queries/atomic.sparql"))
21 .answer(ANSWER_PATH)
22 .classify(true)
23 .hermit(true)
24 .build();
25 pagoda.run();
26 }
27
28 @Test
29 public void testNPDwithoutDataType() throws IOException {
30 // TODO implement
31 }
32
33 @Test
34 public void testNPD() throws IOException {
35 // TODO implement
36 }
37
38}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java
index 065fb29..61235d3 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java
@@ -2,6 +2,7 @@ package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import org.testng.annotations.DataProvider; 3import org.testng.annotations.DataProvider;
4import org.testng.annotations.Test; 4import org.testng.annotations.Test;
5import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.tester.PagodaTester; 6import uk.ac.ox.cs.pagoda.tester.PagodaTester;
6import uk.ac.ox.cs.pagoda.util.TestUtil; 7import uk.ac.ox.cs.pagoda.util.TestUtil;
7 8
@@ -10,25 +11,29 @@ import java.nio.file.Paths;
10 11
11import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; 12import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths;
12 13
13public class PagodaUOBM { 14public class TestPagodaUOBM {
14 15
15 private void testN(int number ) throws IOException { 16 public void test(int number) throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 17 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 TestGlobalCorrectness.test(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"), 18 Pagoda pagoda = Pagoda.builder()
18 Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"), 19 .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"))
19 Paths.get(ontoDir, "uobm/queries/test.sparql"), 20 .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"))
20 Paths.get(ontoDir, "uobm/uobm" + number + ".json")); 21 .query(Paths.get(ontoDir, "uobm/queries/test.sparql"))
22 .classify(true)
23 .hermit(true)
24 .build();
25 CheckAnswersOverDataset.check(pagoda,
26 Paths.get(ontoDir, "uobm/uobm" + number + ".json"));
21 } 27 }
22 28
23 @Test 29 @Test
24 public void test1() throws IOException { 30 public void test_1() throws IOException {
25 testN(1); 31 test(1);
26 } 32 }
27 33
28 private static final int N_1 = 8; 34 private static final int N_1 = 1;
29 private static final int N_2 = 10; 35 private static final int N_2 = 10;
30 36
31
32 @DataProvider(name = "uobmNumbers") 37 @DataProvider(name = "uobmNumbers")
33 public static Object[][] uobmNumbers() { 38 public static Object[][] uobmNumbers() {
34 Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; 39 Integer[][] integers = new Integer[N_2 - N_1 + 1][1];
@@ -37,11 +42,6 @@ public class PagodaUOBM {
37 return integers; 42 return integers;
38 } 43 }
39 44
40// @Test
41// public void justExecute3() {
42// justExecute(1);
43// }
44
45 @Test(dataProvider = "uobmNumbers") 45 @Test(dataProvider = "uobmNumbers")
46 public void justExecute(int number) { 46 public void justExecute(int number) {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java
deleted file mode 100644
index a07323d..0000000
--- a/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java
+++ /dev/null
@@ -1,470 +0,0 @@
1package uk.ac.ox.cs.pagoda.ore;
2
3import java.util.HashMap;
4import java.util.HashSet;
5import java.util.List;
6import java.util.Map;
7import java.util.Set;
8
9import org.semanticweb.owlapi.model.AxiomType;
10import org.semanticweb.owlapi.model.IRI;
11import org.semanticweb.owlapi.model.OWLAxiom;
12import org.semanticweb.owlapi.model.OWLClass;
13import org.semanticweb.owlapi.model.OWLClassExpression;
14import org.semanticweb.owlapi.model.OWLDataFactory;
15import org.semanticweb.owlapi.model.OWLDataProperty;
16import org.semanticweb.owlapi.model.OWLDataPropertyExpression;
17import org.semanticweb.owlapi.model.OWLLiteral;
18import org.semanticweb.owlapi.model.OWLNamedIndividual;
19import org.semanticweb.owlapi.model.OWLObjectPropertyExpression;
20import org.semanticweb.owlapi.model.OWLOntology;
21import org.semanticweb.owlapi.model.OWLOntologyChange;
22import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException;
23import org.semanticweb.owlapi.reasoner.BufferingMode;
24import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException;
25import org.semanticweb.owlapi.reasoner.FreshEntitiesException;
26import org.semanticweb.owlapi.reasoner.FreshEntityPolicy;
27import org.semanticweb.owlapi.reasoner.InconsistentOntologyException;
28import org.semanticweb.owlapi.reasoner.IndividualNodeSetPolicy;
29import org.semanticweb.owlapi.reasoner.InferenceType;
30import org.semanticweb.owlapi.reasoner.Node;
31import org.semanticweb.owlapi.reasoner.NodeSet;
32import org.semanticweb.owlapi.reasoner.OWLReasoner;
33import org.semanticweb.owlapi.reasoner.ReasonerInterruptedException;
34import org.semanticweb.owlapi.reasoner.TimeOutException;
35import org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException;
36import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet;
37import org.semanticweb.owlapi.util.Version;
38
39import uk.ac.ox.cs.JRDFox.model.GroundTerm;
40import uk.ac.ox.cs.JRDFox.model.Individual;
41import uk.ac.ox.cs.pagoda.query.AnswerTuples;
42import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
43import uk.ac.ox.cs.pagoda.util.Utility;
44
45public class PagodaOWLReasoner implements OWLReasoner {
46
47 QueryReasoner reasoner;
48 OWLOntology ontology;
49 OWLDataFactory factory;
50 boolean sat;
51
52 public PagodaOWLReasoner(OWLOntology ontology) {
53 this.ontology = ontology;
54 factory = ontology.getOWLOntologyManager().getOWLDataFactory();
55 reasoner = QueryReasoner.getInstance(ontology);
56 reasoner.setToClassify(false);
57 reasoner.loadOntology(ontology);
58 sat = reasoner.preprocess();
59 thing = new OWLClassNodeSet(factory.getOWLThing());
60 }
61
62 @Override
63 public String getReasonerName() {
64 return "PAGOdA";
65 }
66
67 @Override
68 public Version getReasonerVersion() {
69 return null;
70 }
71
72 @Override
73 public BufferingMode getBufferingMode() {
74 // TODO Auto-generated method stub
75 return null;
76 }
77
78 @Override
79 public void flush() {
80 // TODO Auto-generated method stub
81
82 }
83
84 @Override
85 public List<OWLOntologyChange> getPendingChanges() {
86 // TODO Auto-generated method stub
87 return null;
88 }
89
90 @Override
91 public Set<OWLAxiom> getPendingAxiomAdditions() {
92 // TODO Auto-generated method stub
93 return null;
94 }
95
96 @Override
97 public Set<OWLAxiom> getPendingAxiomRemovals() {
98 // TODO Auto-generated method stub
99 return null;
100 }
101
102 @Override
103 public OWLOntology getRootOntology() {
104 return ontology;
105 }
106
107 @Override
108 public void interrupt() {
109 // TODO Auto-generated method stub
110
111 }
112
113 @Override
114 public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException {
115 if (!sat) {
116 throw new InconsistentOntologyException();
117 }
118 if (inferenceTypes.length == 1 && inferenceTypes[0].equals(InferenceType.CLASS_ASSERTIONS) && types.isEmpty()) {
119 Set<OWLClass> queriedClasses = new HashSet<OWLClass>();
120 for (OWLOntology onto: ontology.getImportsClosure())
121 for (OWLClass cls: onto.getClassesInSignature(true)) {
122// if (cls.toStringID().equals("http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Meritage"));
123// else continue;
124 if (!cls.equals(factory.getOWLThing()) && !queriedClasses.contains(cls)) {
125 queriedClasses.add(cls);
126 AnswerTuples tuples = null;
127 try {
128 tuples = reasoner.evaluate(String.format("select distinct ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <%s> .}", cls.toStringID()));
129 int cnt = 0;
130 for (GroundTerm t; tuples.isValid(); tuples.moveNext()) {
131 t = tuples.getTuple().getGroundTerm(0);
132 if (t instanceof Individual) {
133 addType(((Individual) t).getIRI(), cls);
134 ++cnt;
135 }
136 }
137 Utility.logInfo("The number of answers: " + cnt);
138 } finally {
139 if (tuples != null) tuples.dispose();
140 }
141 }
142 }
143 }
144 }
145
146 private void addType(String iri, OWLClass cls) {
147 OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI.create(iri));
148 OWLClassNodeSet set;
149 if (types.containsKey(ind)) {
150 set = types.get(ind);
151 }
152 else {
153 set = new OWLClassNodeSet(factory.getOWLThing());
154 types.put(ind, set);
155 }
156 set.addEntity(cls);
157 }
158
159 @Override
160 public boolean isPrecomputed(InferenceType inferenceType) {
161 // TODO Auto-generated method stub
162 return false;
163 }
164
165 @Override
166 public Set<InferenceType> getPrecomputableInferenceTypes() {
167 return java.util.Collections.singleton(InferenceType.CLASS_ASSERTIONS);
168 }
169
170 @Override
171 public boolean isConsistent() throws ReasonerInterruptedException, TimeOutException {
172 return sat;
173 }
174
175 @Override
176 public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException {
177 // TODO Auto-generated method stub
178 return false;
179 }
180
181 @Override
182 public Node<OWLClass> getUnsatisfiableClasses() throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException {
183 // TODO Auto-generated method stub
184 return null;
185 }
186
187 @Override
188 public boolean isEntailed(OWLAxiom axiom)
189 throws ReasonerInterruptedException,
190 UnsupportedEntailmentTypeException, TimeOutException,
191 AxiomNotInProfileException, FreshEntitiesException,
192 InconsistentOntologyException {
193 // TODO Auto-generated method stub
194 return false;
195 }
196
197 @Override
198 public boolean isEntailed(Set<? extends OWLAxiom> axioms)
199 throws ReasonerInterruptedException,
200 UnsupportedEntailmentTypeException, TimeOutException,
201 AxiomNotInProfileException, FreshEntitiesException,
202 InconsistentOntologyException {
203 // TODO Auto-generated method stub
204 return false;
205 }
206
207 @Override
208 public boolean isEntailmentCheckingSupported(AxiomType<?> axiomType) {
209 // TODO Auto-generated method stub
210 return false;
211 }
212
213 @Override
214 public Node<OWLClass> getTopClassNode() {
215 // TODO Auto-generated method stub
216 return null;
217 }
218
219 @Override
220 public Node<OWLClass> getBottomClassNode() {
221 // TODO Auto-generated method stub
222 return null;
223 }
224
225 @Override
226 public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct)
227 throws ReasonerInterruptedException, TimeOutException,
228 FreshEntitiesException, InconsistentOntologyException,
229 ClassExpressionNotInProfileException {
230 // TODO Auto-generated method stub
231 return null;
232 }
233
234 @Override
235 public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
236 boolean direct) throws InconsistentOntologyException,
237 ClassExpressionNotInProfileException, FreshEntitiesException,
238 ReasonerInterruptedException, TimeOutException {
239 // TODO Auto-generated method stub
240 return null;
241 }
242
243 @Override
244 public Node<OWLClass> getEquivalentClasses(OWLClassExpression ce)
245 throws InconsistentOntologyException,
246 ClassExpressionNotInProfileException, FreshEntitiesException,
247 ReasonerInterruptedException, TimeOutException {
248 // TODO Auto-generated method stub
249 return null;
250 }
251
252 @Override
253 public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce)
254 throws ReasonerInterruptedException, TimeOutException,
255 FreshEntitiesException, InconsistentOntologyException {
256 // TODO Auto-generated method stub
257 return null;
258 }
259
260 @Override
261 public Node<OWLObjectPropertyExpression> getTopObjectPropertyNode() {
262 // TODO Auto-generated method stub
263 return null;
264 }
265
266 @Override
267 public Node<OWLObjectPropertyExpression> getBottomObjectPropertyNode() {
268 // TODO Auto-generated method stub
269 return null;
270 }
271
272 @Override
273 public NodeSet<OWLObjectPropertyExpression> getSubObjectProperties(
274 OWLObjectPropertyExpression pe, boolean direct)
275 throws InconsistentOntologyException, FreshEntitiesException,
276 ReasonerInterruptedException, TimeOutException {
277 // TODO Auto-generated method stub
278 return null;
279 }
280
281 @Override
282 public NodeSet<OWLObjectPropertyExpression> getSuperObjectProperties(
283 OWLObjectPropertyExpression pe, boolean direct)
284 throws InconsistentOntologyException, FreshEntitiesException,
285 ReasonerInterruptedException, TimeOutException {
286 // TODO Auto-generated method stub
287 return null;
288 }
289
290 @Override
291 public Node<OWLObjectPropertyExpression> getEquivalentObjectProperties(
292 OWLObjectPropertyExpression pe)
293 throws InconsistentOntologyException, FreshEntitiesException,
294 ReasonerInterruptedException, TimeOutException {
295 // TODO Auto-generated method stub
296 return null;
297 }
298
299 @Override
300 public NodeSet<OWLObjectPropertyExpression> getDisjointObjectProperties(
301 OWLObjectPropertyExpression pe)
302 throws InconsistentOntologyException, FreshEntitiesException,
303 ReasonerInterruptedException, TimeOutException {
304 // TODO Auto-generated method stub
305 return null;
306 }
307
308 @Override
309 public Node<OWLObjectPropertyExpression> getInverseObjectProperties(
310 OWLObjectPropertyExpression pe)
311 throws InconsistentOntologyException, FreshEntitiesException,
312 ReasonerInterruptedException, TimeOutException {
313 // TODO Auto-generated method stub
314 return null;
315 }
316
317 @Override
318 public NodeSet<OWLClass> getObjectPropertyDomains(
319 OWLObjectPropertyExpression pe, boolean direct)
320 throws InconsistentOntologyException, FreshEntitiesException,
321 ReasonerInterruptedException, TimeOutException {
322 // TODO Auto-generated method stub
323 return null;
324 }
325
326 @Override
327 public NodeSet<OWLClass> getObjectPropertyRanges(
328 OWLObjectPropertyExpression pe, boolean direct)
329 throws InconsistentOntologyException, FreshEntitiesException,
330 ReasonerInterruptedException, TimeOutException {
331 // TODO Auto-generated method stub
332 return null;
333 }
334
335 @Override
336 public Node<OWLDataProperty> getTopDataPropertyNode() {
337 // TODO Auto-generated method stub
338 return null;
339 }
340
341 @Override
342 public Node<OWLDataProperty> getBottomDataPropertyNode() {
343 // TODO Auto-generated method stub
344 return null;
345 }
346
347 @Override
348 public NodeSet<OWLDataProperty> getSubDataProperties(OWLDataProperty pe,
349 boolean direct) throws InconsistentOntologyException,
350 FreshEntitiesException, ReasonerInterruptedException,
351 TimeOutException {
352 // TODO Auto-generated method stub
353 return null;
354 }
355
356 @Override
357 public NodeSet<OWLDataProperty> getSuperDataProperties(OWLDataProperty pe,
358 boolean direct) throws InconsistentOntologyException,
359 FreshEntitiesException, ReasonerInterruptedException,
360 TimeOutException {
361 // TODO Auto-generated method stub
362 return null;
363 }
364
365 @Override
366 public Node<OWLDataProperty> getEquivalentDataProperties(OWLDataProperty pe)
367 throws InconsistentOntologyException, FreshEntitiesException,
368 ReasonerInterruptedException, TimeOutException {
369 // TODO Auto-generated method stub
370 return null;
371 }
372
373 @Override
374 public NodeSet<OWLDataProperty> getDisjointDataProperties(
375 OWLDataPropertyExpression pe) throws InconsistentOntologyException,
376 FreshEntitiesException, ReasonerInterruptedException,
377 TimeOutException {
378 // TODO Auto-generated method stub
379 return null;
380 }
381
382 @Override
383 public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe,
384 boolean direct) throws InconsistentOntologyException,
385 FreshEntitiesException, ReasonerInterruptedException,
386 TimeOutException {
387 // TODO Auto-generated method stub
388 return null;
389 }
390
391 private Map<OWLNamedIndividual, OWLClassNodeSet> types = new HashMap<OWLNamedIndividual, OWLClassNodeSet>();
392 private OWLClassNodeSet thing;
393
394 @Override
395 public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
396 if (!sat) {
397 throw new InconsistentOntologyException();
398 }
399 if (types.containsKey(ind)) return types.get(ind);
400 return thing;
401 }
402
403 @Override
404 public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce,
405 boolean direct) throws InconsistentOntologyException,
406 ClassExpressionNotInProfileException, FreshEntitiesException,
407 ReasonerInterruptedException, TimeOutException {
408 // TODO Auto-generated method stub
409 return null;
410 }
411
412 @Override
413 public NodeSet<OWLNamedIndividual> getObjectPropertyValues(
414 OWLNamedIndividual ind, OWLObjectPropertyExpression pe)
415 throws InconsistentOntologyException, FreshEntitiesException,
416 ReasonerInterruptedException, TimeOutException {
417 // TODO Auto-generated method stub
418 return null;
419 }
420
421 @Override
422 public Set<OWLLiteral> getDataPropertyValues(OWLNamedIndividual ind,
423 OWLDataProperty pe) throws InconsistentOntologyException,
424 FreshEntitiesException, ReasonerInterruptedException,
425 TimeOutException {
426 // TODO Auto-generated method stub
427 return null;
428 }
429
430 @Override
431 public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual ind)
432 throws InconsistentOntologyException, FreshEntitiesException,
433 ReasonerInterruptedException, TimeOutException {
434 // TODO Auto-generated method stub
435 return null;
436 }
437
438 @Override
439 public NodeSet<OWLNamedIndividual> getDifferentIndividuals(
440 OWLNamedIndividual ind) throws InconsistentOntologyException,
441 FreshEntitiesException, ReasonerInterruptedException,
442 TimeOutException {
443 // TODO Auto-generated method stub
444 return null;
445 }
446
447 @Override
448 public long getTimeOut() {
449 // TODO Auto-generated method stub
450 return 0;
451 }
452
453 @Override
454 public FreshEntityPolicy getFreshEntityPolicy() {
455 // TODO Auto-generated method stub
456 return null;
457 }
458
459 @Override
460 public IndividualNodeSetPolicy getIndividualNodeSetPolicy() {
461 // TODO Auto-generated method stub
462 return null;
463 }
464
465 @Override
466 public void dispose() {
467 reasoner.dispose();
468 }
469
470}
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java
deleted file mode 100644
index 8ecdf1d..0000000
--- a/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
1package uk.ac.ox.cs.pagoda.ore;
2
3import org.semanticweb.owlapi.model.OWLOntology;
4import org.semanticweb.owlapi.reasoner.IllegalConfigurationException;
5import org.semanticweb.owlapi.reasoner.OWLReasoner;
6import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
7import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
8
9public class PagodaReasonerFactory implements OWLReasonerFactory {
10
11 @Override
12 public String getReasonerName() {
13 return "PAGOdA";
14 }
15
16 @Override
17 public OWLReasoner createNonBufferingReasoner(OWLOntology ontology) {
18 // TODO Auto-generated method stub
19 return null;
20 }
21
22 @Override
23 public OWLReasoner createReasoner(OWLOntology ontology) {
24 return new PagodaOWLReasoner(ontology);
25 }
26
27 @Override
28 public OWLReasoner createNonBufferingReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException {
29 // TODO Auto-generated method stub
30 return null;
31 }
32
33 @Override
34 public OWLReasoner createReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException {
35 // TODO Auto-generated method stub
36 return null;
37 }
38
39}
diff --git a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
index b97d85e..7d9b49c 100644
--- a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
+++ b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
@@ -1,126 +1,18 @@
1package uk.ac.ox.cs.pagoda.tester; 1package uk.ac.ox.cs.pagoda.tester;
2 2
3import uk.ac.ox.cs.pagoda.query.AnswerTuple;
4import uk.ac.ox.cs.pagoda.query.AnswerTuples;
5import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; 3import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
6import uk.ac.ox.cs.pagoda.util.Properties; 4import uk.ac.ox.cs.pagoda.util.Properties;
7import uk.ac.ox.cs.pagoda.util.Timer; 5import uk.ac.ox.cs.pagoda.util.Timer;
8import uk.ac.ox.cs.pagoda.util.Utility; 6import uk.ac.ox.cs.pagoda.util.Utility;
9 7
10import java.io.File; 8// TODO clean it, or code another one
11import java.io.FileNotFoundException;
12import java.io.IOException;
13import java.util.Scanner;
14
15public class PagodaTester { 9public class PagodaTester {
16 10
17// public static final String onto_dir = "/media/RDFData/yzhou/";
18// public static final String onto_dir = "/users/yzhou/ontologies/";
19// public static final String onto_dir = "/home/scratch/yzhou/ontologies/";
20 public static final String onto_dir = "/home/alessandro/Big_files/Ontologies/";
21
22 public static final String fly = onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl";
23 public static final String fly_query = onto_dir + "fly/queries/fly.sparql";
24
25 public static final String test_tbox = onto_dir + "smallExampleFromAna/dummy.owl";
26 public static final String test_abox = onto_dir + "smallExampleFromAna/initialABox.ttl";
27 public static final String test_query = onto_dir + "smallExampleFromAna/queries.dlog";
28
29 public static final int lubm_number = 1;
30 public static final String lubm_tbox = onto_dir + "lubm/univ-bench.owl";
31 public static final String lubm_abox = onto_dir + "lubm/data/lubm" + lubm_number + ".ttl";
32 public static final String lubm_abox_copy = onto_dir + "lubm/data/lubm" + lubm_number + " (copy).ttl";
33 public static final String lubm_query = onto_dir + "lubm/queries/test.sparql";
34 public static final String lubm_query6 = onto_dir + "lubm/queries/test_q6.sparql";
35 public static final String lubm_query20 = onto_dir + "lubm/queries/test_q16.sparql";
36
37 public static final int uobm_number = 1;
38 public static final String uobm_tbox = onto_dir + "uobm/univ-bench-dl.owl";
39 public static final String uobm_abox = onto_dir + "uobm/data/uobm" + uobm_number + ".ttl";
40 public static final String uobm_query = onto_dir + "uobm/queries/test.sparql";
41 public static final String uobm_query_temp = onto_dir + "uobm/queries/temp.sparql";
42 public static final String uobm_query2 = onto_dir + "uobm/queries/standard_q2.sparql";
43 public static final String uobm_query9 = onto_dir + "uobm/queries/standard_q9.sparql";
44 public static final String uobm_query11 = onto_dir + "uobm/queries/standard_q11.sparql";
45 public static final String uobm_query12 = onto_dir + "uobm/queries/standard_q12.sparql";
46 public static final String uobm_query14 = onto_dir + "uobm/queries/standard_q14.sparql";
47 public static final String uobm_query15 = onto_dir + "uobm/queries/standard_q15.sparql";
48 public static final String uobm_query_multi = onto_dir + "uobm/queries/standard_multi.sparql";
49 public static final String uobm_generated_query1 = onto_dir + "uobm/queries/generated_q1.sparql";
50 public static final String uobm_query_group3 = onto_dir + "uobm/queries/standard_group3.sparql";
51
52 public static final String npd_tbox = onto_dir + "npd/npd-all-minus-datatype.owl";
53 // "npd/npd-all.owl";
54 // "npd-all-minus-datatype.owl";
55 public static final String npd_abox = onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl";
56 // "npd/data/npd-data-dump-processed.ttl";
57 // "npd-data-dump-minus-datatype-old.ttl";
58 public static final String npd_query = onto_dir + "npd/queries/atomic.sparql";
59
60 public static final String npd_bench_tbox = onto_dir + "npd-benchmark/npd-v2-ql_a.owl"; // npd-all-minus-datatype.owl";
61 public static final String npd_bench_abox = onto_dir + "npd-benchmark/npd-v2-ql_a.ttl"; // npd-data-dump-minus-datatype-old.ttl";
62 public static final String npd_bench_query = onto_dir + "npd-benchmark/queries/all.sparql";
63
64 public static final String dbpedia_tbox = onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl";
65 public static final String dbpedia_abox = onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl";
66 public static final String dbpedia_query = onto_dir + "dbpedia/queries/atomic_ground.sparql";
67 public static final String dbpedia_query274 = onto_dir + "dbpedia/atomic_q274.sparql";
68
69 public static final String dbpedia_latest_tbox = onto_dir + "dbpedia/dbpedia_2014.owl";
70 public static final String travel_tbox = onto_dir + "dbpedia/travel.owl";
71 public static final String dbpedia_tbox_simple = onto_dir + "dbpedia/dbpedia_simple.owl";
72
73 public static final String bioModels_tbox = onto_dir + "biomodels/biomodels-21.owl";
74 public static final String bioModels_abox = onto_dir + "biomodels/data_processed_1.ttl";
75 public static final String bioModels_queries = onto_dir + "biomodels/queries/queries.sparql";
76
77 public static final String chembl_tbox = onto_dir + "bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl";
78 public static final String chembl_abox = onto_dir + "bio2rdf/chembl/graph sampling old/sample_100.nt";
79 public static final String chembl_queries = onto_dir + "bio2rdf/chembl/queries/problematic.sparql"; //"bio2rdf/chembl/queries/atomic_one_filtered.sparql"; //
80
81 public static final String reactome_tbox = onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl";
82 public static final String reactome_abox = onto_dir + "bio2rdf/reactome/graph sampling old/sample.ttl"; //data/data.ttl"; //graph sampling old/reactome_sample_10.ttl"; //
83 public static final String reactome_queries = onto_dir +"bio2rdf/reactome/queries/atomic.sparql";
84
85 public static final String uniprot_tbox = onto_dir + "bio2rdf/uniprot/core-processed.owl";
86 public static final String uniprot_abox = onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt";
87 public static final String uniprot_queries = onto_dir + "bio2rdf/uniprot/queries/atomic_one.sparql";
88
89 public static final String atlas_tbox = onto_dir + "bio2rdf/atlas/gxaterms.owl";
90 public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt";
91 public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql";
92
93 public static void main(String... args) { 11 public static void main(String... args) {
94 if (args.length == 0) { 12// Properties properties = new Properties(PagodaTester.class.
95// args = new String[] {test_tbox, test_abox, test_query}; 13// getClassLoader().getResource("uobm.properties").getPath());
96// args = new String[] {lubm_tbox, lubm_abox, lubm_query}; 14 Properties properties = new Properties();
97// args = new String[] {uobm_tbox, uobm_abox, uobm_query};
98// args = new String[] {fly, "null", fly_query};
99// args = new String[] {dbpedia_tbox, dbpedia_abox, dbpedia_query};
100// args = new String[] {travel_tbox, null, dbpedia_query274};
101 args = new String[] {fly, fly_query};
102// args = new String[] {npd_tbox, npd_abox, npd_query};
103// args = new String[] {npd_bench_tbox, npd_bench_abox, npd_bench_query};
104// args = new String[] {"../SemFacet/WebContent/WEB-INF/data/dbpedia.owl", "../SemFacet/WebContent/WEB-INF/data/dbpediaA.nt", null};
105// args = new String[] {"../core/WebContent/WEB-INF/data/fly.owl", "../core/WebContent/WEB-INF/data/fly-data.nt", null};
106// args = new String[] {"data/lubm/univ-bench.owl", "data/lubm/lubm1.ttl", "data/lubm/lubm.sparql", "lubm.ans"};
107// args = new String[] {"data/uobm/univ-bench-dl.owl", "data/uobm/uobm1.ttl", "data/uobm/uobm.sparql", "uobm.ans"};
108// args = new String[] {"data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", "data/fly/fly.sparql", "fly.ans"};
109// args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries};
110// args = new String[] {chembl_tbox, chembl_abox, chembl_queries};
111// args = new String[] {reactome_tbox, reactome_abox, reactome_queries};
112// args = new String[] {reactome_tbox, "/users/yzhou/temp/reactome_debug.ttl", onto_dir +"bio2rdf/reactome/queries/atomic_one_q65.sparql"};
113// args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), "/users/yzhou/temp/uniprot_debug/sample_1_string.nt", uniprot_queries};
114// args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), uniprot_abox, uniprot_queries};
115// args = new String[] {atlas_tbox, atlas_abox, atlas_queries};
116// args = new String[] {onto_dir + "test/unsatisfiable.owl", null, onto_dir + "test/unsatisfiable_queries.sparql"};
117// args = new String[] {onto_dir + "test/jair-example.owl", null, onto_dir + "test/jair-example_query.sparql"};
118// args[2] = args[2].replace(".sparql", "_all_pagoda.sparql");
119// args[2] = args[2].replace(".sparql", "_pellet.sparql");
120 }
121 15
122 Properties properties = new Properties("config/uobm.properties");
123
124 int index = 0; 16 int index = 0;
125 if (args.length > index) properties.setOntologyPath(args[index++]); 17 if (args.length > index) properties.setOntologyPath(args[index++]);
126 if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]); 18 if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]);
@@ -146,169 +38,9 @@ public class PagodaTester {
146 if (properties.getQueryPath() != null) 38 if (properties.getQueryPath() != null)
147 for (String queryFile: properties.getQueryPath().split(";")) 39 for (String queryFile: properties.getQueryPath().split(";"))
148 pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile)); 40 pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile));
149
150 if (properties.getShellMode())
151 try {
152 evaluateConsoleQuery(pagoda);
153 } catch (IOException e) {
154 e.printStackTrace();
155 }
156 } finally { 41 } finally {
157 if (pagoda != null) pagoda.dispose(); 42 if (pagoda != null) pagoda.dispose();
158 } 43 }
159
160// Utility.closeCurrentOut();
161
162 if (properties.getShellMode()) System.exit(0);
163 }
164
165// private void printPredicatesWithGap() {
166// for (String p: ((MyQueryReasoner) pagoda).getPredicatesWithGap()) {
167// System.out.println(p);
168// }
169// }
170
171 private static void evaluateConsoleQuery(QueryReasoner pagoda) throws IOException {
172 int ending = (int) '$', symbol;
173 while (true) {
174 Utility.logInfo("Input your query ending with $");
175 StringBuilder queryBuilder = new StringBuilder();
176 while ((symbol = System.in.read()) != ending) {
177 queryBuilder.append((char) symbol);
178 }
179 System.in.read();
180 if (queryBuilder.length() == 0) return ;
181 pagoda.evaluate_shell(queryBuilder.toString());
182 }
183 }
184
185 void testReactomeQueries() {
186 evaluate("select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.biopax.org/release/biopax-level3.owl#DnaReference> . }");
187 evaluate("select ?y ?z where { <http://identifiers.org/ensembl/ENSG00000157557> ?y ?z . }");
188 evaluate("select ?y where { <http://identifiers.org/ensembl/ENSG00000157557> <http://www.biopax.org/release/biopax-level3.owl#name> ?y . }", true);
189
190 }
191
192 void testSemFacetQueries() {
193// try {
194// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("query.line")));
195// for (String line; (line = reader.readLine()) != null && !line.isEmpty(); )
196// evaluate(line, true);
197// reader.close();
198// } catch (FileNotFoundException e) {
199// e.printStackTrace();
200// } catch (IOException e) {
201// e.printStackTrace();
202// }
203 evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true);
204 evaluate("select distinct ?y where { ?x ?y ?z }", true);
205 evaluate("select distinct ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true);
206 evaluate("select ?y ?z where { <http://www.reactome.org/biopax/46/49633#Protein3885> ?y ?z .}", true);
207 }
208
209 void testISGQueries() {
210 evaluate("select ?z where {<http://cs.ox.ac.uk/Evgeny_Kharlamov> <http://cs.ox.ac.uk/lat> ?z .}", false);
211 evaluate("select ?x where {?x <http://cs.ox.ac.uk/type> <http://cs.ox.ac.uk/person> .}", false);
212 }
213
214 void testSomeTravelQueries() {
215 evaluate("select ?y ?z where {<http://www.owl-ontologies.com/travel.owl#BlueMountains> ?y ?z. }", true);
216 evaluate("select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.owl-ontologies.com/travel.owl#RetireeDestination>. }");
217 evaluate("select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.owl-ontologies.com/travel.owl#BackpackersDestination>. }");
218 }
219
220 void testSomeFlyQueries() {
221 evaluate("select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00005106> . }", false);
222
223 evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/FBbt#develops_from> ?any . ?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00067123> . } ", true);
224
225 evaluate("Select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
226 + "<http://purl.obolibrary.org/obo/FBbt_00067123>. ?x "
227 + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any "
228 + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
229 + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true);
230
231 evaluate("Select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
232 + "<http://purl.obolibrary.org/obo/FBbt_00067363> . ?x "
233 + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any "
234 + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
235 + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true);
236
237// evaluate("Select ?x where { "
238// + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00003660>. "
239// + "?x <http://purl.obolibrary.org/obo/FBbt#develops_from> ?any . "
240// + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00001446> . }", true);
241
242 evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/RO_0002110> ?any . "
243 + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . "
244 + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007016> . } ", true);
245
246 evaluate("Select * where {"
247 + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364>. "
248 + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/2002/07/owl#sameAs> ?z }", true);
249
250 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/2002/07/owl#sameAs> ?z}", true);
251 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://purl.obolibrary.org/obo/BFO_0000051> ?z}", true);
252
253 evaluate("select DISTINCT ?y where { ?x ?y ?z . "
254 + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364> }", true);
255
256 evaluateQueriesFromFile("/users/yzhou/Downloads/logs(1).log");
257 evaluateQueriesFromFile("/users/yzhou/Downloads/logs.log");
258
259 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z}", true);
260 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://xmlns.com/foaf/0.1/depicts> ?z}", true);
261
262 evaluate("select ?x ?z where { ?x <http://www.w3.org/2002/07/owl#sameAs> ?z } ", true);
263 evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z } ", true);
264 }
265
266 public void evaluateQueriesFromFile(String fileName) {
267 Scanner scanner = null;
268 try {
269 scanner = new Scanner(new File(fileName));
270 String line;
271 while (scanner.hasNextLine()) {
272 line = scanner.nextLine();
273 if (line.startsWith("select"))
274 evaluate(line, true);
275 }
276 } catch (FileNotFoundException e) {
277 e.printStackTrace();
278 } finally {
279 if (scanner != null)
280 scanner.close();
281 }
282 }
283
284 QueryReasoner pagoda;
285
286 public PagodaTester(QueryReasoner reasoner) {
287 pagoda = reasoner;
288 }
289
290 Timer timer = new Timer();
291
292 private void evaluate(String query) {
293 evaluate(query, false);
294 }
295
296 private void evaluate(String query, boolean tag) {
297 timer.reset();
298 AnswerTuples tuples = pagoda.evaluate(query, tag);
299 int arity = tuples.getArity();
300 int count = 0;
301 for (AnswerTuple tuple; tuples.isValid(); tuples.moveNext()) {
302 tuple = tuples.getTuple();
303 for (int i = 0; i < arity; ++i)
304 tuple.getGroundTerm(i).toString();
305// System.out.print(tuple.getGroundTerm(i).toString() + "\t");
306// System.out.println();
307 ++count;
308 }
309 tuples.dispose();
310 Utility.logInfo("The number of answers for this SemFacet query: " + count);
311 Utility.logInfo("Total time for this SemFacet query: " + timer.duration());
312 } 44 }
313 45
314} 46}
diff --git a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
index 06d391a..1802147 100644
--- a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
+++ b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
@@ -5,8 +5,8 @@ import org.apache.log4j.FileAppender;
5import org.apache.log4j.Logger; 5import org.apache.log4j.Logger;
6 6
7import java.io.File; 7import java.io.File;
8import java.io.FileInputStream;
9import java.io.IOException; 8import java.io.IOException;
9import java.io.InputStream;
10import java.nio.file.Files; 10import java.nio.file.Files;
11import java.nio.file.Paths; 11import java.nio.file.Paths;
12import java.util.Enumeration; 12import java.util.Enumeration;
@@ -19,14 +19,15 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
19 */ 19 */
20public class TestUtil { 20public class TestUtil {
21 21
22 public static final String CONFIG_FILE = "config/test.properties"; 22 public static final String CONFIG_FILE = "test.properties";
23 23
24 private static boolean isConfigLoaded = false; 24 private static boolean isConfigLoaded = false;
25 private static Properties config; 25 private static Properties config;
26 26
27 public static Properties getConfig() { 27 public static Properties getConfig() {
28 if(!isConfigLoaded) { 28 if(!isConfigLoaded) {
29 try (FileInputStream in = new FileInputStream(CONFIG_FILE)) { 29 try (InputStream in = TestUtil.class.getClassLoader()
30 .getResourceAsStream(CONFIG_FILE)) {
30 config = new java.util.Properties(); 31 config = new java.util.Properties();
31 config.load(in); 32 config.load(in);
32 in.close(); 33 in.close();