diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-19 13:35:52 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-19 13:35:52 +0100 |
| commit | 5d54af2638a53721b414a41356a93686a9616272 (patch) | |
| tree | e28c64b1887e7e964661d12d96df5b09abd4d9ee /test | |
| parent | c7dbc7c61c7094ea4ec49bd630023f23b92fd9d1 (diff) | |
| download | ACQuA-5d54af2638a53721b414a41356a93686a9616272.tar.gz ACQuA-5d54af2638a53721b414a41356a93686a9616272.zip | |
Backup before changes in MyQueryReasoner.
Diffstat (limited to 'test')
| -rw-r--r-- | test/resources/HeavyTests.xml | 17 | ||||
| -rw-r--r-- | test/resources/LightTests.xml | 17 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/hermit/HermitQueryReasoner.java | 48 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/hermit/JAIR_HermiT.java | 20 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java (renamed from test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java) | 23 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java | 48 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java | 52 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java | 5 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java | 35 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | 45 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java | 310 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/Statistics.java | 1 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/util/TestUtil.java | 3 |
13 files changed, 460 insertions, 164 deletions
diff --git a/test/resources/HeavyTests.xml b/test/resources/HeavyTests.xml new file mode 100644 index 0000000..4a96553 --- /dev/null +++ b/test/resources/HeavyTests.xml | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
| 3 | |||
| 4 | <suite name="HeavyTests"> | ||
| 5 | |||
| 6 | <test name="heavy"> | ||
| 7 | <groups> | ||
| 8 | <run> | ||
| 9 | <include name="heavy"/> | ||
| 10 | </run> | ||
| 11 | </groups> | ||
| 12 | <classes> | ||
| 13 | <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/> | ||
| 14 | <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/> | ||
| 15 | </classes> | ||
| 16 | </test> | ||
| 17 | </suite> \ No newline at end of file | ||
diff --git a/test/resources/LightTests.xml b/test/resources/LightTests.xml new file mode 100644 index 0000000..dcac0dd --- /dev/null +++ b/test/resources/LightTests.xml | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
| 3 | |||
| 4 | <suite name="LightTests"> | ||
| 5 | <test name="light"> | ||
| 6 | <groups> | ||
| 7 | <run> | ||
| 8 | <include name="light"/> | ||
| 9 | </run> | ||
| 10 | </groups> | ||
| 11 | |||
| 12 | <classes> | ||
| 13 | <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/> | ||
| 14 | <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/> | ||
| 15 | </classes> | ||
| 16 | </test> | ||
| 17 | </suite> \ No newline at end of file | ||
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 a3264ba..72e7af8 100644 --- a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java +++ b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java | |||
| @@ -11,8 +11,8 @@ public class JAIR_HermiT { | |||
| 11 | String[] args = new String[] { | 11 | String[] args = new String[] { |
| 12 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | 12 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), |
| 13 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"), | 13 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"), |
| 14 | TestUtil.combinePaths(ontoDir, "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 | } |
| @@ -24,7 +24,7 @@ public class JAIR_HermiT { | |||
| 24 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", | 24 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", |
| 25 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"), | 25 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"), |
| 26 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") | 26 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") |
| 27 | // , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit_rolledUp" | 27 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/hermit_rolledUp" |
| 28 | }; | 28 | }; |
| 29 | HermitQueryReasoner.main(args); | 29 | HermitQueryReasoner.main(args); |
| 30 | } | 30 | } |
| @@ -37,7 +37,7 @@ public class JAIR_HermiT { | |||
| 37 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"), | 37 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"), |
| 38 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | 38 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") |
| 39 | // , "hermit_uobm1.out" | 39 | // , "hermit_uobm1.out" |
| 40 | // , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit" | 40 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/hermit" |
| 41 | }; | 41 | }; |
| 42 | HermitQueryReasoner.main(args); | 42 | HermitQueryReasoner.main(args); |
| 43 | } | 43 | } |
| @@ -50,7 +50,7 @@ public class JAIR_HermiT { | |||
| 50 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"), | 50 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"), |
| 51 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") | 51 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") |
| 52 | , "hermit_uobm1_rolledUp.out" | 52 | , "hermit_uobm1_rolledUp.out" |
| 53 | // , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit_rolledUp" | 53 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/hermit_rolledUp" |
| 54 | }; | 54 | }; |
| 55 | HermitQueryReasoner.main(args); | 55 | HermitQueryReasoner.main(args); |
| 56 | } | 56 | } |
| @@ -75,7 +75,7 @@ public class JAIR_HermiT { | |||
| 75 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | 75 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), |
| 76 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql") | 76 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql") |
| 77 | , "hermit_npd.out" | 77 | , "hermit_npd.out" |
| 78 | // , "/home/yzhou/java-workspace/test-share/results_new/npd/hermit" | 78 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/npd/hermit" |
| 79 | ); | 79 | ); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -86,7 +86,7 @@ public class JAIR_HermiT { | |||
| 86 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | 86 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), |
| 87 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | 87 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), |
| 88 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql") | 88 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql") |
| 89 | , "/home/yzhou/java-workspace/test-share/results_new/dbpedia/hermit" | 89 | , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/dbpedia/hermit" |
| 90 | ); | 90 | ); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| @@ -97,7 +97,7 @@ public class JAIR_HermiT { | |||
| 97 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | 97 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), |
| 98 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"), | 98 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"), |
| 99 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql") | 99 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql") |
| 100 | , "/home/yzhou/java-workspace/test-share/results_new/reactome/hermit_10p" | 100 | , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/hermit_10p" |
| 101 | ); | 101 | ); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| @@ -110,7 +110,7 @@ public class JAIR_HermiT { | |||
| 110 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"), | 110 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"), |
| 111 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | 111 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") |
| 112 | , "hermit_chembl.out" | 112 | , "hermit_chembl.out" |
| 113 | // , "/home/yzhou/java-workspace/test-share/results_new/chembl/hermit_1p" | 113 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/hermit_1p" |
| 114 | ); | 114 | ); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| @@ -122,7 +122,7 @@ public class JAIR_HermiT { | |||
| 122 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"), | 122 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"), |
| 123 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | 123 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") |
| 124 | , "hermit_uniprot.out" | 124 | , "hermit_uniprot.out" |
| 125 | // , "/home/yzhou/java-workspace/test-share/results_new/uniprot/hermit_1p" | 125 | // , "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/hermit_1p" |
| 126 | ); | 126 | ); |
| 127 | } | 127 | } |
| 128 | 128 | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java index 424afa2..14050ce 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswers.java | |||
| @@ -3,37 +3,24 @@ package uk.ac.ox.cs.pagoda.global_tests; | |||
| 3 | import com.google.gson.Gson; | 3 | import com.google.gson.Gson; |
| 4 | import com.google.gson.reflect.TypeToken; | 4 | import com.google.gson.reflect.TypeToken; |
| 5 | import org.testng.Assert; | 5 | import org.testng.Assert; |
| 6 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | 6 | import uk.ac.ox.cs.pagoda.query.QueryRecord; |
| 8 | 7 | ||
| 9 | import java.io.BufferedReader; | 8 | import java.io.BufferedReader; |
| 10 | import java.io.File; | ||
| 11 | import java.io.IOException; | 9 | import java.io.IOException; |
| 12 | import java.lang.reflect.Type; | 10 | import java.lang.reflect.Type; |
| 13 | import java.nio.file.Files; | 11 | import java.nio.file.Files; |
| 14 | import java.nio.file.Path; | 12 | import java.nio.file.Path; |
| 15 | import java.nio.file.Paths; | ||
| 16 | import java.util.Set; | 13 | import java.util.Set; |
| 17 | 14 | ||
| 18 | /** | 15 | /** |
| 19 | * Given an instance of Pagoda, it checks the returned answers. | 16 | * It provides auxiliary methods for checking answers. |
| 20 | * */ | 17 | * */ |
| 21 | public class CheckAnswersOverDataset { | 18 | public class CheckAnswers { |
| 22 | 19 | ||
| 23 | public static void check(Pagoda pagoda, Path givenAnswers) { | 20 | private CheckAnswers() { |
| 24 | try { | ||
| 25 | // Utility.setLogLevel(Level.DEBUG); // uncomment for outputting partial results | ||
| 26 | Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 27 | new File(computedAnswers.toString()).deleteOnExit(); | ||
| 28 | |||
| 29 | pagoda.run(); | ||
| 30 | assertSameContent(computedAnswers, givenAnswers); | ||
| 31 | } catch (IOException e) { | ||
| 32 | e.printStackTrace(); | ||
| 33 | } | ||
| 34 | } | 21 | } |
| 35 | 22 | ||
| 36 | private static void assertSameContent(Path computedAnswersFile, Path givenAnswersFile) throws IOException { | 23 | public static void assertSameAnswers(Path computedAnswersFile, Path givenAnswersFile) throws IOException { |
| 37 | BufferedReader computedReader = Files.newBufferedReader(computedAnswersFile); | 24 | BufferedReader computedReader = Files.newBufferedReader(computedAnswersFile); |
| 38 | BufferedReader givenReader = Files.newBufferedReader(givenAnswersFile); | 25 | BufferedReader givenReader = Files.newBufferedReader(givenAnswersFile); |
| 39 | 26 | ||
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 index 0d77fdb..18f6cf9 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java | |||
| @@ -8,16 +8,24 @@ import java.io.IOException; | |||
| 8 | 8 | ||
| 9 | public class JAIR_PAGOdA { | 9 | public class JAIR_PAGOdA { |
| 10 | 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 | |||
| 11 | @Test | 19 | @Test |
| 12 | public void lubm1() throws IOException { | 20 | public void lubm1() throws IOException { |
| 13 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 21 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 14 | String[] args = new String[] { | 22 | String[] args = new String[] { |
| 15 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | 23 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), |
| 16 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | 24 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), |
| 17 | TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql") | 25 | TestUtil.combinePaths(ontoDir, "lubm/queries/answersCorrectness.sparql") |
| 18 | }; | 26 | }; |
| 19 | PagodaTester.main(args); | 27 | PagodaTester.main(args); |
| 20 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda"); | 28 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda"); |
| 21 | } | 29 | } |
| 22 | 30 | ||
| 23 | @Test | 31 | @Test |
| @@ -29,7 +37,7 @@ public class JAIR_PAGOdA { | |||
| 29 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_pellet.sparql") | 37 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_pellet.sparql") |
| 30 | }; | 38 | }; |
| 31 | PagodaTester.main(args); | 39 | PagodaTester.main(args); |
| 32 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_conj"); | 40 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_conj"); |
| 33 | } | 41 | } |
| 34 | 42 | ||
| 35 | @Test | 43 | @Test |
| @@ -40,7 +48,7 @@ public class JAIR_PAGOdA { | |||
| 40 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | 48 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), |
| 41 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") | 49 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") |
| 42 | ); | 50 | ); |
| 43 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_rolledUp"); | 51 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_rolledUp"); |
| 44 | } | 52 | } |
| 45 | 53 | ||
| 46 | @Test | 54 | @Test |
| @@ -52,7 +60,7 @@ public class JAIR_PAGOdA { | |||
| 52 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | 60 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") |
| 53 | }; | 61 | }; |
| 54 | PagodaTester.main(args); | 62 | PagodaTester.main(args); |
| 55 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda"); | 63 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda"); |
| 56 | } | 64 | } |
| 57 | 65 | ||
| 58 | @Test | 66 | @Test |
| @@ -64,7 +72,7 @@ public class JAIR_PAGOdA { | |||
| 64 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_pellet.sparql") | 72 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_pellet.sparql") |
| 65 | }; | 73 | }; |
| 66 | PagodaTester.main(args); | 74 | PagodaTester.main(args); |
| 67 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_conj"); | 75 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_conj"); |
| 68 | } | 76 | } |
| 69 | 77 | ||
| 70 | @Test | 78 | @Test |
| @@ -76,7 +84,7 @@ public class JAIR_PAGOdA { | |||
| 76 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") | 84 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") |
| 77 | }; | 85 | }; |
| 78 | PagodaTester.main(args); | 86 | PagodaTester.main(args); |
| 79 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_rolledUp"); | 87 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_rolledUp"); |
| 80 | } | 88 | } |
| 81 | 89 | ||
| 82 | @Test | 90 | @Test |
| @@ -88,7 +96,7 @@ public class JAIR_PAGOdA { | |||
| 88 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | 96 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") |
| 89 | }; | 97 | }; |
| 90 | PagodaTester.main(args); | 98 | PagodaTester.main(args); |
| 91 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda"); | 99 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda"); |
| 92 | } | 100 | } |
| 93 | 101 | ||
| 94 | @Test | 102 | @Test |
| @@ -100,10 +108,9 @@ public class JAIR_PAGOdA { | |||
| 100 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | 108 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") |
| 101 | }; | 109 | }; |
| 102 | PagodaTester.main(args); | 110 | PagodaTester.main(args); |
| 103 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_conj"); | 111 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_conj"); |
| 104 | } | 112 | } |
| 105 | 113 | ||
| 106 | |||
| 107 | public void fly_rolledUp() { | 114 | public void fly_rolledUp() { |
| 108 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 115 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 109 | PagodaTester.main( | 116 | PagodaTester.main( |
| @@ -112,7 +119,7 @@ public class JAIR_PAGOdA { | |||
| 112 | null, | 119 | null, |
| 113 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql") | 120 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql") |
| 114 | ); | 121 | ); |
| 115 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_rolledUp"); | 122 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_rolledUp"); |
| 116 | } | 123 | } |
| 117 | 124 | ||
| 118 | public void dbpedia() { | 125 | public void dbpedia() { |
| @@ -124,7 +131,7 @@ public class JAIR_PAGOdA { | |||
| 124 | "dbpedia.ans" | 131 | "dbpedia.ans" |
| 125 | ); | 132 | ); |
| 126 | 133 | ||
| 127 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/dbpedia/pagoda"); | 134 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/dbpedia/pagoda"); |
| 128 | } | 135 | } |
| 129 | 136 | ||
| 130 | public void npd() { | 137 | public void npd() { |
| @@ -136,7 +143,7 @@ public class JAIR_PAGOdA { | |||
| 136 | , "npd.ans" | 143 | , "npd.ans" |
| 137 | ); | 144 | ); |
| 138 | 145 | ||
| 139 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/npd/pagoda"); | 146 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/npd/pagoda"); |
| 140 | } | 147 | } |
| 141 | 148 | ||
| 142 | public void reactome() throws IOException { | 149 | public void reactome() throws IOException { |
| @@ -151,7 +158,7 @@ public class JAIR_PAGOdA { | |||
| 151 | ); | 158 | ); |
| 152 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); | 159 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); |
| 153 | 160 | ||
| 154 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_10p"); | 161 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_10p"); |
| 155 | } | 162 | } |
| 156 | 163 | ||
| 157 | public void chembl() throws IOException { | 164 | public void chembl() throws IOException { |
| @@ -164,7 +171,7 @@ public class JAIR_PAGOdA { | |||
| 164 | , "pagoda_chembl.ans" | 171 | , "pagoda_chembl.ans" |
| 165 | ); | 172 | ); |
| 166 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_chembl.example"); | 173 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_chembl.example"); |
| 167 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_1p"); | 174 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_1p"); |
| 168 | } | 175 | } |
| 169 | 176 | ||
| 170 | public void uniprot() throws IOException { | 177 | public void uniprot() throws IOException { |
| @@ -178,16 +185,7 @@ public class JAIR_PAGOdA { | |||
| 178 | , "pagoda_uniprot.ans" | 185 | , "pagoda_uniprot.ans" |
| 179 | ); | 186 | ); |
| 180 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_uniprot.example"); | 187 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_uniprot.example"); |
| 181 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_1p"); | 188 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_1p"); |
| 182 | } | ||
| 183 | |||
| 184 | |||
| 185 | public static void main(String... args) { | ||
| 186 | try { | ||
| 187 | new JAIR_PAGOdA().lubm1(); | ||
| 188 | } catch (IOException e) { | ||
| 189 | e.printStackTrace(); | ||
| 190 | } | ||
| 191 | } | 189 | } |
| 192 | 190 | ||
| 193 | } | 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 index 687ffee..5feda35 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java | |||
| @@ -9,13 +9,18 @@ import java.io.IOException; | |||
| 9 | 9 | ||
| 10 | public class JAIR_Scalability { | 10 | public class JAIR_Scalability { |
| 11 | 11 | ||
| 12 | private static final String date = "_0123"; | 12 | private static final String date = "_0123"; |
| 13 | 13 | ||
| 14 | public static void main(String... args) throws IOException { | ||
| 15 | Properties.shellModeDefault = true; | ||
| 16 | new JAIR_Scalability().testUniProt(50, false); | ||
| 17 | } | ||
| 18 | |||
| 14 | @Test | 19 | @Test |
| 15 | public void reactome() throws IOException { | 20 | public void reactome() throws IOException { |
| 16 | testReactome(10, false); | 21 | testReactome(10, false); |
| 17 | } | 22 | } |
| 18 | 23 | ||
| 19 | @Test | 24 | @Test |
| 20 | public void chembl() throws IOException { | 25 | public void chembl() throws IOException { |
| 21 | testChEMBL(1, false); | 26 | testChEMBL(1, false); |
| @@ -31,15 +36,15 @@ public class JAIR_Scalability { | |||
| 31 | String[] args = new String[] { | 36 | String[] args = new String[] { |
| 32 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | 37 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), |
| 33 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl"), | 38 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl"), |
| 34 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/test.sparql") | 39 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/answersCorrectness.sparql") |
| 35 | , "reactome.ans" | 40 | , "reactome.ans" |
| 36 | }; | 41 | }; |
| 37 | if (percentage == 10) | 42 | if (percentage == 10) |
| 38 | args[1] = args[1].replace("simplifed", "reactome"); | 43 | args[1] = args[1].replace("simplifed", "reactome"); |
| 39 | 44 | ||
| 40 | PagodaTester.main(args); | 45 | PagodaTester.main(args); |
| 41 | if (save) | 46 | if (save) |
| 42 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_" + percentage + "p" + date); | 47 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_" + percentage + "p" + date); |
| 43 | } | 48 | } |
| 44 | 49 | ||
| 45 | public void testChEMBL(int percentage, boolean save) throws IOException { | 50 | public void testChEMBL(int percentage, boolean save) throws IOException { |
| @@ -48,18 +53,18 @@ public class JAIR_Scalability { | |||
| 48 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | 53 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), |
| 49 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/sample_" + percentage + ".nt"), | 54 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/sample_" + percentage + ".nt"), |
| 50 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | 55 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") |
| 51 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/test.sparql") | 56 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/answersCorrectness.sparql") |
| 52 | , "chembl.ans" | 57 | , "chembl.ans" |
| 53 | }; | 58 | }; |
| 54 | if (percentage == 1 || percentage == 10 || percentage == 50) | 59 | if (percentage == 1 || percentage == 10 || percentage == 50) |
| 55 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); | 60 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); |
| 56 | else | 61 | else |
| 57 | if (percentage == 100) | 62 | if (percentage == 100) |
| 58 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; | 63 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; |
| 59 | 64 | ||
| 60 | PagodaTester.main(args); | 65 | PagodaTester.main(args); |
| 61 | if (save) | 66 | if (save) |
| 62 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_" + percentage + "p" + date); | 67 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_" + percentage + "p" + date); |
| 63 | } | 68 | } |
| 64 | 69 | ||
| 65 | public void testUniProt(int percentage, boolean save) throws IOException { | 70 | public void testUniProt(int percentage, boolean save) throws IOException { |
| @@ -68,24 +73,19 @@ public class JAIR_Scalability { | |||
| 68 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | 73 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), |
| 69 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/sample_" + percentage + ".nt"), | 74 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/sample_" + percentage + ".nt"), |
| 70 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | 75 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") |
| 71 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/test.sparql") | 76 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/answersCorrectness.sparql") |
| 72 | , "uniprot.ans" | 77 | , "uniprot.ans" |
| 73 | }; | 78 | }; |
| 74 | 79 | ||
| 75 | if (percentage == 1 || percentage == 10 || percentage == 50) | 80 | if (percentage == 1 || percentage == 10 || percentage == 50) |
| 76 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); | 81 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); |
| 77 | else | 82 | else |
| 78 | if (percentage == 100) | 83 | if (percentage == 100) |
| 79 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; | 84 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; |
| 80 | 85 | ||
| 81 | PagodaTester.main(args); | 86 | PagodaTester.main(args); |
| 82 | if (save) | 87 | if (save) |
| 83 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uniprot/pagoda_" + percentage + "p" + date); | 88 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_" + percentage + "p" + date); |
| 84 | } | ||
| 85 | |||
| 86 | public static void main(String... args) throws IOException { | ||
| 87 | Properties.shellModeDefault = true; | ||
| 88 | new JAIR_Scalability().testUniProt(50, false); | ||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | } | 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 index b073a26..7fc5da8 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java | |||
| @@ -4,12 +4,13 @@ import org.testng.annotations.Test; | |||
| 4 | 4 | ||
| 5 | import java.io.IOException; | 5 | import java.io.IOException; |
| 6 | 6 | ||
| 7 | @Deprecated | ||
| 7 | public class LightEvaluation { | 8 | public class LightEvaluation { |
| 8 | 9 | ||
| 9 | @Test | 10 | @Test |
| 10 | public void evaluation() throws IOException { | 11 | public void evaluation() throws IOException { |
| 11 | new TestPagodaUOBM().test(1); | 12 | new TestPagodaUOBM().answersCorrectness(1); |
| 12 | new TestPagodaLUBM().test(100); | 13 | new TestPagodaLUBM().answersCorrecntess(100); |
| 13 | new TestPagodaFLY().test(); | 14 | new TestPagodaFLY().test(); |
| 14 | new TestPagodaDBPedia().test(); | 15 | new TestPagodaDBPedia().test(); |
| 15 | new TestPagodaNPD().testNPDwithoutDataType(); | 16 | new TestPagodaNPD().testNPDwithoutDataType(); |
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java index bb58681..8cbe022 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java | |||
| @@ -4,42 +4,57 @@ import org.testng.annotations.Test; | |||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | 4 | import uk.ac.ox.cs.pagoda.Pagoda; |
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; |
| 6 | 6 | ||
| 7 | import java.io.File; | ||
| 7 | import java.io.IOException; | 8 | import java.io.IOException; |
| 9 | import java.nio.file.Path; | ||
| 8 | import java.nio.file.Paths; | 10 | import java.nio.file.Paths; |
| 9 | 11 | ||
| 10 | public class TestPagodaLUBM { | 12 | public class TestPagodaLUBM { |
| 11 | 13 | ||
| 12 | public void test(int number) throws IOException { | 14 | /** |
| 15 | * Just execute on LUBM 100 | ||
| 16 | */ | ||
| 17 | public static void main(String... args) { | ||
| 18 | new TestPagodaLUBM().justExecute_100(); | ||
| 19 | } | ||
| 20 | |||
| 21 | public void answersCorrecntess(int number) throws IOException { | ||
| 13 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 22 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 23 | Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 24 | new File(computedAnswers.toString()).deleteOnExit(); | ||
| 25 | |||
| 14 | Pagoda pagoda = Pagoda.builder() | 26 | Pagoda pagoda = Pagoda.builder() |
| 15 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | 27 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) |
| 16 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | 28 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) |
| 17 | .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) | 29 | .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) |
| 30 | .answer(computedAnswers) | ||
| 18 | .classify(true) | 31 | .classify(true) |
| 19 | .hermit(true) | 32 | .hermit(true) |
| 20 | .build(); | 33 | .build(); |
| 21 | CheckAnswersOverDataset.check(pagoda, Paths.get(ontoDir, "lubm/lubm" + number + ".json")); | 34 | pagoda.run(); |
| 35 | |||
| 36 | Path givenAnswers = Paths.get(ontoDir, "lubm/lubm" + number + ".json"); | ||
| 37 | CheckAnswers.assertSameAnswers(computedAnswers, givenAnswers); | ||
| 22 | } | 38 | } |
| 23 | 39 | ||
| 24 | @Test | 40 | @Test(groups = {"light"}) |
| 25 | public void test_1() throws IOException { | 41 | public void answersCorrectness_1() throws IOException { |
| 26 | test(1); | 42 | answersCorrecntess(1); |
| 27 | } | 43 | } |
| 28 | 44 | ||
| 45 | /** | ||
| 46 | * Just execute on LUBM 100 | ||
| 47 | * */ | ||
| 29 | public void justExecute_100() { | 48 | public void justExecute_100() { |
| 30 | int number = 100; | 49 | int number = 100; |
| 31 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 50 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 32 | Pagoda pagoda = Pagoda.builder() | 51 | Pagoda pagoda = Pagoda.builder() |
| 33 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | 52 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) |
| 34 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | 53 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) |
| 35 | .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) | 54 | .query(Paths.get(ontoDir, "lubm/queries/answersCorrectness.sparql")) |
| 36 | .classify(true) | 55 | .classify(true) |
| 37 | .hermit(true) | 56 | .hermit(true) |
| 38 | .build(); | 57 | .build(); |
| 39 | pagoda.run(); | 58 | pagoda.run(); |
| 40 | } | 59 | } |
| 41 | |||
| 42 | public static void main(String... args) { | ||
| 43 | new TestPagodaLUBM().justExecute_100(); | ||
| 44 | } | ||
| 45 | } | 60 | } |
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java index 61235d3..23d79ab 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | |||
| @@ -6,48 +6,57 @@ import uk.ac.ox.cs.pagoda.Pagoda; | |||
| 6 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | 6 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; |
| 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; | 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; |
| 8 | 8 | ||
| 9 | import java.io.File; | ||
| 9 | import java.io.IOException; | 10 | import java.io.IOException; |
| 11 | import java.nio.file.Path; | ||
| 10 | import java.nio.file.Paths; | 12 | import java.nio.file.Paths; |
| 11 | 13 | ||
| 12 | import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; | 14 | import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; |
| 13 | 15 | ||
| 14 | public class TestPagodaUOBM { | 16 | public class TestPagodaUOBM { |
| 15 | 17 | ||
| 16 | public void test(int number) throws IOException { | 18 | |
| 19 | private static final int N_1 = 1; | ||
| 20 | private static final int N_2 = 10; | ||
| 21 | |||
| 22 | @DataProvider(name = "uobmNumbers") | ||
| 23 | public static Object[][] uobmNumbers() { | ||
| 24 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 25 | for(int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 26 | integers[i][0] = N_1 + i; | ||
| 27 | return integers; | ||
| 28 | } | ||
| 29 | |||
| 30 | public void answersCorrectness(int number) throws IOException { | ||
| 17 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 31 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 32 | Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 33 | new File(computedAnswers.toString()).deleteOnExit(); | ||
| 34 | |||
| 18 | Pagoda pagoda = Pagoda.builder() | 35 | Pagoda pagoda = Pagoda.builder() |
| 19 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | 36 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) |
| 20 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | 37 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) |
| 21 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) | 38 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) |
| 39 | .answer(computedAnswers) | ||
| 22 | .classify(true) | 40 | .classify(true) |
| 23 | .hermit(true) | 41 | .hermit(true) |
| 24 | .build(); | 42 | .build(); |
| 25 | CheckAnswersOverDataset.check(pagoda, | 43 | pagoda.run(); |
| 26 | Paths.get(ontoDir, "uobm/uobm" + number + ".json")); | ||
| 27 | } | ||
| 28 | 44 | ||
| 29 | @Test | 45 | String given_answers = "uobm/uobm" + number + ".json"; |
| 30 | public void test_1() throws IOException { | 46 | CheckAnswers.assertSameAnswers(computedAnswers, Paths.get(ontoDir, given_answers)); |
| 31 | test(1); | ||
| 32 | } | 47 | } |
| 33 | 48 | ||
| 34 | private static final int N_1 = 1; | 49 | @Test(groups = {"light"}) |
| 35 | private static final int N_2 = 10; | 50 | public void answersCorrectness_1() throws IOException { |
| 36 | 51 | answersCorrectness(1); | |
| 37 | @DataProvider(name = "uobmNumbers") | ||
| 38 | public static Object[][] uobmNumbers() { | ||
| 39 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 40 | for (int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 41 | integers[i][0]= N_1 + i; | ||
| 42 | return integers; | ||
| 43 | } | 52 | } |
| 44 | 53 | ||
| 45 | @Test(dataProvider = "uobmNumbers") | 54 | @Test(groups = {"heavy"}, dataProvider = "uobmNumbers") |
| 46 | public void justExecute(int number) { | 55 | public void justExecute(int number) { |
| 47 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 56 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 48 | PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | 57 | PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), |
| 49 | combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | 58 | combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), |
| 50 | combinePaths(ontoDir, "uobm/queries/test.sparql")); | 59 | combinePaths(ontoDir, "uobm/queries/answersCorrectness.sparql")); |
| 51 | } | 60 | } |
| 52 | 61 | ||
| 53 | } | 62 | } |
diff --git a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java index 7d9b49c..274946d 100644 --- a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java +++ b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java | |||
| @@ -1,46 +1,318 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.tester; | 1 | package uk.ac.ox.cs.pagoda.tester; |
| 2 | 2 | ||
| 3 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 4 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 3 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | 5 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; |
| 4 | import uk.ac.ox.cs.pagoda.util.Properties; | 6 | import uk.ac.ox.cs.pagoda.util.Properties; |
| 5 | import uk.ac.ox.cs.pagoda.util.Timer; | 7 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 6 | import uk.ac.ox.cs.pagoda.util.Utility; | 8 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 7 | 9 | ||
| 8 | // TODO clean it, or code another one | 10 | import java.io.File; |
| 11 | import java.io.FileNotFoundException; | ||
| 12 | import java.io.IOException; | ||
| 13 | import java.util.Scanner; | ||
| 14 | |||
| 15 | @Deprecated | ||
| 9 | public class PagodaTester { | 16 | public class PagodaTester { |
| 10 | 17 | ||
| 18 | // public static final String onto_dir = "/media/RDFData/yzhou/"; | ||
| 19 | // public static final String onto_dir = "/users/yzhou/ontologies/"; | ||
| 20 | // public static final String onto_dir = "/home/scratch/yzhou/ontologies/"; | ||
| 21 | public static final String onto_dir = "/home/alessandro/Big_files/Ontologies/"; | ||
| 22 | |||
| 23 | public static final String fly = onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"; | ||
| 24 | public static final String fly_query = onto_dir + "fly/queries/fly.sparql"; | ||
| 25 | |||
| 26 | public static final String test_tbox = onto_dir + "smallExampleFromAna/dummy.owl"; | ||
| 27 | public static final String test_abox = onto_dir + "smallExampleFromAna/initialABox.ttl"; | ||
| 28 | public static final String test_query = onto_dir + "smallExampleFromAna/queries.dlog"; | ||
| 29 | |||
| 30 | public static final int lubm_number = 1; | ||
| 31 | public static final String lubm_tbox = onto_dir + "lubm/univ-bench.owl"; | ||
| 32 | public static final String lubm_abox = onto_dir + "lubm/data/lubm" + lubm_number + ".ttl"; | ||
| 33 | public static final String lubm_abox_copy = onto_dir + "lubm/data/lubm" + lubm_number + " (copy).ttl"; | ||
| 34 | public static final String lubm_query = onto_dir + "lubm/queries/test.sparql"; | ||
| 35 | public static final String lubm_query6 = onto_dir + "lubm/queries/test_q6.sparql"; | ||
| 36 | public static final String lubm_query20 = onto_dir + "lubm/queries/test_q16.sparql"; | ||
| 37 | |||
| 38 | public static final int uobm_number = 1; | ||
| 39 | public static final String uobm_tbox = onto_dir + "uobm/univ-bench-dl.owl"; | ||
| 40 | public static final String uobm_abox = onto_dir + "uobm/data/uobm" + uobm_number + ".ttl"; | ||
| 41 | public static final String uobm_query = onto_dir + "uobm/queries/test.sparql"; | ||
| 42 | public static final String uobm_query_temp = onto_dir + "uobm/queries/temp.sparql"; | ||
| 43 | public static final String uobm_query2 = onto_dir + "uobm/queries/standard_q2.sparql"; | ||
| 44 | public static final String uobm_query9 = onto_dir + "uobm/queries/standard_q9.sparql"; | ||
| 45 | public static final String uobm_query11 = onto_dir + "uobm/queries/standard_q11.sparql"; | ||
| 46 | public static final String uobm_query12 = onto_dir + "uobm/queries/standard_q12.sparql"; | ||
| 47 | public static final String uobm_query14 = onto_dir + "uobm/queries/standard_q14.sparql"; | ||
| 48 | public static final String uobm_query15 = onto_dir + "uobm/queries/standard_q15.sparql"; | ||
| 49 | public static final String uobm_query_multi = onto_dir + "uobm/queries/standard_multi.sparql"; | ||
| 50 | public static final String uobm_generated_query1 = onto_dir + "uobm/queries/generated_q1.sparql"; | ||
| 51 | public static final String uobm_query_group3 = onto_dir + "uobm/queries/standard_group3.sparql"; | ||
| 52 | |||
| 53 | public static final String npd_tbox = onto_dir + "npd/npd-all-minus-datatype.owl"; | ||
| 54 | // "npd/npd-all.owl"; | ||
| 55 | // "npd-all-minus-datatype.owl"; | ||
| 56 | public static final String npd_abox = onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl"; | ||
| 57 | // "npd/data/npd-data-dump-processed.ttl"; | ||
| 58 | // "npd-data-dump-minus-datatype-old.ttl"; | ||
| 59 | public static final String npd_query = onto_dir + "npd/queries/atomic.sparql"; | ||
| 60 | |||
| 61 | public static final String npd_bench_tbox = onto_dir + "npd-benchmark/npd-v2-ql_a.owl"; | ||
| 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"; | ||
| 65 | public static final String npd_bench_query = onto_dir + "npd-benchmark/queries/all.sparql"; | ||
| 66 | |||
| 67 | public static final String dbpedia_tbox = onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"; | ||
| 68 | public static final String dbpedia_abox = onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl"; | ||
| 69 | public static final String dbpedia_query = onto_dir + "dbpedia/queries/atomic_ground.sparql"; | ||
| 70 | public static final String dbpedia_query274 = onto_dir + "dbpedia/atomic_q274.sparql"; | ||
| 71 | |||
| 72 | public static final String dbpedia_latest_tbox = onto_dir + "dbpedia/dbpedia_2014.owl"; | ||
| 73 | public static final String travel_tbox = onto_dir + "dbpedia/travel.owl"; | ||
| 74 | public static final String dbpedia_tbox_simple = onto_dir + "dbpedia/dbpedia_simple.owl"; | ||
| 75 | |||
| 76 | public static final String bioModels_tbox = onto_dir + "biomodels/biomodels-21.owl"; | ||
| 77 | public static final String bioModels_abox = onto_dir + "biomodels/data_processed_1.ttl"; | ||
| 78 | public static final String bioModels_queries = onto_dir + "biomodels/queries/queries.sparql"; | ||
| 79 | |||
| 80 | public static final String chembl_tbox = onto_dir + "bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl"; | ||
| 81 | public static final String chembl_abox = onto_dir + "bio2rdf/chembl/graph sampling old/sample_100.nt"; | ||
| 82 | public static final String chembl_queries = onto_dir + "bio2rdf/chembl/queries/problematic.sparql"; | ||
| 83 | //"bio2rdf/chembl/queries/atomic_one_filtered.sparql"; // | ||
| 84 | |||
| 85 | public static final String reactome_tbox = onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl"; | ||
| 86 | public static final String reactome_abox = onto_dir + "bio2rdf/reactome/graph sampling old/sample.ttl"; | ||
| 87 | //data/data.ttl"; //graph sampling old/reactome_sample_10.ttl"; // | ||
| 88 | public static final String reactome_queries = onto_dir + "bio2rdf/reactome/queries/atomic.sparql"; | ||
| 89 | |||
| 90 | public static final String uniprot_tbox = onto_dir + "bio2rdf/uniprot/core-processed.owl"; | ||
| 91 | public static final String uniprot_abox = onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt"; | ||
| 92 | public static final String uniprot_queries = onto_dir + "bio2rdf/uniprot/queries/atomic_one.sparql"; | ||
| 93 | |||
| 94 | public static final String atlas_tbox = onto_dir + "bio2rdf/atlas/gxaterms.owl"; | ||
| 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 | |||
| 11 | public static void main(String... args) { | 110 | public static void main(String... args) { |
| 12 | // Properties properties = new Properties(PagodaTester.class. | 111 | if(args.length == 0) { |
| 13 | // getClassLoader().getResource("uobm.properties").getPath()); | 112 | // args = new String[] {test_tbox, test_abox, test_query}; |
| 14 | Properties properties = new Properties(); | 113 | // args = new String[] {lubm_tbox, lubm_abox, lubm_query}; |
| 15 | 114 | // args = new String[] {uobm_tbox, uobm_abox, uobm_query}; | |
| 16 | int index = 0; | 115 | // args = new String[] {fly, "null", fly_query}; |
| 17 | if (args.length > index) properties.setOntologyPath(args[index++]); | 116 | // args = new String[] {dbpedia_tbox, dbpedia_abox, dbpedia_query}; |
| 18 | if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]); | 117 | // args = new String[] {travel_tbox, null, dbpedia_query274}; |
| 19 | if (args.length > index && args[index].endsWith(".sparql")) properties.setQueryPath(args[index++]); | 118 | args = new String[]{fly, fly_query}; |
| 20 | if (args.length > index && !args[index].startsWith("-")) properties.setAnswerPath(args[index++]); | 119 | // args = new String[] {npd_tbox, npd_abox, npd_query}; |
| 21 | if (args.length > index) properties.setToClassify(Boolean.parseBoolean(args[index++].substring(1))); | 120 | // args = new String[] {npd_bench_tbox, npd_bench_abox, npd_bench_query}; |
| 22 | if (args.length > index) properties.setToCallHermiT(Boolean.parseBoolean(args[index++].substring(1))); | 121 | // args = new String[] {"../SemFacet/WebContent/WEB-INF/data/dbpedia.owl", "../SemFacet/WebContent/WEB-INF/data/dbpediaA.nt", null}; |
| 23 | 122 | // args = new String[] {"../core/WebContent/WEB-INF/data/fly.owl", "../core/WebContent/WEB-INF/data/fly-data.nt", null}; | |
| 123 | // args = new String[] {"data/lubm/univ-bench.owl", "data/lubm/lubm1.ttl", "data/lubm/lubm.sparql", "lubm.ans"}; | ||
| 124 | // args = new String[] {"data/uobm/univ-bench-dl.owl", "data/uobm/uobm1.ttl", "data/uobm/uobm.sparql", "uobm.ans"}; | ||
| 125 | // args = new String[] {"data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", "data/fly/fly.sparql", "fly.ans"}; | ||
| 126 | // args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries}; | ||
| 127 | // args = new String[] {chembl_tbox, chembl_abox, chembl_queries}; | ||
| 128 | // args = new String[] {reactome_tbox, reactome_abox, reactome_queries}; | ||
| 129 | // args = new String[] {reactome_tbox, "/users/yzhou/temp/reactome_debug.ttl", onto_dir +"bio2rdf/reactome/queries/atomic_one_q65.sparql"}; | ||
| 130 | // args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), "/users/yzhou/temp/uniprot_debug/sample_1_string.nt", uniprot_queries}; | ||
| 131 | // args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), uniprot_abox, uniprot_queries}; | ||
| 132 | // args = new String[] {atlas_tbox, atlas_abox, atlas_queries}; | ||
| 133 | // args = new String[] {onto_dir + "test/unsatisfiable.owl", null, onto_dir + "test/unsatisfiable_queries.sparql"}; | ||
| 134 | // args = new String[] {onto_dir + "test/jair-example.owl", null, onto_dir + "test/jair-example_query.sparql"}; | ||
| 135 | // args[2] = args[2].replace(".sparql", "_all_pagoda.sparql"); | ||
| 136 | // args[2] = args[2].replace(".sparql", "_pellet.sparql"); | ||
| 137 | } | ||
| 138 | |||
| 139 | Properties properties = new Properties("config/uobm.properties"); | ||
| 140 | |||
| 141 | int index = 0; | ||
| 142 | if(args.length > index) properties.setOntologyPath(args[index++]); | ||
| 143 | if(args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) | ||
| 144 | properties.setDataPath(args[index++]); | ||
| 145 | if(args.length > index && args[index].endsWith(".sparql")) properties.setQueryPath(args[index++]); | ||
| 146 | if(args.length > index && !args[index].startsWith("-")) properties.setAnswerPath(args[index++]); | ||
| 147 | if(args.length > index) properties.setToClassify(Boolean.parseBoolean(args[index++].substring(1))); | ||
| 148 | if(args.length > index) properties.setToCallHermiT(Boolean.parseBoolean(args[index++].substring(1))); | ||
| 149 | |||
| 24 | Utility.logInfo("Ontology file: " + properties.getOntologyPath()); | 150 | Utility.logInfo("Ontology file: " + properties.getOntologyPath()); |
| 25 | Utility.logInfo("Data files: " + properties.getDataPath()); | 151 | Utility.logInfo("Data files: " + properties.getDataPath()); |
| 26 | Utility.logInfo("Query files: " + properties.getQueryPath()); | 152 | Utility.logInfo("Query files: " + properties.getQueryPath()); |
| 27 | Utility.logInfo("Answer file: " + properties.getAnswerPath()); | 153 | Utility.logInfo("Answer file: " + properties.getAnswerPath()); |
| 28 | 154 | ||
| 29 | QueryReasoner pagoda = null; | 155 | QueryReasoner pagoda = null; |
| 30 | 156 | ||
| 31 | try { | 157 | try { |
| 32 | Timer t = new Timer(); | 158 | Timer t = new Timer(); |
| 33 | pagoda = QueryReasoner.getInstance(properties); | 159 | pagoda = QueryReasoner.getInstance(properties); |
| 34 | if (pagoda == null) return; | 160 | if (pagoda == null) return; |
| 35 | 161 | ||
| 36 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | 162 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); |
| 37 | 163 | ||
| 38 | if (properties.getQueryPath() != null) | 164 | if (properties.getQueryPath() != null) |
| 39 | for (String queryFile: properties.getQueryPath().split(";")) | 165 | for (String queryFile: properties.getQueryPath().split(";")) |
| 40 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile)); | 166 | pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile)); |
| 167 | |||
| 168 | if(properties.getShellMode()) | ||
| 169 | try { | ||
| 170 | evaluateConsoleQuery(pagoda); | ||
| 171 | } catch(IOException e) { | ||
| 172 | e.printStackTrace(); | ||
| 173 | } | ||
| 41 | } finally { | 174 | } finally { |
| 42 | if (pagoda != null) pagoda.dispose(); | 175 | if (pagoda != null) pagoda.dispose(); |
| 43 | } | 176 | } |
| 177 | |||
| 178 | // Utility.closeCurrentOut(); | ||
| 179 | |||
| 180 | if(properties.getShellMode()) System.exit(0); | ||
| 181 | } | ||
| 182 | |||
| 183 | private static void evaluateConsoleQuery(QueryReasoner pagoda) throws IOException { | ||
| 184 | int ending = (int) '$', symbol; | ||
| 185 | while(true) { | ||
| 186 | Utility.logInfo("Input your query ending with $"); | ||
| 187 | StringBuilder queryBuilder = new StringBuilder(); | ||
| 188 | while((symbol = System.in.read()) != ending) { | ||
| 189 | queryBuilder.append((char) symbol); | ||
| 190 | } | ||
| 191 | System.in.read(); | ||
| 192 | if(queryBuilder.length() == 0) return; | ||
| 193 | pagoda.evaluate_shell(queryBuilder.toString()); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | void testReactomeQueries() { | ||
| 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> . }"); | ||
| 199 | evaluate("select ?y ?z where { <http://identifiers.org/ensembl/ENSG00000157557> ?y ?z . }"); | ||
| 200 | evaluate("select ?y where { <http://identifiers.org/ensembl/ENSG00000157557> <http://www.biopax.org/release/biopax-level3.owl#name> ?y . }", true); | ||
| 201 | |||
| 202 | } | ||
| 203 | |||
| 204 | void testSemFacetQueries() { | ||
| 205 | // try { | ||
| 206 | // BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("query.line"))); | ||
| 207 | // for (String line; (line = reader.readLine()) != null && !line.isEmpty(); ) | ||
| 208 | // evaluate(line, true); | ||
| 209 | // reader.close(); | ||
| 210 | // } catch (FileNotFoundException e) { | ||
| 211 | // e.printStackTrace(); | ||
| 212 | // } catch (IOException e) { | ||
| 213 | // e.printStackTrace(); | ||
| 214 | // } | ||
| 215 | evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true); | ||
| 216 | evaluate("select distinct ?y where { ?x ?y ?z }", true); | ||
| 217 | evaluate("select distinct ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true); | ||
| 218 | evaluate("select ?y ?z where { <http://www.reactome.org/biopax/46/49633#Protein3885> ?y ?z .}", true); | ||
| 219 | } | ||
| 220 | |||
| 221 | void testISGQueries() { | ||
| 222 | evaluate("select ?z where {<http://cs.ox.ac.uk/Evgeny_Kharlamov> <http://cs.ox.ac.uk/lat> ?z .}", false); | ||
| 223 | evaluate("select ?x where {?x <http://cs.ox.ac.uk/type> <http://cs.ox.ac.uk/person> .}", false); | ||
| 224 | } | ||
| 225 | |||
| 226 | void testSomeTravelQueries() { | ||
| 227 | evaluate("select ?y ?z where {<http://www.owl-ontologies.com/travel.owl#BlueMountains> ?y ?z. }", true); | ||
| 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>. }"); | ||
| 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>. }"); | ||
| 230 | } | ||
| 231 | |||
| 232 | void testSomeFlyQueries() { | ||
| 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); | ||
| 234 | |||
| 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); | ||
| 236 | |||
| 237 | evaluate("Select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | ||
| 238 | + "<http://purl.obolibrary.org/obo/FBbt_00067123>. ?x " | ||
| 239 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " | ||
| 240 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | ||
| 241 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); | ||
| 242 | |||
| 243 | evaluate("Select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | ||
| 244 | + "<http://purl.obolibrary.org/obo/FBbt_00067363> . ?x " | ||
| 245 | + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any " | ||
| 246 | + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> " | ||
| 247 | + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true); | ||
| 248 | |||
| 249 | // evaluate("Select ?x where { " | ||
| 250 | // + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00003660>. " | ||
| 251 | // + "?x <http://purl.obolibrary.org/obo/FBbt#develops_from> ?any . " | ||
| 252 | // + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00001446> . }", true); | ||
| 253 | |||
| 254 | evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/RO_0002110> ?any . " | ||
| 255 | + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . " | ||
| 256 | + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007016> . } ", true); | ||
| 257 | |||
| 258 | evaluate("Select * where {" | ||
| 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>. " | ||
| 260 | + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/2002/07/owl#sameAs> ?z }", true); | ||
| 261 | |||
| 262 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/2002/07/owl#sameAs> ?z}", true); | ||
| 263 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://purl.obolibrary.org/obo/BFO_0000051> ?z}", true); | ||
| 264 | |||
| 265 | evaluate("select DISTINCT ?y where { ?x ?y ?z . " | ||
| 266 | + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364> }", true); | ||
| 267 | |||
| 268 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs(1).log"); | ||
| 269 | evaluateQueriesFromFile("/users/yzhou/Downloads/logs.log"); | ||
| 270 | |||
| 271 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z}", true); | ||
| 272 | evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://xmlns.com/foaf/0.1/depicts> ?z}", true); | ||
| 273 | |||
| 274 | evaluate("select ?x ?z where { ?x <http://www.w3.org/2002/07/owl#sameAs> ?z } ", true); | ||
| 275 | evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z } ", true); | ||
| 276 | } | ||
| 277 | |||
| 278 | public void evaluateQueriesFromFile(String fileName) { | ||
| 279 | Scanner scanner = null; | ||
| 280 | try { | ||
| 281 | scanner = new Scanner(new File(fileName)); | ||
| 282 | String line; | ||
| 283 | while(scanner.hasNextLine()) { | ||
| 284 | line = scanner.nextLine(); | ||
| 285 | if(line.startsWith("select")) | ||
| 286 | evaluate(line, true); | ||
| 287 | } | ||
| 288 | } catch(FileNotFoundException e) { | ||
| 289 | e.printStackTrace(); | ||
| 290 | } finally { | ||
| 291 | if(scanner != null) | ||
| 292 | scanner.close(); | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 296 | private void evaluate(String query) { | ||
| 297 | evaluate(query, false); | ||
| 298 | } | ||
| 299 | |||
| 300 | private void evaluate(String query, boolean tag) { | ||
| 301 | timer.reset(); | ||
| 302 | AnswerTuples tuples = pagoda.evaluate(query, tag); | ||
| 303 | int arity = tuples.getArity(); | ||
| 304 | int count = 0; | ||
| 305 | for(AnswerTuple tuple; tuples.isValid(); tuples.moveNext()) { | ||
| 306 | tuple = tuples.getTuple(); | ||
| 307 | for(int i = 0; i < arity; ++i) | ||
| 308 | tuple.getGroundTerm(i).toString(); | ||
| 309 | // System.out.print(tuple.getGroundTerm(i).toString() + "\t"); | ||
| 310 | // System.out.println(); | ||
| 311 | ++count; | ||
| 312 | } | ||
| 313 | tuples.dispose(); | ||
| 314 | Utility.logInfo("The number of answers for this SemFacet query: " + count); | ||
| 315 | Utility.logInfo("Total time for this SemFacet query: " + timer.duration()); | ||
| 44 | } | 316 | } |
| 45 | 317 | ||
| 46 | } | 318 | } |
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 index 1802147..ad0d494 100644 --- a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java +++ b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java | |||
| @@ -26,8 +26,7 @@ public class TestUtil { | |||
| 26 | 26 | ||
| 27 | public static Properties getConfig() { | 27 | public static Properties getConfig() { |
| 28 | if(!isConfigLoaded) { | 28 | if(!isConfigLoaded) { |
| 29 | try (InputStream in = TestUtil.class.getClassLoader() | 29 | try(InputStream in = TestUtil.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { |
| 30 | .getResourceAsStream(CONFIG_FILE)) { | ||
| 31 | config = new java.util.Properties(); | 30 | config = new java.util.Properties(); |
| 32 | config.load(in); | 31 | config.load(in); |
| 33 | in.close(); | 32 | in.close(); |
