diff options
Diffstat (limited to 'test/uk')
32 files changed, 883 insertions, 1388 deletions
diff --git a/test/uk/ac/ox/cs/hermit/HermitQueryReasoner.java b/test/uk/ac/ox/cs/hermit/HermitQueryReasoner.java index f6246f8..008fcb2 100644 --- a/test/uk/ac/ox/cs/hermit/HermitQueryReasoner.java +++ b/test/uk/ac/ox/cs/hermit/HermitQueryReasoner.java | |||
| @@ -1,43 +1,21 @@ | |||
| 1 | package uk.ac.ox.cs.hermit; | 1 | package uk.ac.ox.cs.hermit; |
| 2 | 2 | ||
| 3 | import java.io.File; | ||
| 4 | import java.io.FileNotFoundException; | ||
| 5 | import java.io.FileOutputStream; | ||
| 6 | import java.io.IOException; | ||
| 7 | import java.io.PrintStream; | ||
| 8 | import java.util.HashSet; | ||
| 9 | import java.util.Set; | ||
| 10 | import java.util.concurrent.Callable; | ||
| 11 | import java.util.concurrent.ExecutionException; | ||
| 12 | import java.util.concurrent.ExecutorService; | ||
| 13 | import java.util.concurrent.Executors; | ||
| 14 | import java.util.concurrent.Future; | ||
| 15 | import java.util.concurrent.TimeUnit; | ||
| 16 | import java.util.concurrent.TimeoutException; | ||
| 17 | |||
| 18 | import org.semanticweb.HermiT.Reasoner; | 3 | import org.semanticweb.HermiT.Reasoner; |
| 19 | import org.semanticweb.HermiT.model.Atom; | 4 | import org.semanticweb.HermiT.model.Atom; |
| 20 | import org.semanticweb.HermiT.model.AtomicRole; | 5 | import org.semanticweb.HermiT.model.AtomicRole; |
| 21 | import org.semanticweb.owlapi.model.IRI; | 6 | import org.semanticweb.owlapi.model.*; |
| 22 | import org.semanticweb.owlapi.model.OWLAxiom; | ||
| 23 | import org.semanticweb.owlapi.model.OWLClassExpression; | ||
| 24 | import org.semanticweb.owlapi.model.OWLDataFactory; | ||
| 25 | import org.semanticweb.owlapi.model.OWLDatatype; | ||
| 26 | import org.semanticweb.owlapi.model.OWLIndividual; | ||
| 27 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | ||
| 28 | import org.semanticweb.owlapi.model.OWLObjectProperty; | ||
| 29 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 30 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; | ||
| 31 | import org.semanticweb.owlapi.model.OWLOntologyManager; | ||
| 32 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; | ||
| 33 | import org.semanticweb.owlapi.reasoner.Node; | 7 | import org.semanticweb.owlapi.reasoner.Node; |
| 34 | |||
| 35 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | 8 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; |
| 36 | import uk.ac.ox.cs.pagoda.owl.QueryRoller; | 9 | import uk.ac.ox.cs.pagoda.owl.QueryRoller; |
| 37 | import uk.ac.ox.cs.pagoda.query.QueryManager; | 10 | import uk.ac.ox.cs.pagoda.query.QueryManager; |
| 38 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 11 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| 39 | import uk.ac.ox.cs.pagoda.util.Timer; | 12 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 40 | 13 | ||
| 14 | import java.io.*; | ||
| 15 | import java.util.HashSet; | ||
| 16 | import java.util.Set; | ||
| 17 | import java.util.concurrent.*; | ||
| 18 | |||
| 41 | public class HermitQueryReasoner { | 19 | public class HermitQueryReasoner { |
| 42 | 20 | ||
| 43 | public static void main(String... args) throws FileNotFoundException, OWLOntologyCreationException, OWLOntologyStorageException { | 21 | public static void main(String... args) throws FileNotFoundException, OWLOntologyCreationException, OWLOntologyStorageException { |
| @@ -48,11 +26,13 @@ public class HermitQueryReasoner { | |||
| 48 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/npd/npd-all-minus-datatype.owl", "/media/krr-nas-share/Yujiao/ontologies/npd/data/npd-data-dump-minus-datatype-new.ttl", "/users/yzhou/ontologies/npd/queries/atomic.sparql"}; | 26 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/npd/npd-all-minus-datatype.owl", "/media/krr-nas-share/Yujiao/ontologies/npd/data/npd-data-dump-minus-datatype-new.ttl", "/users/yzhou/ontologies/npd/queries/atomic.sparql"}; |
| 49 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/npd/npd-all.owl", "/media/krr-nas-share/Yujiao/ontologies/npd/data/npd-data-dump-processed.ttl", "/users/yzhou/ontologies/npd/queries/atomic.sparql"}; | 27 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/npd/npd-all.owl", "/media/krr-nas-share/Yujiao/ontologies/npd/data/npd-data-dump-processed.ttl", "/users/yzhou/ontologies/npd/queries/atomic.sparql"}; |
| 50 | // args = new String[] {PagodaTester.dbpedia_tbox, PagodaTester.dbpedia_abox, PagodaTester.dbpedia_query}; | 28 | // args = new String[] {PagodaTester.dbpedia_tbox, PagodaTester.dbpedia_abox, PagodaTester.dbpedia_query}; |
| 51 | // args = new String[] {"/users/yzhou/ontologies/test/unsatisfiable.owl", null, "/users/yzhou/ontologies/test/unsatisfiable_queries.sparql"}; | 29 | // args = new String[] {"/users/yzhou/ontologies/answersCorrectness/unsatisfiable.owl", null, "/users/yzhou/ontologies/answersCorrectness/unsatisfiable_queries.sparql"}; |
| 52 | 30 | ||
| 53 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/graph sampling/sample_100.nt", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/queries/atomic_one_filtered.sparql", "../test-share/results/chembl/hermit_1p"}; | 31 | // args = new String[] {"/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/graph sampling/sample_100.nt", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/chembl/queries/atomic_one_filtered.sparql", "../answersCorrectness-share/results/chembl/hermit_1p"}; |
| 54 | args = new String[] {"/users/yzhou/temp/uniprot_debug/core-processed-noDis.owl", "/users/yzhou/temp/uniprot_debug/sample_1_removed.nt", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/queries/atomic_one.sparql", "../test-share/results/uniprot/hermit_1p"}; } | 32 | args = |
| 55 | // args = new String[] {"imported.owl", "", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/queries/atomic_one.sparql", "../test-share/results/uniprot/hermit_1p"}; } | 33 | new String[]{"/users/yzhou/temp/uniprot_debug/core-processed-noDis.owl", "/users/yzhou/temp/uniprot_debug/sample_1_removed.nt", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/queries/atomic_one.sparql", "../answersCorrectness-share/results/uniprot/hermit_1p"}; |
| 34 | } | ||
| 35 | // args = new String[] {"imported.owl", "", "/media/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/queries/atomic_one.sparql", "../answersCorrectness-share/results/uniprot/hermit_1p"}; } | ||
| 56 | 36 | ||
| 57 | 37 | ||
| 58 | PrintStream ps = args.length < 4 ? null : new PrintStream(new File(args[3])); | 38 | PrintStream ps = args.length < 4 ? null : new PrintStream(new File(args[3])); |
| @@ -60,8 +40,8 @@ public class HermitQueryReasoner { | |||
| 60 | if (args[i] == null || args[i].equalsIgnoreCase("null")) args[i] = ""; | 40 | if (args[i] == null || args[i].equalsIgnoreCase("null")) args[i] = ""; |
| 61 | System.out.println("Argument " + i + ": " + args[i]); | 41 | System.out.println("Argument " + i + ": " + args[i]); |
| 62 | } | 42 | } |
| 63 | 43 | ||
| 64 | // PrintStream ps = null; // new PrintStream(new File("../test-share/results/reactome/ ")); | 44 | // PrintStream ps = null; // new PrintStream(new File("../answersCorrectness-share/results/reactome/ ")); |
| 65 | if (ps != null) System.setOut(ps); | 45 | if (ps != null) System.setOut(ps); |
| 66 | 46 | ||
| 67 | Timer t = new Timer(); | 47 | Timer t = new Timer(); |
diff --git a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java index 2fc478d..72e7af8 100644 --- a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java +++ b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java | |||
| @@ -1,119 +1,128 @@ | |||
| 1 | package uk.ac.ox.cs.hermit; | 1 | package uk.ac.ox.cs.hermit; |
| 2 | 2 | ||
| 3 | import org.junit.Test; | 3 | import org.junit.Test; |
| 4 | 4 | import uk.ac.ox.cs.pagoda.util.TestUtil; | |
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 6 | 5 | ||
| 7 | public class JAIR_HermiT { | 6 | public 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/answersCorrectness.sparql") |
| 15 | // , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit" | 15 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/hermit" |
| 16 | }; | 16 | }; |
| 17 | HermitQueryReasoner.main(args); | 17 | HermitQueryReasoner.main(args); |
| 18 | } | 18 | } |
| 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/answersCorrectness-share/results_new/lubm1/hermit_rolledUp" |
| 27 | }; | 28 | }; |
| 28 | HermitQueryReasoner.main(args); | 29 | HermitQueryReasoner.main(args); |
| 29 | } | 30 | } |
| 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/answersCorrectness-share/results_new/uobm1/hermit" |
| 39 | }; | 41 | }; |
| 40 | HermitQueryReasoner.main(args); | 42 | HermitQueryReasoner.main(args); |
| 41 | } | 43 | } |
| 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/answersCorrectness-share/results_new/uobm1/hermit_rolledUp" |
| 51 | }; | 54 | }; |
| 52 | HermitQueryReasoner.main(args); | 55 | HermitQueryReasoner.main(args); |
| 53 | } | 56 | } |
| 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/answersCorrectness-share/results_new/npd/hermit" |
| 74 | ); | 79 | ); |
| 75 | } | 80 | } |
| 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/answersCorrectness-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/answersCorrectness-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/answersCorrectness-share/results_new/chembl/hermit_1p" |
| 106 | ); | 114 | ); |
| 107 | } | 115 | } |
| 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/answersCorrectness-share/results_new/uniprot/hermit_1p" |
| 117 | ); | 126 | ); |
| 118 | } | 127 | } |
| 119 | 128 | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java new file mode 100644 index 0000000..14050ce --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import com.google.gson.Gson; | ||
| 4 | import com.google.gson.reflect.TypeToken; | ||
| 5 | import org.testng.Assert; | ||
| 6 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 7 | |||
| 8 | import java.io.BufferedReader; | ||
| 9 | import java.io.IOException; | ||
| 10 | import java.lang.reflect.Type; | ||
| 11 | import java.nio.file.Files; | ||
| 12 | import java.nio.file.Path; | ||
| 13 | import java.util.Set; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * It provides auxiliary methods for checking answers. | ||
| 17 | * */ | ||
| 18 | public class CheckAnswers { | ||
| 19 | |||
| 20 | private CheckAnswers() { | ||
| 21 | } | ||
| 22 | |||
| 23 | public static void assertSameAnswers(Path computedAnswersFile, Path givenAnswersFile) throws IOException { | ||
| 24 | BufferedReader computedReader = Files.newBufferedReader(computedAnswersFile); | ||
| 25 | BufferedReader givenReader = Files.newBufferedReader(givenAnswersFile); | ||
| 26 | |||
| 27 | Gson gson = QueryRecord.GsonCreator.getInstance(); | ||
| 28 | |||
| 29 | Type cqType = new TypeToken<Set<QueryRecord>>() {}.getType(); | ||
| 30 | Set<QueryRecord> computedAnswers = gson.fromJson(computedReader, cqType); | ||
| 31 | Set<QueryRecord> givenAnswers = gson.fromJson(givenReader, cqType); | ||
| 32 | |||
| 33 | Assert.assertEquals(computedAnswers, givenAnswers); | ||
| 34 | } | ||
| 35 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/CostEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java index 87b01ed..01e8203 100644 --- a/test/uk/ac/ox/cs/pagoda/junit/CostEvaluation.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | 1 | package uk.ac.ox.cs.pagoda.global_tests; |
| 2 | 2 | ||
| 3 | import org.junit.Test; | ||
| 4 | import org.semanticweb.owlapi.model.OWLOntology; | 3 | import org.semanticweb.owlapi.model.OWLOntology; |
| 5 | 4 | import org.testng.annotations.Test; | |
| 6 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | 5 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; |
| 7 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | 6 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; |
| 8 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type; | 7 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type; |
| 9 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | 8 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; |
| 9 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.Timer; | 10 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 11 | import uk.ac.ox.cs.pagoda.util.Utility; | 11 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 12 | 12 | ||
| @@ -15,20 +15,22 @@ public class CostEvaluation { | |||
| 15 | @Test | 15 | @Test |
| 16 | public void lubm100() { | 16 | public void lubm100() { |
| 17 | int number = 1; | 17 | int number = 1; |
| 18 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 18 | PagodaTester.main( | 19 | PagodaTester.main( |
| 19 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | 20 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), |
| 20 | PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", | 21 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), |
| 21 | PagodaTester.onto_dir + "lubm/queries/test_all_pagoda.sparql" | 22 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql") |
| 22 | ); | 23 | ); |
| 23 | // AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); | 24 | // AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | public void lubm1000() { | 27 | public void lubm1000() { |
| 27 | int number = 1000; | 28 | int number = 1000; |
| 29 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 28 | String[] args = new String[] { | 30 | String[] args = new String[] { |
| 29 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | 31 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), |
| 30 | PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", | 32 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), |
| 31 | PagodaTester.onto_dir + "lubm/queries/test_all_pagoda.sparql" | 33 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql") |
| 32 | }; | 34 | }; |
| 33 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | 35 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); |
| 34 | QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); | 36 | QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); |
| @@ -46,10 +48,11 @@ public class CostEvaluation { | |||
| 46 | @Test | 48 | @Test |
| 47 | public void uobm5() { | 49 | public void uobm5() { |
| 48 | int number = 1; | 50 | int number = 1; |
| 51 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 49 | String[] args = new String[] { | 52 | String[] args = new String[] { |
| 50 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | 53 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), |
| 51 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | 54 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), |
| 52 | PagodaTester.onto_dir + "uobm/queries/standard_all_pagoda.sparql" | 55 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql") |
| 53 | }; | 56 | }; |
| 54 | PagodaTester.main(args); | 57 | PagodaTester.main(args); |
| 55 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); | 58 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); |
| @@ -57,10 +60,11 @@ public class CostEvaluation { | |||
| 57 | 60 | ||
| 58 | public void uobm100() { | 61 | public void uobm100() { |
| 59 | int number = 200; | 62 | int number = 200; |
| 63 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 60 | String[] args = new String[] { | 64 | String[] args = new String[] { |
| 61 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | 65 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), |
| 62 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | 66 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), |
| 63 | PagodaTester.onto_dir + "uobm/queries/standard_group3_all.sparql" | 67 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_group3_all.sparql") |
| 64 | }; | 68 | }; |
| 65 | PagodaTester.main(args); | 69 | PagodaTester.main(args); |
| 66 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); | 70 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); |
| @@ -68,10 +72,11 @@ public class CostEvaluation { | |||
| 68 | 72 | ||
| 69 | public void uobm500() { | 73 | public void uobm500() { |
| 70 | int number = 500; | 74 | int number = 500; |
| 75 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 71 | String[] args = new String[] { | 76 | String[] args = new String[] { |
| 72 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | 77 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), |
| 73 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | 78 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), |
| 74 | PagodaTester.onto_dir + "uobm/queries/standard_all_pagoda.sparql" | 79 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql") |
| 75 | }; | 80 | }; |
| 76 | 81 | ||
| 77 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | 82 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); |
| @@ -89,10 +94,11 @@ public class CostEvaluation { | |||
| 89 | 94 | ||
| 90 | 95 | ||
| 91 | public static void main(String... args) { | 96 | public static void main(String... args) { |
| 97 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 92 | args = new String[] { | 98 | args = new String[] { |
| 93 | PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", | 99 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), |
| 94 | PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", | 100 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), |
| 95 | PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" | 101 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql") |
| 96 | }; | 102 | }; |
| 97 | 103 | ||
| 98 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | 104 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); |
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java new file mode 100644 index 0000000..18f6cf9 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java | |||
| @@ -0,0 +1,191 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | |||
| 9 | public class JAIR_PAGOdA { | ||
| 10 | |||
| 11 | public static void main(String... args) { | ||
| 12 | try { | ||
| 13 | new JAIR_PAGOdA().lubm1(); | ||
| 14 | } catch(IOException e) { | ||
| 15 | e.printStackTrace(); | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void lubm1() throws IOException { | ||
| 21 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 22 | String[] args = new String[] { | ||
| 23 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 24 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 25 | TestUtil.combinePaths(ontoDir, "lubm/queries/answersCorrectness.sparql") | ||
| 26 | }; | ||
| 27 | PagodaTester.main(args); | ||
| 28 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda"); | ||
| 29 | } | ||
| 30 | |||
| 31 | @Test | ||
| 32 | public void lubm1_conj() throws IOException { | ||
| 33 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 34 | String[] args = new String[] { | ||
| 35 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 36 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 37 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_pellet.sparql") | ||
| 38 | }; | ||
| 39 | PagodaTester.main(args); | ||
| 40 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_conj"); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Test | ||
| 44 | public void lubm1_rolledUp() throws IOException { | ||
| 45 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 46 | PagodaTester.main( | ||
| 47 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", | ||
| 48 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 49 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") | ||
| 50 | ); | ||
| 51 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_rolledUp"); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Test | ||
| 55 | public void uobm1() throws IOException { | ||
| 56 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 57 | String[] args = new String[] { | ||
| 58 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 59 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 60 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 61 | }; | ||
| 62 | PagodaTester.main(args); | ||
| 63 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda"); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Test | ||
| 67 | public void uobm1_conj() throws IOException { | ||
| 68 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 69 | String[] args = new String[] { | ||
| 70 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 71 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 72 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_pellet.sparql") | ||
| 73 | }; | ||
| 74 | PagodaTester.main(args); | ||
| 75 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_conj"); | ||
| 76 | } | ||
| 77 | |||
| 78 | @Test | ||
| 79 | public void uobm1_rolledUp() { | ||
| 80 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 81 | String[] args = new String[] { | ||
| 82 | "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", | ||
| 83 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 84 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") | ||
| 85 | }; | ||
| 86 | PagodaTester.main(args); | ||
| 87 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_rolledUp"); | ||
| 88 | } | ||
| 89 | |||
| 90 | @Test | ||
| 91 | public void fly() { | ||
| 92 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 93 | String[] args = new String[] { | ||
| 94 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 95 | null, | ||
| 96 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 97 | }; | ||
| 98 | PagodaTester.main(args); | ||
| 99 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda"); | ||
| 100 | } | ||
| 101 | |||
| 102 | @Test | ||
| 103 | public void fly_conj() throws IOException { | ||
| 104 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 105 | String[] args = new String[] { | ||
| 106 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 107 | null, | ||
| 108 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 109 | }; | ||
| 110 | PagodaTester.main(args); | ||
| 111 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_conj"); | ||
| 112 | } | ||
| 113 | |||
| 114 | public void fly_rolledUp() { | ||
| 115 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 116 | PagodaTester.main( | ||
| 117 | // TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 118 | TestUtil.combinePaths(ontoDir, "fly/fly-all-in-one_rolledUp.owl"), | ||
| 119 | null, | ||
| 120 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql") | ||
| 121 | ); | ||
| 122 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_rolledUp"); | ||
| 123 | } | ||
| 124 | |||
| 125 | public void dbpedia() { | ||
| 126 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 127 | PagodaTester.main( | ||
| 128 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 129 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 130 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql"), | ||
| 131 | "dbpedia.ans" | ||
| 132 | ); | ||
| 133 | |||
| 134 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/dbpedia/pagoda"); | ||
| 135 | } | ||
| 136 | |||
| 137 | public void npd() { | ||
| 138 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 139 | PagodaTester.main( | ||
| 140 | TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"), | ||
| 141 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | ||
| 142 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql") | ||
| 143 | , "npd.ans" | ||
| 144 | ); | ||
| 145 | |||
| 146 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/npd/pagoda"); | ||
| 147 | } | ||
| 148 | |||
| 149 | public void reactome() throws IOException { | ||
| 150 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 151 | PagodaTester.main( | ||
| 152 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 153 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"), | ||
| 154 | // null, | ||
| 155 | // TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql") | ||
| 156 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/example.sparql") | ||
| 157 | , "pagoda_reactome.ans" | ||
| 158 | ); | ||
| 159 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); | ||
| 160 | |||
| 161 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_10p"); | ||
| 162 | } | ||
| 163 | |||
| 164 | public void chembl() throws IOException { | ||
| 165 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 166 | PagodaTester.main( | ||
| 167 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 168 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"), | ||
| 169 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 170 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/example.sparql") | ||
| 171 | , "pagoda_chembl.ans" | ||
| 172 | ); | ||
| 173 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_chembl.example"); | ||
| 174 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_1p"); | ||
| 175 | } | ||
| 176 | |||
| 177 | public void uniprot() throws IOException { | ||
| 178 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 179 | PagodaTester.main( | ||
| 180 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 181 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"), | ||
| 182 | // null, | ||
| 183 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 184 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/example.sparql") | ||
| 185 | , "pagoda_uniprot.ans" | ||
| 186 | ); | ||
| 187 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_uniprot.example"); | ||
| 188 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_1p"); | ||
| 189 | } | ||
| 190 | |||
| 191 | } | ||
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 new file mode 100644 index 0000000..01f3568 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | |||
| 10 | public class JAIR_Scalability { | ||
| 11 | |||
| 12 | private static final String date = "_0123"; | ||
| 13 | |||
| 14 | public static void main(String... args) throws IOException { | ||
| 15 | PagodaProperties.shellModeDefault = true; | ||
| 16 | new JAIR_Scalability().testUniProt(50, false); | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void reactome() throws IOException { | ||
| 21 | testReactome(10, false); | ||
| 22 | } | ||
| 23 | |||
| 24 | @Test | ||
| 25 | public void chembl() throws IOException { | ||
| 26 | testChEMBL(1, false); | ||
| 27 | } | ||
| 28 | |||
| 29 | @Test | ||
| 30 | public void uniprot() throws IOException { | ||
| 31 | testUniProt(1, false); | ||
| 32 | } | ||
| 33 | |||
| 34 | public void testReactome(int percentage, boolean save) throws IOException { | ||
| 35 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 36 | String[] args = new String[] { | ||
| 37 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 38 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl"), | ||
| 39 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/answersCorrectness.sparql") | ||
| 40 | , "reactome.ans" | ||
| 41 | }; | ||
| 42 | if (percentage == 10) | ||
| 43 | args[1] = args[1].replace("simplifed", "reactome"); | ||
| 44 | |||
| 45 | PagodaTester.main(args); | ||
| 46 | if (save) | ||
| 47 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_" + percentage + "p" + date); | ||
| 48 | } | ||
| 49 | |||
| 50 | public void testChEMBL(int percentage, boolean save) throws IOException { | ||
| 51 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 52 | String[] args = new String[] { | ||
| 53 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 54 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/sample_" + percentage + ".nt"), | ||
| 55 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 56 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/answersCorrectness.sparql") | ||
| 57 | , "chembl.ans" | ||
| 58 | }; | ||
| 59 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 60 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); | ||
| 61 | else | ||
| 62 | if (percentage == 100) | ||
| 63 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; | ||
| 64 | |||
| 65 | PagodaTester.main(args); | ||
| 66 | if (save) | ||
| 67 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_" + percentage + "p" + date); | ||
| 68 | } | ||
| 69 | |||
| 70 | public void testUniProt(int percentage, boolean save) throws IOException { | ||
| 71 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 72 | String[] args = new String[] { | ||
| 73 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 74 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/sample_" + percentage + ".nt"), | ||
| 75 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 76 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/answersCorrectness.sparql") | ||
| 77 | , "uniprot.ans" | ||
| 78 | }; | ||
| 79 | |||
| 80 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 81 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); | ||
| 82 | else | ||
| 83 | if (percentage == 100) | ||
| 84 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; | ||
| 85 | |||
| 86 | PagodaTester.main(args); | ||
| 87 | if (save) | ||
| 88 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_" + percentage + "p" + date); | ||
| 89 | } | ||
| 90 | |||
| 91 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java new file mode 100644 index 0000000..3551b9b --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | |||
| 5 | import java.io.IOException; | ||
| 6 | |||
| 7 | @Deprecated | ||
| 8 | public class LightEvaluation { | ||
| 9 | |||
| 10 | @Test | ||
| 11 | public void evaluation() throws IOException { | ||
| 12 | new TestPagodaUOBM().answersCorrectness(1); | ||
| 13 | new TestPagodaLUBM().answersCorrectness(100); | ||
| 14 | // new TestPagodaFLY().answersCorrectness(); | ||
| 15 | new TestPagodaDBPedia().answersCorrectness(); | ||
| 16 | new TestPagodaNPD().testNPDwithoutDataType(); | ||
| 17 | } | ||
| 18 | } | ||
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..3642147 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | import java.nio.file.Paths; | ||
| 9 | |||
| 10 | public 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 answersCorrectness() { | ||
| 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..d8d2b76 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.File; | ||
| 8 | import java.io.IOException; | ||
| 9 | import java.nio.file.Path; | ||
| 10 | import java.nio.file.Paths; | ||
| 11 | |||
| 12 | public class TestPagodaFLY { | ||
| 13 | |||
| 14 | @Test(groups = {"light"}) | ||
| 15 | public void answersCorrectness_withGJFC() throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 18 | new File(answers.toString()).deleteOnExit(); | ||
| 19 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); | ||
| 20 | |||
| 21 | Pagoda pagoda = Pagoda.builder() | ||
| 22 | .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) | ||
| 23 | .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql")) | ||
| 24 | .answer(answers) | ||
| 25 | .classify(false) | ||
| 26 | .hermit(true) | ||
| 27 | .build(); | ||
| 28 | |||
| 29 | pagoda.run(); | ||
| 30 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Test(groups = {"light"}) | ||
| 34 | public void answersCorrectness_rolledUp() throws IOException { | ||
| 35 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 36 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 37 | new File(answers.toString()).deleteOnExit(); | ||
| 38 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); | ||
| 39 | |||
| 40 | Pagoda pagoda = Pagoda.builder() | ||
| 41 | .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 42 | .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly_rolledUp.sparql")) | ||
| 43 | .answer(answers) | ||
| 44 | .classify(false) | ||
| 45 | .hermit(true) | ||
| 46 | .build(); | ||
| 47 | |||
| 48 | pagoda.run(); | ||
| 49 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 50 | } | ||
| 51 | } | ||
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..d261d84 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.File; | ||
| 8 | import java.io.IOException; | ||
| 9 | import java.nio.file.Path; | ||
| 10 | import java.nio.file.Paths; | ||
| 11 | |||
| 12 | public class TestPagodaLUBM { | ||
| 13 | |||
| 14 | public void answersCorrectness(int number) throws IOException { | ||
| 15 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 16 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 17 | new File(answers.toString()).deleteOnExit(); | ||
| 18 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json"); | ||
| 19 | |||
| 20 | Pagoda pagoda = Pagoda.builder() | ||
| 21 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | ||
| 22 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | ||
| 23 | .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) | ||
| 24 | .answer(answers) | ||
| 25 | .classify(true) | ||
| 26 | .hermit(true) | ||
| 27 | .build(); | ||
| 28 | |||
| 29 | pagoda.run(); | ||
| 30 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Test(groups = {"light"}) | ||
| 34 | public void answersCorrectness_1() throws IOException { | ||
| 35 | answersCorrectness(1); | ||
| 36 | } | ||
| 37 | } | ||
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 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | import java.nio.file.Paths; | ||
| 9 | |||
| 10 | public 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/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java new file mode 100644 index 0000000..558ac1f --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.DataProvider; | ||
| 4 | import org.testng.annotations.Test; | ||
| 5 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.File; | ||
| 9 | import java.io.IOException; | ||
| 10 | import java.nio.file.Path; | ||
| 11 | import java.nio.file.Paths; | ||
| 12 | |||
| 13 | public class TestPagodaUOBM { | ||
| 14 | |||
| 15 | private static final int N_1 = 1; | ||
| 16 | private static final int N_2 = 4; | ||
| 17 | |||
| 18 | @DataProvider(name = "UOBMNumbers") | ||
| 19 | private static Object[][] UOBMNumbers() { | ||
| 20 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 21 | for(int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 22 | integers[i][0] = N_1 + i; | ||
| 23 | return integers; | ||
| 24 | } | ||
| 25 | |||
| 26 | @Test(groups = {"light"}) | ||
| 27 | public void answersCorrectness_1() throws IOException { | ||
| 28 | answersCorrectness(1); | ||
| 29 | } | ||
| 30 | |||
| 31 | @Test(groups = {"heavy"}, dataProvider = "UOBMNumbers") | ||
| 32 | public void answersCorrectness(int number) throws IOException { | ||
| 33 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 34 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 35 | new File(answers.toString()).deleteOnExit(); | ||
| 36 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-uobm" + number + ".json"); | ||
| 37 | |||
| 38 | Pagoda pagoda = Pagoda.builder() | ||
| 39 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 40 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | ||
| 41 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) | ||
| 42 | .answer(answers) | ||
| 43 | .classify(true) | ||
| 44 | .hermit(true) | ||
| 45 | .build(); | ||
| 46 | |||
| 47 | pagoda.run(); | ||
| 48 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 49 | } | ||
| 50 | |||
| 51 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/AllTests.java b/test/uk/ac/ox/cs/pagoda/junit/AllTests.java deleted file mode 100644 index fb38787..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/AllTests.java +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import java.io.BufferedWriter; | ||
| 4 | import java.io.FileInputStream; | ||
| 5 | import java.io.FileNotFoundException; | ||
| 6 | import java.io.FileOutputStream; | ||
| 7 | import java.io.IOException; | ||
| 8 | import java.io.InputStream; | ||
| 9 | import java.io.OutputStream; | ||
| 10 | import java.io.OutputStreamWriter; | ||
| 11 | |||
| 12 | import org.junit.runner.RunWith; | ||
| 13 | import org.junit.runners.Suite; | ||
| 14 | import org.junit.runners.Suite.SuiteClasses; | ||
| 15 | |||
| 16 | @RunWith(Suite.class) | ||
| 17 | @SuiteClasses({ PagodaUOBM.class | ||
| 18 | }) | ||
| 19 | public class AllTests { | ||
| 20 | |||
| 21 | public static void copy(String source, String dest) { | ||
| 22 | InputStream is = null; | ||
| 23 | OutputStream os = null; | ||
| 24 | try { | ||
| 25 | is = new FileInputStream(source); | ||
| 26 | os = new FileOutputStream(dest); | ||
| 27 | byte[] buffer = new byte[1024]; | ||
| 28 | int length; | ||
| 29 | while ((length = is.read(buffer)) > 0) { | ||
| 30 | os.write(buffer, 0, length); | ||
| 31 | } | ||
| 32 | is.close(); | ||
| 33 | os.close(); | ||
| 34 | |||
| 35 | BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(source))); | ||
| 36 | writer.write(""); | ||
| 37 | writer.close(); | ||
| 38 | } catch (FileNotFoundException e) { | ||
| 39 | e.printStackTrace(); | ||
| 40 | } catch (IOException e) { | ||
| 41 | e.printStackTrace(); | ||
| 42 | } | ||
| 43 | |||
| 44 | // File src = new File(source); | ||
| 45 | // src.delete(); | ||
| 46 | } | ||
| 47 | |||
| 48 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/ClauseTester.java b/test/uk/ac/ox/cs/pagoda/junit/ClauseTester.java index ff98b3c..ad4b2de 100644 --- a/test/uk/ac/ox/cs/pagoda/junit/ClauseTester.java +++ b/test/uk/ac/ox/cs/pagoda/junit/ClauseTester.java | |||
| @@ -1,48 +1,41 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | 1 | package uk.ac.ox.cs.pagoda.junit; |
| 2 | 2 | ||
| 3 | import static org.junit.Assert.*; | ||
| 4 | |||
| 5 | import org.junit.Test; | 3 | import org.junit.Test; |
| 6 | import org.semanticweb.HermiT.model.Atom; | 4 | import org.semanticweb.HermiT.model.*; |
| 7 | import org.semanticweb.HermiT.model.AtomicConcept; | ||
| 8 | import org.semanticweb.HermiT.model.AtomicRole; | ||
| 9 | import org.semanticweb.HermiT.model.DLClause; | ||
| 10 | import org.semanticweb.HermiT.model.Equality; | ||
| 11 | import org.semanticweb.HermiT.model.Individual; | ||
| 12 | import org.semanticweb.HermiT.model.Variable; | ||
| 13 | import org.semanticweb.owlapi.apibinding.OWLManager; | 5 | import org.semanticweb.owlapi.apibinding.OWLManager; |
| 14 | import org.semanticweb.owlapi.model.OWLOntology; | 6 | import org.semanticweb.owlapi.model.OWLOntology; |
| 15 | import org.semanticweb.owlapi.model.OWLOntologyManager; | 7 | import org.semanticweb.owlapi.model.OWLOntologyManager; |
| 16 | |||
| 17 | import uk.ac.ox.cs.pagoda.approx.Clause; | 8 | import uk.ac.ox.cs.pagoda.approx.Clause; |
| 18 | import uk.ac.ox.cs.pagoda.approx.Clausifier; | 9 | import uk.ac.ox.cs.pagoda.approx.Clausifier; |
| 19 | 10 | ||
| 11 | import static org.junit.Assert.fail; | ||
| 12 | |||
| 20 | public class ClauseTester { | 13 | public class ClauseTester { |
| 21 | 14 | ||
| 22 | public void test_clause(Atom[] headAtoms, Atom[] bodyAtoms) { | 15 | public void test_clause(Atom[] headAtoms, Atom[] bodyAtoms) { |
| 23 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | 16 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); |
| 24 | OWLOntology emptyOntology = null; | 17 | OWLOntology emptyOntology = null; |
| 25 | try { | 18 | try { |
| 26 | emptyOntology = m.createOntology(); | 19 | emptyOntology = m.createOntology(); |
| 27 | } catch (Exception e) { | 20 | } catch(Exception e) { |
| 28 | e.printStackTrace(); | 21 | e.printStackTrace(); |
| 29 | fail("failed to create a new ontology"); | 22 | fail("failed to create a new ontology"); |
| 30 | } | 23 | } |
| 31 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | 24 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); |
| 32 | System.out.println(c.toString()); | 25 | System.out.println(c.toString()); |
| 33 | } | 26 | } |
| 34 | 27 | ||
| 35 | @Test | 28 | @Test |
| 36 | public void test_nominal() { | 29 | public void test_nominal() { |
| 37 | Variable x = Variable.create("X"); | 30 | Variable x = Variable.create("X"); |
| 38 | AtomicRole r = AtomicRole.create("r"); | 31 | AtomicRole r = AtomicRole.create("r"); |
| 39 | Individual o = Individual.create("o"); | 32 | Individual o = Individual.create("o"); |
| 40 | Atom[] bodyAtoms = new Atom[] { Atom.create(r, x, o) }; | 33 | Atom[] bodyAtoms = new Atom[]{Atom.create(r, x, o)}; |
| 41 | AtomicConcept A = AtomicConcept.create("A"); | 34 | AtomicConcept A = AtomicConcept.create("A"); |
| 42 | Atom[] headAtoms = new Atom[] { Atom.create(A, x) }; | 35 | Atom[] headAtoms = new Atom[]{Atom.create(A, x)}; |
| 43 | test_clause(headAtoms, bodyAtoms); | 36 | test_clause(headAtoms, bodyAtoms); |
| 44 | } | 37 | } |
| 45 | 38 | ||
| 46 | @Test | 39 | @Test |
| 47 | public void test_simple() { | 40 | public void test_simple() { |
| 48 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); | 41 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); |
diff --git a/test/uk/ac/ox/cs/pagoda/junit/FullEvaluation.java b/test/uk/ac/ox/cs/pagoda/junit/FullEvaluation.java deleted file mode 100644 index 3406ed2..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/FullEvaluation.java +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.runner.RunWith; | ||
| 4 | import org.junit.runners.Suite; | ||
| 5 | import org.junit.runners.Suite.SuiteClasses; | ||
| 6 | |||
| 7 | @RunWith(Suite.class) | ||
| 8 | @SuiteClasses({ LightEvaluation.class, | ||
| 9 | CostEvaluation.class | ||
| 10 | }) | ||
| 11 | |||
| 12 | public class FullEvaluation { | ||
| 13 | |||
| 14 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/JAIR_PAGOdA.java b/test/uk/ac/ox/cs/pagoda/junit/JAIR_PAGOdA.java deleted file mode 100644 index 2a148cc..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/JAIR_PAGOdA.java +++ /dev/null | |||
| @@ -1,173 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 6 | |||
| 7 | public class JAIR_PAGOdA { | ||
| 8 | |||
| 9 | public void lubm1() { | ||
| 10 | String[] args = new String[] { | ||
| 11 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | ||
| 12 | PagodaTester.onto_dir + "lubm/data/lubm1.ttl", | ||
| 13 | PagodaTester.onto_dir + "lubm/queries/test.sparql" | ||
| 14 | }; | ||
| 15 | PagodaTester.main(args); | ||
| 16 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda"); | ||
| 17 | } | ||
| 18 | |||
| 19 | |||
| 20 | public void lubm1_conj() { | ||
| 21 | String[] args = new String[] { | ||
| 22 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | ||
| 23 | PagodaTester.onto_dir + "lubm/data/lubm1.ttl", | ||
| 24 | PagodaTester.onto_dir + "lubm/queries/test_pellet.sparql" | ||
| 25 | }; | ||
| 26 | PagodaTester.main(args); | ||
| 27 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_conj"); | ||
| 28 | } | ||
| 29 | |||
| 30 | |||
| 31 | public void lubm1_rolledUp() { | ||
| 32 | String[] args = new String[] { | ||
| 33 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", | ||
| 34 | PagodaTester.onto_dir + "lubm/data/lubm1.ttl", | ||
| 35 | PagodaTester.onto_dir + "lubm/queries/atomic_lubm.sparql" | ||
| 36 | }; | ||
| 37 | PagodaTester.main(args); | ||
| 38 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_rolledUp"); | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | public void uobm1() { | ||
| 43 | String[] args = new String[] { | ||
| 44 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 45 | PagodaTester.onto_dir + "uobm/data/uobm1.ttl", | ||
| 46 | PagodaTester.onto_dir + "uobm/queries/standard.sparql" | ||
| 47 | }; | ||
| 48 | PagodaTester.main(args); | ||
| 49 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda"); | ||
| 50 | } | ||
| 51 | |||
| 52 | |||
| 53 | public void uobm1_conj() { | ||
| 54 | String[] args = new String[] { | ||
| 55 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 56 | PagodaTester.onto_dir + "uobm/data/uobm1.ttl", | ||
| 57 | PagodaTester.onto_dir + "uobm/queries/standard_pellet.sparql" | ||
| 58 | }; | ||
| 59 | PagodaTester.main(args); | ||
| 60 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_conj"); | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | public void uobm1_rolledUp() { | ||
| 65 | String[] args = new String[] { | ||
| 66 | "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", | ||
| 67 | PagodaTester.onto_dir + "uobm/data/uobm1.ttl", | ||
| 68 | PagodaTester.onto_dir + "uobm/queries/atomic_uobm.sparql" | ||
| 69 | }; | ||
| 70 | PagodaTester.main(args); | ||
| 71 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_rolledUp"); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | public void fly() { | ||
| 76 | String[] args = new String[] { | ||
| 77 | PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 78 | null, | ||
| 79 | PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" | ||
| 80 | }; | ||
| 81 | PagodaTester.main(args); | ||
| 82 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda"); | ||
| 83 | } | ||
| 84 | |||
| 85 | @Test | ||
| 86 | public void fly_conj() { | ||
| 87 | String[] args = new String[] { | ||
| 88 | PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 89 | null, | ||
| 90 | PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" | ||
| 91 | }; | ||
| 92 | PagodaTester.main(args); | ||
| 93 | AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_conj"); | ||
| 94 | } | ||
| 95 | |||
| 96 | |||
| 97 | public void fly_rolledUp() { | ||
| 98 | PagodaTester.main(new String[] { | ||
| 99 | // PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 100 | PagodaTester.onto_dir + "fly/fly-all-in-one_rolledUp.owl", | ||
| 101 | null, | ||
| 102 | PagodaTester.onto_dir + "fly/queries/fly_atomic.sparql" | ||
| 103 | }); | ||
| 104 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_rolledUp"); | ||
| 105 | } | ||
| 106 | |||
| 107 | public void dbpedia() { | ||
| 108 | PagodaTester.main( | ||
| 109 | PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", | ||
| 110 | PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", | ||
| 111 | PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" | ||
| 112 | , "dbpedia.ans" | ||
| 113 | ); | ||
| 114 | |||
| 115 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/dbpedia/pagoda"); | ||
| 116 | } | ||
| 117 | |||
| 118 | public void npd() { | ||
| 119 | PagodaTester.main( | ||
| 120 | PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", | ||
| 121 | PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", | ||
| 122 | PagodaTester.onto_dir + "npd/queries/atomic_ground.sparql" | ||
| 123 | , "npd.ans" | ||
| 124 | ); | ||
| 125 | |||
| 126 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/npd/pagoda"); | ||
| 127 | } | ||
| 128 | |||
| 129 | public void reactome() { | ||
| 130 | PagodaTester.main( | ||
| 131 | PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", | ||
| 132 | PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl", | ||
| 133 | // null, | ||
| 134 | // PagodaTester.onto_dir + "bio2rdf/reactome/queries/atomic_ground.sparql" | ||
| 135 | PagodaTester.onto_dir + "bio2rdf/reactome/queries/example.sparql" | ||
| 136 | , "pagoda_reactome.ans" | ||
| 137 | ); | ||
| 138 | AllTests.copy("log4j.log", "output/jair/pagoda_reactome.example"); | ||
| 139 | |||
| 140 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_10p"); | ||
| 141 | } | ||
| 142 | |||
| 143 | public void chembl() { | ||
| 144 | PagodaTester.main( | ||
| 145 | PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", | ||
| 146 | PagodaTester.onto_dir + "bio2rdf/chembl/graph sampling/sample_1.nt", | ||
| 147 | // PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" | ||
| 148 | PagodaTester.onto_dir + "bio2rdf/chembl/queries/example.sparql" | ||
| 149 | , "pagoda_chembl.ans" | ||
| 150 | ); | ||
| 151 | AllTests.copy("log4j.log", "output/jair/pagoda_chembl.example"); | ||
| 152 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_1p"); | ||
| 153 | } | ||
| 154 | |||
| 155 | public void uniprot() { | ||
| 156 | PagodaTester.main( | ||
| 157 | PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat-processed.owl", | ||
| 158 | PagodaTester.onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt", | ||
| 159 | // null, | ||
| 160 | // PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" | ||
| 161 | PagodaTester.onto_dir + "bio2rdf/uniprot/queries/example.sparql" | ||
| 162 | , "pagoda_uniprot.ans" | ||
| 163 | ); | ||
| 164 | AllTests.copy("log4j.log", "output/jair/pagoda_uniprot.example"); | ||
| 165 | // AllTests.copy("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_1p"); | ||
| 166 | } | ||
| 167 | |||
| 168 | |||
| 169 | public static void main(String... args) { | ||
| 170 | new JAIR_PAGOdA().fly(); | ||
| 171 | } | ||
| 172 | |||
| 173 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java deleted file mode 100644 index 5e2b1d7..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/JAIR_Scalability.java +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.Properties; | ||
| 7 | |||
| 8 | public class JAIR_Scalability { | ||
| 9 | |||
| 10 | private static final String date = "_0123"; | ||
| 11 | |||
| 12 | @Test | ||
| 13 | public void reactome() { | ||
| 14 | testReactome(10, false); | ||
| 15 | } | ||
| 16 | |||
| 17 | @Test | ||
| 18 | public void chembl() { | ||
| 19 | testChEMBL(1, false); | ||
| 20 | } | ||
| 21 | |||
| 22 | @Test | ||
| 23 | public void uniprot() { | ||
| 24 | testUniProt(1, false); | ||
| 25 | } | ||
| 26 | |||
| 27 | public void testReactome(int percentage, boolean save) { | ||
| 28 | String[] args = new String[] { | ||
| 29 | PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", | ||
| 30 | PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl", | ||
| 31 | PagodaTester.onto_dir + "bio2rdf/reactome/queries/test.sparql" | ||
| 32 | , "reactome.ans" | ||
| 33 | }; | ||
| 34 | if (percentage == 10) | ||
| 35 | args[1] = args[1].replace("simplifed", "reactome"); | ||
| 36 | |||
| 37 | PagodaTester.main(args); | ||
| 38 | if (save) | ||
| 39 | AllTests.copy("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_" + percentage + "p" + date); | ||
| 40 | } | ||
| 41 | |||
| 42 | public void testChEMBL(int percentage, boolean save) { | ||
| 43 | String[] args = new String[] { | ||
| 44 | PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", | ||
| 45 | PagodaTester.onto_dir + "bio2rdf/chembl/sample_" + percentage + ".nt", | ||
| 46 | // PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" | ||
| 47 | PagodaTester.onto_dir + "bio2rdf/chembl/queries/test.sparql" | ||
| 48 | , "chembl.ans" | ||
| 49 | }; | ||
| 50 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 51 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); | ||
| 52 | else | ||
| 53 | if (percentage == 100) | ||
| 54 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; | ||
| 55 | |||
| 56 | PagodaTester.main(args); | ||
| 57 | if (save) | ||
| 58 | AllTests.copy("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_" + percentage + "p" + date); | ||
| 59 | } | ||
| 60 | |||
| 61 | public void testUniProt(int percentage, boolean save) { | ||
| 62 | String[] args = new String[] { | ||
| 63 | PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat-processed.owl", | ||
| 64 | PagodaTester.onto_dir + "bio2rdf/uniprot/sample_" + percentage + ".nt", | ||
| 65 | // PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" | ||
| 66 | PagodaTester.onto_dir + "bio2rdf/uniprot/queries/test.sparql" | ||
| 67 | , "uniprot.ans" | ||
| 68 | }; | ||
| 69 | |||
| 70 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 71 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); | ||
| 72 | else | ||
| 73 | if (percentage == 100) | ||
| 74 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; | ||
| 75 | |||
| 76 | PagodaTester.main(args); | ||
| 77 | if (save) | ||
| 78 | AllTests.copy("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_" + percentage + "p" + date); | ||
| 79 | } | ||
| 80 | |||
| 81 | public static void main(String... args) { | ||
| 82 | Properties.ShellModeDefault = true; | ||
| 83 | new JAIR_Scalability().testUniProt(50, false); | ||
| 84 | } | ||
| 85 | |||
| 86 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/junit/LightEvaluation.java deleted file mode 100644 index 1ddca15..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/LightEvaluation.java +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | |||
| 6 | public class LightEvaluation { | ||
| 7 | |||
| 8 | @Test | ||
| 9 | public void uobm1() { | ||
| 10 | int number = 1; | ||
| 11 | PagodaTester.main( | ||
| 12 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 13 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | ||
| 14 | PagodaTester.onto_dir + "uobm/queries/standard.sparql" | ||
| 15 | ); | ||
| 16 | AllTests.copy("log4j.log", "output/jair/uobm1.out"); | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void lubm100() { | ||
| 21 | int number = 100; | ||
| 22 | PagodaTester.main( | ||
| 23 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | ||
| 24 | PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", | ||
| 25 | PagodaTester.onto_dir + "lubm/queries/test.sparql" | ||
| 26 | ); | ||
| 27 | AllTests.copy("log4j.log", "results-backup/current/lubm100.out"); | ||
| 28 | } | ||
| 29 | |||
| 30 | @Test | ||
| 31 | public void fly() { | ||
| 32 | PagodaTester.main( | ||
| 33 | PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 34 | PagodaTester.onto_dir + "fly/queries/fly.sparql" | ||
| 35 | ); | ||
| 36 | AllTests.copy("log4j.log", "results-backup/current/fly.out"); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Test | ||
| 40 | public void dbpedia() { | ||
| 41 | PagodaTester.main( | ||
| 42 | PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", | ||
| 43 | PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", | ||
| 44 | PagodaTester.onto_dir + "dbpedia/atomic.sparql" | ||
| 45 | ); | ||
| 46 | AllTests.copy("log4j.log", "results-backup/current/dbpedia.out"); | ||
| 47 | } | ||
| 48 | |||
| 49 | @Test | ||
| 50 | public void npdWithoutDataType() { | ||
| 51 | PagodaTester.main( | ||
| 52 | PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", | ||
| 53 | PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", | ||
| 54 | PagodaTester.onto_dir + "npd/queries/atomic.sparql" | ||
| 55 | ); | ||
| 56 | AllTests.copy("log4j.log", "results-backup/current/npd_minus.out"); | ||
| 57 | } | ||
| 58 | |||
| 59 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaDBPedia.java deleted file mode 100644 index 37ffb44..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaDBPedia.java +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import static org.junit.Assert.fail; | ||
| 4 | |||
| 5 | import org.junit.Test; | ||
| 6 | |||
| 7 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 8 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 9 | |||
| 10 | public class PagodaDBPedia { | ||
| 11 | |||
| 12 | @Test | ||
| 13 | public void test() { | ||
| 14 | PagodaTester.main( | ||
| 15 | PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", | ||
| 16 | PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", | ||
| 17 | PagodaTester.onto_dir + "dbpedia/atomic.sparql" | ||
| 18 | ); | ||
| 19 | |||
| 20 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 21 | String diff = stat.diff("results-backup/benchmark/dbpedia.out"); | ||
| 22 | AllTests.copy("output/log4j.log", "results-backup/current/dbpedia.out"); | ||
| 23 | if (!diff.isEmpty()) | ||
| 24 | fail(diff); | ||
| 25 | } | ||
| 26 | |||
| 27 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaELU.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaELU.java deleted file mode 100644 index d999a6e..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaELU.java +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | |||
| 6 | public class PagodaELU { | ||
| 7 | |||
| 8 | @Test void test() { | ||
| 9 | int number = 1; | ||
| 10 | PagodaTester.main( | ||
| 11 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 12 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | ||
| 13 | PagodaTester.onto_dir + "uobm/queries/standard.sparql" | ||
| 14 | ); | ||
| 15 | } | ||
| 16 | |||
| 17 | |||
| 18 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaFLY.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaFLY.java deleted file mode 100644 index 4631837..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaFLY.java +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 6 | |||
| 7 | public class PagodaFLY { | ||
| 8 | |||
| 9 | @Test | ||
| 10 | public void test() { | ||
| 11 | PagodaTester.main( | ||
| 12 | PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 13 | PagodaTester.onto_dir + "fly/queries/fly_pellet.sparql" | ||
| 14 | ); | ||
| 15 | |||
| 16 | // Statistics stat = new Statistics("output/log4j.log"); | ||
| 17 | // String diff = stat.diff("results-backup/benchmark/fly.out"); | ||
| 18 | // AllTests.copy("output/log4j.log", "results-backup/current/fly.out"); | ||
| 19 | // if (!diff.isEmpty()) | ||
| 20 | // fail(diff); | ||
| 21 | } | ||
| 22 | |||
| 23 | |||
| 24 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaLUBM.java deleted file mode 100644 index f8fef0e..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaLUBM.java +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import static org.junit.Assert.*; | ||
| 4 | |||
| 5 | import org.junit.Test; | ||
| 6 | |||
| 7 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 8 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 9 | |||
| 10 | public class PagodaLUBM { | ||
| 11 | |||
| 12 | public void test_all(int number) { | ||
| 13 | PagodaTester.main( | ||
| 14 | PagodaTester.onto_dir + "lubm/univ-bench.owl", | ||
| 15 | PagodaTester.onto_dir + "lubm/data/lubm" + number + ".ttl", | ||
| 16 | PagodaTester.onto_dir + "lubm/queries/test_all_pagoda.sparql" | ||
| 17 | ); | ||
| 18 | |||
| 19 | AllTests.copy("log4j.log", "output/jair/lubm" + number + ".out"); | ||
| 20 | } | ||
| 21 | |||
| 22 | @Test | ||
| 23 | public void test1() { test_all(1); } | ||
| 24 | |||
| 25 | public void test() { | ||
| 26 | int number = 100; | ||
| 27 | test_all(number); | ||
| 28 | } | ||
| 29 | |||
| 30 | public void check(int number) { | ||
| 31 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 32 | String diff = stat.diff("results-backup/benchmark/lubm" + number + ".out"); | ||
| 33 | AllTests.copy("output/log4j.log", "results-backup/current/lubm" + number + ".out"); | ||
| 34 | if (!diff.isEmpty()) | ||
| 35 | fail(diff); | ||
| 36 | } | ||
| 37 | |||
| 38 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD.java deleted file mode 100644 index 96edbb4..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD.java +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import static org.junit.Assert.fail; | ||
| 4 | |||
| 5 | import org.junit.Test; | ||
| 6 | |||
| 7 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 8 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 9 | |||
| 10 | public class PagodaNPD { | ||
| 11 | |||
| 12 | @Test | ||
| 13 | public void testNPDwithoutDataType() { | ||
| 14 | PagodaTester.main( | ||
| 15 | PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", | ||
| 16 | PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", | ||
| 17 | PagodaTester.onto_dir + "npd/queries/atomic.sparql" | ||
| 18 | ); | ||
| 19 | |||
| 20 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 21 | String diff = stat.diff("results-backup/benchmark/npd_minus.out"); | ||
| 22 | AllTests.copy("output/log4j.log", "results-backup/current/npd_minus.out"); | ||
| 23 | if (!diff.isEmpty()) | ||
| 24 | fail(diff); | ||
| 25 | } | ||
| 26 | |||
| 27 | @Test | ||
| 28 | public void testNPD() { | ||
| 29 | PagodaTester.main( | ||
| 30 | PagodaTester.onto_dir + "npd/npd-all.owl", | ||
| 31 | PagodaTester.onto_dir + "npd/data/npd-data-dump-processed.ttl", | ||
| 32 | PagodaTester.onto_dir + "npd/queries/atomic.sparql" | ||
| 33 | ); | ||
| 34 | |||
| 35 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 36 | String diff = stat.diff("results-backup/benchmark/npd.out"); | ||
| 37 | AllTests.copy("output/log4j.log", "results-backup/current/npd.out"); | ||
| 38 | if (!diff.isEmpty()) | ||
| 39 | fail(diff); | ||
| 40 | } | ||
| 41 | |||
| 42 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD_bench.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD_bench.java deleted file mode 100644 index df1a57d..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaNPD_bench.java +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import static org.junit.Assert.fail; | ||
| 4 | |||
| 5 | import org.junit.Test; | ||
| 6 | |||
| 7 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 8 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 9 | |||
| 10 | public class PagodaNPD_bench { | ||
| 11 | |||
| 12 | @Test | ||
| 13 | public void test() { | ||
| 14 | PagodaTester.main( | ||
| 15 | PagodaTester.onto_dir + "npd-benchmark/npd-v2-ql_a.owl", | ||
| 16 | PagodaTester.onto_dir + "npd-benchmark/npd-v2-ql_a.ttl", | ||
| 17 | PagodaTester.onto_dir + "npd-benchmark/queries/all.sparql" | ||
| 18 | ); | ||
| 19 | |||
| 20 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 21 | String diff = stat.diff("results-backup/benchmark/npd-bench.out"); | ||
| 22 | AllTests.copy("output/log4j.log", "results-backup/current/npd-bench.out"); | ||
| 23 | if (!diff.isEmpty()) | ||
| 24 | fail(diff); | ||
| 25 | } | ||
| 26 | |||
| 27 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaRLU.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaRLU.java deleted file mode 100644 index 5d93302..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaRLU.java +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | |||
| 6 | public class PagodaRLU { | ||
| 7 | |||
| 8 | @Test | ||
| 9 | public void testRL() { | ||
| 10 | int number = 1; | ||
| 11 | PagodaTester.main( | ||
| 12 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 13 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | ||
| 14 | PagodaTester.onto_dir + "uobm/queries/standard.sparql" | ||
| 15 | ); | ||
| 16 | } | ||
| 17 | |||
| 18 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/junit/PagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/junit/PagodaUOBM.java deleted file mode 100644 index 5b56c6d..0000000 --- a/test/uk/ac/ox/cs/pagoda/junit/PagodaUOBM.java +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.junit; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | |||
| 5 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 6 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 7 | |||
| 8 | public class PagodaUOBM { | ||
| 9 | |||
| 10 | public void test_all(int number ) { | ||
| 11 | PagodaTester.main( | ||
| 12 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 13 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | ||
| 14 | PagodaTester.onto_dir + "uobm/queries/standard_all_pagoda.sparql" | ||
| 15 | // PagodaTester.onto_dir + "uobm/queries/standard_group3_all_less.sparql;" + | ||
| 16 | // PagodaTester.onto_dir + "uobm/queries/G3.sparql;" + | ||
| 17 | // PagodaTester.onto_dir + "uobm/queries/last.sparql" | ||
| 18 | ); | ||
| 19 | |||
| 20 | AllTests.copy("log4j.log", "output/jair/newuobm/uobm" + number + ".out"); | ||
| 21 | } | ||
| 22 | |||
| 23 | public void test_upToSum(int number) { | ||
| 24 | PagodaTester.main( | ||
| 25 | PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", | ||
| 26 | PagodaTester.onto_dir + "uobm/data/uobm" + number + ".ttl", | ||
| 27 | PagodaTester.onto_dir + "uobm/queries/standard_group3_all.sparql" | ||
| 28 | ); | ||
| 29 | |||
| 30 | // AllTests.copy("log4j.log", "output/jair/uobm" + number + ".out"); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Test | ||
| 34 | public void test1() { test_all(1); } | ||
| 35 | |||
| 36 | public void test500() { test_upToSum(500); } | ||
| 37 | |||
| 38 | public static void main(String... args) { | ||
| 39 | new PagodaUOBM().test_all(1); | ||
| 40 | } | ||
| 41 | |||
| 42 | public void check() { | ||
| 43 | Statistics stat = new Statistics("results-backup/current/uobm1.out"); | ||
| 44 | String diff = stat.diff("results-backup/benchmark/uobm1.out"); | ||
| 45 | System.out.println(diff); | ||
| 46 | } | ||
| 47 | |||
| 48 | } | ||
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 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.ore; | ||
| 2 | |||
| 3 | import java.util.HashMap; | ||
| 4 | import java.util.HashSet; | ||
| 5 | import java.util.List; | ||
| 6 | import java.util.Map; | ||
| 7 | import java.util.Set; | ||
| 8 | |||
| 9 | import org.semanticweb.owlapi.model.AxiomType; | ||
| 10 | import org.semanticweb.owlapi.model.IRI; | ||
| 11 | import org.semanticweb.owlapi.model.OWLAxiom; | ||
| 12 | import org.semanticweb.owlapi.model.OWLClass; | ||
| 13 | import org.semanticweb.owlapi.model.OWLClassExpression; | ||
| 14 | import org.semanticweb.owlapi.model.OWLDataFactory; | ||
| 15 | import org.semanticweb.owlapi.model.OWLDataProperty; | ||
| 16 | import org.semanticweb.owlapi.model.OWLDataPropertyExpression; | ||
| 17 | import org.semanticweb.owlapi.model.OWLLiteral; | ||
| 18 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | ||
| 19 | import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; | ||
| 20 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 21 | import org.semanticweb.owlapi.model.OWLOntologyChange; | ||
| 22 | import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException; | ||
| 23 | import org.semanticweb.owlapi.reasoner.BufferingMode; | ||
| 24 | import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException; | ||
| 25 | import org.semanticweb.owlapi.reasoner.FreshEntitiesException; | ||
| 26 | import org.semanticweb.owlapi.reasoner.FreshEntityPolicy; | ||
| 27 | import org.semanticweb.owlapi.reasoner.InconsistentOntologyException; | ||
| 28 | import org.semanticweb.owlapi.reasoner.IndividualNodeSetPolicy; | ||
| 29 | import org.semanticweb.owlapi.reasoner.InferenceType; | ||
| 30 | import org.semanticweb.owlapi.reasoner.Node; | ||
| 31 | import org.semanticweb.owlapi.reasoner.NodeSet; | ||
| 32 | import org.semanticweb.owlapi.reasoner.OWLReasoner; | ||
| 33 | import org.semanticweb.owlapi.reasoner.ReasonerInterruptedException; | ||
| 34 | import org.semanticweb.owlapi.reasoner.TimeOutException; | ||
| 35 | import org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException; | ||
| 36 | import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; | ||
| 37 | import org.semanticweb.owlapi.util.Version; | ||
| 38 | |||
| 39 | import uk.ac.ox.cs.JRDFox.model.GroundTerm; | ||
| 40 | import uk.ac.ox.cs.JRDFox.model.Individual; | ||
| 41 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 42 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 43 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 44 | |||
| 45 | public 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 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.ore; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 4 | import org.semanticweb.owlapi.reasoner.IllegalConfigurationException; | ||
| 5 | import org.semanticweb.owlapi.reasoner.OWLReasoner; | ||
| 6 | import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration; | ||
| 7 | import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; | ||
| 8 | |||
| 9 | public 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/rules/approximators/TestSkolemTermsManager.java b/test/uk/ac/ox/cs/pagoda/rules/approximators/TestSkolemTermsManager.java new file mode 100644 index 0000000..6bd8f05 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/rules/approximators/TestSkolemTermsManager.java | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.rules.approximators; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Tests for the class <tt>SkolemTermsManager</tt> | ||
| 7 | */ | ||
| 8 | public class TestSkolemTermsManager { | ||
| 9 | |||
| 10 | @Test | ||
| 11 | public void test() { | ||
| 12 | // TODO some test | ||
| 13 | } | ||
| 14 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java index 05a7d70..d741d3b 100644 --- a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java +++ b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java | |||
| @@ -1,23 +1,24 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.tester; | 1 | package uk.ac.ox.cs.pagoda.tester; |
| 2 | 2 | ||
| 3 | import java.io.File; | ||
| 4 | import java.io.FileNotFoundException; | ||
| 5 | import java.io.IOException; | ||
| 6 | import java.util.Scanner; | ||
| 7 | |||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | 3 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; |
| 9 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | 4 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; |
| 10 | import uk.ac.ox.cs.pagoda.reasoner.*; | 5 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; |
| 11 | import uk.ac.ox.cs.pagoda.util.Properties; | 6 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; |
| 12 | import uk.ac.ox.cs.pagoda.util.Timer; | 7 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 13 | import uk.ac.ox.cs.pagoda.util.Utility; | 8 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 14 | 9 | ||
| 10 | import java.io.File; | ||
| 11 | import java.io.FileNotFoundException; | ||
| 12 | import java.io.IOException; | ||
| 13 | import java.util.Scanner; | ||
| 14 | |||
| 15 | @Deprecated | ||
| 15 | public class PagodaTester { | 16 | public class PagodaTester { |
| 16 | 17 | ||
| 17 | // public static final String onto_dir = "/media/RDFData/yzhou/"; | 18 | // 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 = "/users/yzhou/ontologies/"; |
| 19 | // public static final String onto_dir = "/home/scratch/yzhou/ontologies/"; | 20 | // public static final String onto_dir = "/home/scratch/yzhou/ontologies/"; |
| 20 | public static final String onto_dir = "/home/yzhou/krr-nas-share/Yujiao/ontologies/"; | 21 | public static final String onto_dir = "/home/alessandro/Big_files/Ontologies/"; |
| 21 | 22 | ||
| 22 | public static final String fly = onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"; | 23 | 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 | public static final String fly_query = onto_dir + "fly/queries/fly.sparql"; |
| @@ -37,7 +38,7 @@ public class PagodaTester { | |||
| 37 | public static final int uobm_number = 1; | 38 | 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_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_abox = onto_dir + "uobm/data/uobm" + uobm_number + ".ttl"; |
| 40 | public static final String uobm_query = onto_dir + "uobm/queries/standard.sparql"; | 41 | 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_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_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_query9 = onto_dir + "uobm/queries/standard_q9.sparql"; |
| @@ -46,138 +47,149 @@ public class PagodaTester { | |||
| 46 | public static final String uobm_query14 = onto_dir + "uobm/queries/standard_q14.sparql"; | 47 | 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_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_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_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 | public static final String uobm_query_group3 = onto_dir + "uobm/queries/standard_group3.sparql"; |
| 51 | 52 | ||
| 52 | public static final String npd_tbox = onto_dir + "npd/npd-all-minus-datatype.owl"; | 53 | public static final String npd_tbox = onto_dir + "npd/npd-all-minus-datatype.owl"; |
| 53 | // "npd/npd-all.owl"; | 54 | // "npd/npd-all.owl"; |
| 54 | // "npd-all-minus-datatype.owl"; | 55 | // "npd-all-minus-datatype.owl"; |
| 55 | public static final String npd_abox = onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl"; | 56 | 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/npd-data-dump-processed.ttl"; |
| 57 | // "npd-data-dump-minus-datatype-old.ttl"; | 58 | // "npd-data-dump-minus-datatype-old.ttl"; |
| 58 | public static final String npd_query = onto_dir + "npd/queries/atomic.sparql"; | 59 | public static final String npd_query = onto_dir + "npd/queries/atomic.sparql"; |
| 59 | 60 | ||
| 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_tbox = onto_dir + "npd-benchmark/npd-v2-ql_a.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 | // npd-all-minus-datatype.owl"; |
| 63 | public static final String npd_bench_abox = onto_dir + "npd-benchmark/npd-v2-ql_a.ttl"; | ||
| 64 | // npd-data-dump-minus-datatype-old.ttl"; | ||
| 62 | public static final String npd_bench_query = onto_dir + "npd-benchmark/queries/all.sparql"; | 65 | public static final String npd_bench_query = onto_dir + "npd-benchmark/queries/all.sparql"; |
| 63 | 66 | ||
| 64 | public static final String dbpedia_tbox = onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"; | 67 | 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"; | 68 | 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"; | 69 | 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"; | 70 | public static final String dbpedia_query274 = onto_dir + "dbpedia/atomic_q274.sparql"; |
| 68 | 71 | ||
| 69 | public static final String dbpedia_latest_tbox = onto_dir + "dbpedia/dbpedia_2014.owl"; | 72 | 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"; | 73 | 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"; | 74 | public static final String dbpedia_tbox_simple = onto_dir + "dbpedia/dbpedia_simple.owl"; |
| 72 | 75 | ||
| 73 | public static final String bioModels_tbox = onto_dir + "biomodels/biomodels-21.owl"; | 76 | 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"; | 77 | 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"; | 78 | public static final String bioModels_queries = onto_dir + "biomodels/queries/queries.sparql"; |
| 76 | 79 | ||
| 77 | public static final String chembl_tbox = onto_dir + "bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl"; | 80 | 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"; | 81 | 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"; // | 82 | public static final String chembl_queries = onto_dir + "bio2rdf/chembl/queries/problematic.sparql"; |
| 80 | 83 | //"bio2rdf/chembl/queries/atomic_one_filtered.sparql"; // | |
| 81 | public static final String reactome_tbox = onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl"; | 84 | |
| 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"; // | 85 | public static final String reactome_tbox = onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl"; |
| 83 | public static final String reactome_queries = onto_dir +"bio2rdf/reactome/queries/atomic.sparql"; | 86 | public static final String reactome_abox = onto_dir + "bio2rdf/reactome/graph sampling old/sample.ttl"; |
| 84 | 87 | //data/data.ttl"; //graph sampling old/reactome_sample_10.ttl"; // | |
| 85 | public static final String uniprot_tbox = onto_dir + "bio2rdf/uniprot/core-processed.owl"; | 88 | public static final String reactome_queries = onto_dir + "bio2rdf/reactome/queries/atomic.sparql"; |
| 86 | public static final String uniprot_abox = onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt"; | 89 | |
| 87 | public static final String uniprot_queries = onto_dir + "bio2rdf/uniprot/queries/atomic_one.sparql"; | 90 | public static final String uniprot_tbox = onto_dir + "bio2rdf/uniprot/core-processed.owl"; |
| 88 | 91 | public static final String uniprot_abox = onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt"; | |
| 89 | public static final String atlas_tbox = onto_dir + "bio2rdf/atlas/gxaterms.owl"; | 92 | public static final String uniprot_queries = onto_dir + "bio2rdf/uniprot/queries/atomic_one.sparql"; |
| 90 | public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt"; | 93 | |
| 91 | public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql"; | 94 | public static final String atlas_tbox = onto_dir + "bio2rdf/atlas/gxaterms.owl"; |
| 92 | 95 | public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt"; | |
| 96 | public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql"; | ||
| 97 | QueryReasoner pagoda; | ||
| 98 | |||
| 99 | // private void printPredicatesWithGap() { | ||
| 100 | // for (String p: ((MyQueryReasoner) pagoda).getPredicatesWithGap()) { | ||
| 101 | // System.out.println(p); | ||
| 102 | // } | ||
| 103 | // } | ||
| 104 | Timer timer = new Timer(); | ||
| 105 | |||
| 106 | public PagodaTester(QueryReasoner reasoner) { | ||
| 107 | pagoda = reasoner; | ||
| 108 | } | ||
| 109 | |||
| 93 | public static void main(String... args) { | 110 | public static void main(String... args) { |
| 94 | if (args.length == 0) { | 111 | if(args.length == 0) { |
| 95 | // args = new String[] {test_tbox, test_abox, test_query}; | 112 | // args = new String[] {test_tbox, test_abox, test_query}; |
| 96 | // args = new String[] {lubm_tbox, lubm_abox, lubm_query.replace(".sparql", "_all_pagoda.sparql")}; | 113 | // args = new String[] {lubm_tbox, lubm_abox, lubm_query}; |
| 97 | // args = new String[] {uobm_tbox, uobm_abox, uobm_query.replace(".sparql", "_all_pagoda.sparql")}; | 114 | // args = new String[] {uobm_tbox, uobm_abox, uobm_query}; |
| 98 | // args = new String[] {fly, "null", fly_query.replace(".sparql", "_pellet.sparql") }; | 115 | // args = new String[] {fly, "null", fly_query}; |
| 99 | // args = new String[] {dbpedia_tbox, dbpedia_abox, dbpedia_query}; | 116 | // args = new String[] {dbpedia_tbox, dbpedia_abox, dbpedia_query}; |
| 100 | // args = new String[] {travel_tbox, null, dbpedia_query274}; | 117 | // args = new String[] {travel_tbox, null, dbpedia_query274}; |
| 101 | // args = new String[] {fly, null, fly_query}; | 118 | args = new String[]{fly, fly_query}; |
| 102 | // args = new String[] {npd_tbox, npd_abox, npd_query}; | 119 | // args = new String[] {npd_tbox, npd_abox, npd_query}; |
| 103 | // args = new String[] {npd_bench_tbox, npd_bench_abox, npd_bench_query}; | 120 | // 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}; | 121 | // 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}; | 122 | // 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"}; | 123 | // 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"}; | 124 | // 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"}; | 125 | // 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}; | 126 | // args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries}; |
| 110 | // args = new String[] {chembl_tbox, chembl_abox, chembl_queries}; | 127 | // args = new String[] {chembl_tbox, chembl_abox, chembl_queries}; |
| 111 | // args = new String[] {reactome_tbox, reactome_abox, reactome_queries}; | 128 | // 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"}; | 129 | // 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}; | 130 | // 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}; | 131 | // args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), uniprot_abox, uniprot_queries}; |
| 115 | // args = new String[] {atlas_tbox, atlas_abox, atlas_queries}; | 132 | // 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"}; | 133 | // 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"}; | 134 | // 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"); | 135 | // args[2] = args[2].replace(".sparql", "_all_pagoda.sparql"); |
| 119 | // args[2] = args[2].replace(".sparql", "_pellet.sparql"); | 136 | // args[2] = args[2].replace(".sparql", "_pellet.sparql"); |
| 120 | } | 137 | } |
| 121 | 138 | ||
| 122 | Properties properties = new Properties("config/uobm.conf"); | 139 | PagodaProperties properties = new PagodaProperties("config/uobm.properties"); |
| 123 | 140 | ||
| 124 | int index = 0; | 141 | int index = 0; |
| 125 | if (args.length > index) properties.setOntologyPath(args[index++]); | 142 | 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++]); | 143 | if(args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) |
| 127 | if (args.length > index && args[index].endsWith(".sparql")) properties.setQueryPath(args[index++]); | 144 | properties.setDataPath(args[index++]); |
| 128 | if (args.length > index && !args[index].startsWith("-")) properties.setAnswerPath(args[index++]); | 145 | if(args.length > index && args[index].endsWith(".sparql")) properties.setQueryPath(args[index++]); |
| 129 | if (args.length > index) properties.setToClassify(Boolean.parseBoolean(args[index++].substring(1))); | 146 | if(args.length > index && !args[index].startsWith("-")) properties.setAnswerPath(args[index++]); |
| 130 | if (args.length > index) properties.setToCallHermiT(Boolean.parseBoolean(args[index++].substring(1))); | 147 | if(args.length > index) properties.setToClassify(Boolean.parseBoolean(args[index++].substring(1))); |
| 131 | 148 | if(args.length > index) properties.setToCallHermiT(Boolean.parseBoolean(args[index++].substring(1))); | |
| 132 | System.out.println("Ontology file: " + properties.getOntologyPath()); | 149 | |
| 133 | System.out.println("Data files: " + properties.getDataPath()); | 150 | Utility.logInfo("Ontology file: " + properties.getOntologyPath()); |
| 134 | System.out.println("Query files: " + properties.getQueryPath()); | 151 | Utility.logInfo("Data files: " + properties.getDataPath()); |
| 135 | System.out.println("Answer file: " + properties.getAnswerPath()); | 152 | Utility.logInfo("Query files: " + properties.getQueryPath()); |
| 136 | 153 | Utility.logInfo("Answer file: " + properties.getAnswerPath()); | |
| 137 | QueryReasoner pagoda = null; | 154 | |
| 138 | 155 | QueryReasoner pagoda = null; | |
| 156 | |||
| 139 | try { | 157 | try { |
| 140 | Timer t = new Timer(); | 158 | Timer t = new Timer(); |
| 141 | pagoda = QueryReasoner.getInstance(properties); | 159 | pagoda = QueryReasoner.getInstance(properties); |
| 142 | if (pagoda == null) return; | 160 | if (pagoda == null) return; |
| 143 | 161 | ||
| 144 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | 162 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); |
| 145 | 163 | ||
| 146 | if (properties.getQueryPath() != null) | 164 | if (properties.getQueryPath() != null) |
| 147 | for (String queryFile: properties.getQueryPath().split(";")) | 165 | for (String queryFile: properties.getQueryPath().split(";")) |
| 148 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile), properties.getAnswerPath()); | 166 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile)); |
| 149 | 167 | ||
| 150 | if (properties.getShellMode()) | 168 | if(properties.getShellMode()) |
| 151 | try { | 169 | try { |
| 152 | evaluateConsoleQuery(pagoda); | 170 | evaluateConsoleQuery(pagoda); |
| 153 | } catch (IOException e) { | 171 | } catch(IOException e) { |
| 154 | e.printStackTrace(); | 172 | e.printStackTrace(); |
| 155 | } | 173 | } |
| 156 | } finally { | 174 | } finally { |
| 157 | if (pagoda != null) pagoda.dispose(); | 175 | if (pagoda != null) pagoda.dispose(); |
| 158 | } | 176 | } |
| 159 | 177 | ||
| 160 | Utility.closeCurrentOut(); | 178 | // Utility.closeCurrentOut(); |
| 161 | 179 | ||
| 162 | if (properties.getShellMode()) System.exit(0); | 180 | if(properties.getShellMode()) System.exit(0); |
| 163 | } | 181 | } |
| 164 | |||
| 165 | // private void printPredicatesWithGap() { | ||
| 166 | // for (String p: ((MyQueryReasoner) pagoda).getPredicatesWithGap()) { | ||
| 167 | // System.out.println(p); | ||
| 168 | // } | ||
| 169 | // } | ||
| 170 | 182 | ||
| 171 | private static void evaluateConsoleQuery(QueryReasoner pagoda) throws IOException { | 183 | private static void evaluateConsoleQuery(QueryReasoner pagoda) throws IOException { |
| 172 | int ending = (int) '$', symbol; | 184 | int ending = (int) '$', symbol; |
| 173 | while (true) { | 185 | while(true) { |
| 174 | Utility.logInfo("Input your query ending with $"); | 186 | Utility.logInfo("Input your query ending with $"); |
| 175 | StringBuilder queryBuilder = new StringBuilder(); | 187 | StringBuilder queryBuilder = new StringBuilder(); |
| 176 | while ((symbol = System.in.read()) != ending) { | 188 | while((symbol = System.in.read()) != ending) { |
| 177 | queryBuilder.append((char) symbol); | 189 | queryBuilder.append((char) symbol); |
| 178 | } | 190 | } |
| 179 | System.in.read(); | 191 | System.in.read(); |
| 180 | if (queryBuilder.length() == 0) return ; | 192 | if(queryBuilder.length() == 0) return; |
| 181 | pagoda.evaluate_shell(queryBuilder.toString()); | 193 | pagoda.evaluate_shell(queryBuilder.toString()); |
| 182 | } | 194 | } |
| 183 | } | 195 | } |
| @@ -185,14 +197,14 @@ public class PagodaTester { | |||
| 185 | void testReactomeQueries() { | 197 | 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> . }"); | 198 | 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 . }"); | 199 | 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); | 200 | evaluate("select ?y where { <http://identifiers.org/ensembl/ENSG00000157557> <http://www.biopax.org/release/biopax-level3.owl#name> ?y . }", true); |
| 189 | 201 | ||
| 190 | } | 202 | } |
| 191 | 203 | ||
| 192 | void testSemFacetQueries() { | 204 | void testSemFacetQueries() { |
| 193 | // try { | 205 | // try { |
| 194 | // BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("query.line"))); | 206 | // BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("query.line"))); |
| 195 | // for (String line; (line = reader.readLine()) != null && !line.isEmpty(); ) | 207 | // for (String line; (line = reader.readLine()) != null && !line.isEmpty(); ) |
| 196 | // evaluate(line, true); | 208 | // evaluate(line, true); |
| 197 | // reader.close(); | 209 | // reader.close(); |
| 198 | // } catch (FileNotFoundException e) { | 210 | // } catch (FileNotFoundException e) { |
| @@ -203,36 +215,36 @@ public class PagodaTester { | |||
| 203 | evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true); | 215 | 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); | 216 | 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); | 217 | 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); | 218 | evaluate("select ?y ?z where { <http://www.reactome.org/biopax/46/49633#Protein3885> ?y ?z .}", true); |
| 207 | } | 219 | } |
| 208 | 220 | ||
| 209 | void testISGQueries() { | 221 | void testISGQueries() { |
| 210 | evaluate("select ?z where {<http://cs.ox.ac.uk/Evgeny_Kharlamov> <http://cs.ox.ac.uk/lat> ?z .}", false); | 222 | 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); | 223 | evaluate("select ?x where {?x <http://cs.ox.ac.uk/type> <http://cs.ox.ac.uk/person> .}", false); |
| 212 | } | 224 | } |
| 213 | 225 | ||
| 214 | void testSomeTravelQueries() { | 226 | void testSomeTravelQueries() { |
| 215 | evaluate("select ?y ?z where {<http://www.owl-ontologies.com/travel.owl#BlueMountains> ?y ?z. }", true); | 227 | 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>. }"); | 228 | 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>. }"); | 229 | 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 | } | 230 | } |
| 219 | 231 | ||
| 220 | void testSomeFlyQueries() { | 232 | 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); | 233 | 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 | 234 | ||
| 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); | 235 | 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 | 236 | ||
| 225 | evaluate("Select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | 237 | 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 " | 238 | + "<http://purl.obolibrary.org/obo/FBbt_00067123>. ?x " |
| 227 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " | 239 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " |
| 228 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | 240 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " |
| 229 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); | 241 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); |
| 230 | 242 | ||
| 231 | evaluate("Select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | 243 | 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 " | 244 | + "<http://purl.obolibrary.org/obo/FBbt_00067363> . ?x " |
| 233 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " | 245 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " |
| 234 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | 246 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " |
| 235 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); | 247 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); |
| 236 | 248 | ||
| 237 | // evaluate("Select ?x where { " | 249 | // evaluate("Select ?x where { " |
| 238 | // + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00003660>. " | 250 | // + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00003660>. " |
| @@ -240,18 +252,18 @@ public class PagodaTester { | |||
| 240 | // + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00001446> . }", true); | 252 | // + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00001446> . }", true); |
| 241 | 253 | ||
| 242 | evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/RO_0002110> ?any . " | 254 | 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 . " | 255 | + "?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); | 256 | + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007016> . } ", true); |
| 245 | 257 | ||
| 246 | evaluate("Select * where {" | 258 | 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>. " | 259 | + "<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); | 260 | + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/2002/07/owl#sameAs> ?z }", true); |
| 249 | 261 | ||
| 250 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/2002/07/owl#sameAs> ?z}", true); | 262 | 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); | 263 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://purl.obolibrary.org/obo/BFO_0000051> ?z}", true); |
| 252 | 264 | ||
| 253 | evaluate("select DISTINCT ?y where { ?x ?y ?z . " | 265 | 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); | 266 | + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364> }", true); |
| 255 | 267 | ||
| 256 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs(1).log"); | 268 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs(1).log"); |
| 257 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs.log"); | 269 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs.log"); |
| @@ -268,46 +280,38 @@ public class PagodaTester { | |||
| 268 | try { | 280 | try { |
| 269 | scanner = new Scanner(new File(fileName)); | 281 | scanner = new Scanner(new File(fileName)); |
| 270 | String line; | 282 | String line; |
| 271 | while (scanner.hasNextLine()) { | 283 | while(scanner.hasNextLine()) { |
| 272 | line = scanner.nextLine(); | 284 | line = scanner.nextLine(); |
| 273 | if (line.startsWith("select")) | 285 | if(line.startsWith("select")) |
| 274 | evaluate(line, true); | 286 | evaluate(line, true); |
| 275 | } | 287 | } |
| 276 | } catch (FileNotFoundException e) { | 288 | } catch(FileNotFoundException e) { |
| 277 | e.printStackTrace(); | 289 | e.printStackTrace(); |
| 278 | } finally { | 290 | } finally { |
| 279 | if (scanner != null) | 291 | if(scanner != null) |
| 280 | scanner.close(); | 292 | scanner.close(); |
| 281 | } | 293 | } |
| 282 | } | 294 | } |
| 283 | 295 | ||
| 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) { | 296 | private void evaluate(String query) { |
| 293 | evaluate(query, false); | 297 | evaluate(query, false); |
| 294 | } | 298 | } |
| 295 | 299 | ||
| 296 | private void evaluate(String query, boolean tag) { | 300 | private void evaluate(String query, boolean tag) { |
| 297 | timer.reset(); | 301 | timer.reset(); |
| 298 | AnswerTuples tuples = pagoda.evaluate(query, tag); | 302 | AnswerTuples tuples = pagoda.evaluate(query, tag); |
| 299 | int arity = tuples.getArity(); | 303 | int arity = tuples.getArity(); |
| 300 | int count = 0; | 304 | int count = 0; |
| 301 | for (AnswerTuple tuple; tuples.isValid(); tuples.moveNext()) { | 305 | for(AnswerTuple tuple; tuples.isValid(); tuples.moveNext()) { |
| 302 | tuple = tuples.getTuple(); | 306 | tuple = tuples.getTuple(); |
| 303 | for (int i = 0; i < arity; ++i) | 307 | for(int i = 0; i < arity; ++i) |
| 304 | tuple.getGroundTerm(i).toString(); | 308 | tuple.getGroundTerm(i).toString(); |
| 305 | // System.out.print(tuple.getGroundTerm(i).toString() + "\t"); | 309 | // System.out.print(tuple.getGroundTerm(i).toString() + "\t"); |
| 306 | // System.out.println(); | 310 | // System.out.println(); |
| 307 | ++count; | 311 | ++count; |
| 308 | } | 312 | } |
| 309 | tuples.dispose(); | 313 | tuples.dispose(); |
| 310 | Utility.logInfo("The number of answers for this SemFacet query: " + count); | 314 | Utility.logInfo("The number of answers for this SemFacet query: " + count); |
| 311 | Utility.logInfo("Total time for this SemFacet query: " + timer.duration()); | 315 | Utility.logInfo("Total time for this SemFacet query: " + timer.duration()); |
| 312 | } | 316 | } |
| 313 | 317 | ||
diff --git a/test/uk/ac/ox/cs/pagoda/tester/Statistics.java b/test/uk/ac/ox/cs/pagoda/tester/Statistics.java index 71f1726..13d7f90 100644 --- a/test/uk/ac/ox/cs/pagoda/tester/Statistics.java +++ b/test/uk/ac/ox/cs/pagoda/tester/Statistics.java | |||
| @@ -6,6 +6,7 @@ import java.util.Iterator; | |||
| 6 | import java.util.LinkedList; | 6 | import java.util.LinkedList; |
| 7 | import java.util.Scanner; | 7 | import java.util.Scanner; |
| 8 | 8 | ||
| 9 | @Deprecated | ||
| 9 | public class Statistics { | 10 | public class Statistics { |
| 10 | 11 | ||
| 11 | double satCheckTime; | 12 | double satCheckTime; |
diff --git a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java new file mode 100644 index 0000000..c3909d5 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.util; | ||
| 2 | |||
| 3 | import org.apache.log4j.Appender; | ||
| 4 | import org.apache.log4j.FileAppender; | ||
| 5 | import org.apache.log4j.Logger; | ||
| 6 | |||
| 7 | import java.io.File; | ||
| 8 | import java.io.IOException; | ||
| 9 | import java.io.InputStream; | ||
| 10 | import java.net.URL; | ||
| 11 | import java.nio.file.Files; | ||
| 12 | import java.nio.file.Path; | ||
| 13 | import java.nio.file.Paths; | ||
| 14 | import java.util.Enumeration; | ||
| 15 | import java.util.Properties; | ||
| 16 | |||
| 17 | import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; | ||
| 18 | |||
| 19 | /** | ||
| 20 | * A collection of utility methods for testing. | ||
| 21 | */ | ||
| 22 | public class TestUtil { | ||
| 23 | |||
| 24 | public static final String CONFIG_FILE = "test.properties"; | ||
| 25 | |||
| 26 | private static boolean isConfigLoaded = false; | ||
| 27 | private static Properties config; | ||
| 28 | |||
| 29 | public static Properties getConfig() { | ||
| 30 | if(!isConfigLoaded) { | ||
| 31 | try(InputStream in = TestUtil.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | ||
| 32 | config = new java.util.Properties(); | ||
| 33 | config.load(in); | ||
| 34 | in.close(); | ||
| 35 | isConfigLoaded = true; | ||
| 36 | } catch (IOException e) { | ||
| 37 | e.printStackTrace(); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | return config; | ||
| 41 | } | ||
| 42 | |||
| 43 | public static String combinePaths(String path1, String path2) { | ||
| 44 | File file1 = new File(path1); | ||
| 45 | File file2 = new File(file1, path2); | ||
| 46 | return file2.getPath(); | ||
| 47 | } | ||
| 48 | |||
| 49 | public static void copyFile(String src, String dst) throws IOException { | ||
| 50 | Files.copy(Paths.get(src), Paths.get(dst), REPLACE_EXISTING); | ||
| 51 | } | ||
| 52 | |||
| 53 | /** | ||
| 54 | * Get the log file, which is assumed unique. | ||
| 55 | * */ | ||
| 56 | public static String getLogFileName() { | ||
| 57 | Enumeration e = Logger.getRootLogger().getAllAppenders(); | ||
| 58 | while (e.hasMoreElements()){ | ||
| 59 | Appender app = (Appender)e.nextElement(); | ||
| 60 | if (app instanceof FileAppender){ | ||
| 61 | return ((FileAppender)app).getFile(); | ||
| 62 | } | ||
| 63 | } | ||
| 64 | return null; | ||
| 65 | } | ||
| 66 | |||
| 67 | public static Path getAnswersFilePath(String name) { | ||
| 68 | URL givenAnswersURL = TestUtil.class.getClassLoader() | ||
| 69 | .getResource(name); | ||
| 70 | if(givenAnswersURL == null) throw new RuntimeException("Missing answers file:" + name); | ||
| 71 | return Paths.get(givenAnswersURL.getPath()); | ||
| 72 | } | ||
| 73 | |||
| 74 | } | ||
