diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-15 17:32:22 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-15 17:32:22 +0100 |
| commit | 1b6a128137e5d7a6ff75566869232fc054afabef (patch) | |
| tree | 3def49c3c9c1e2ebebc49b82d9eb562b6d097cad /test/uk/ac/ox/cs/pagoda/global_tests | |
| parent | bd995407098d1b0c79c17a28b0b23a2c24a493c6 (diff) | |
| download | ACQuA-1b6a128137e5d7a6ff75566869232fc054afabef.tar.gz ACQuA-1b6a128137e5d7a6ff75566869232fc054afabef.zip | |
Testing and fixing. Executed successfully on UOBM{1,2,3,4,5,6,7,8}.
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/global_tests')
14 files changed, 925 insertions, 0 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/ClauseTester.java b/test/uk/ac/ox/cs/pagoda/global_tests/ClauseTester.java new file mode 100644 index 0000000..abd0741 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/ClauseTester.java | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.semanticweb.HermiT.model.*; | ||
| 4 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 5 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 6 | import org.semanticweb.owlapi.model.OWLOntologyManager; | ||
| 7 | import org.testng.Assert; | ||
| 8 | import org.testng.annotations.Test; | ||
| 9 | import uk.ac.ox.cs.pagoda.approx.Clause; | ||
| 10 | import uk.ac.ox.cs.pagoda.approx.Clausifier; | ||
| 11 | |||
| 12 | public class ClauseTester { | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void test_simple() { | ||
| 16 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); | ||
| 17 | AtomicConcept A = AtomicConcept.create("A"); | ||
| 18 | AtomicRole r = AtomicRole.create("r"); | ||
| 19 | Atom[] bodyAtoms = new Atom[] { | ||
| 20 | Atom.create(A, x), | ||
| 21 | Atom.create(r, x, y1), | ||
| 22 | Atom.create(r, x, y2) | ||
| 23 | }; | ||
| 24 | |||
| 25 | Atom[] headAtoms = new Atom[] { | ||
| 26 | Atom.create(Equality.INSTANCE, y1, y2) | ||
| 27 | }; | ||
| 28 | |||
| 29 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | ||
| 30 | OWLOntology emptyOntology = null; | ||
| 31 | try { | ||
| 32 | emptyOntology = m.createOntology(); | ||
| 33 | } catch (Exception e) { | ||
| 34 | e.printStackTrace(); | ||
| 35 | Assert.fail("failed to create a new ontology"); | ||
| 36 | } | ||
| 37 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | ||
| 38 | System.out.println(c.toString()); | ||
| 39 | } | ||
| 40 | |||
| 41 | @Test | ||
| 42 | public void test_more() { | ||
| 43 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"), y3 = Variable.create("y3"); | ||
| 44 | AtomicConcept A = AtomicConcept.create("A"); | ||
| 45 | AtomicRole r = AtomicRole.create("r"); | ||
| 46 | Atom[] bodyAtoms = new Atom[] { | ||
| 47 | Atom.create(A, x), | ||
| 48 | Atom.create(r, x, y1), | ||
| 49 | Atom.create(r, x, y2), | ||
| 50 | Atom.create(r, x, y3), | ||
| 51 | }; | ||
| 52 | |||
| 53 | Atom[] headAtoms = new Atom[] { | ||
| 54 | Atom.create(Equality.INSTANCE, y1, y2), | ||
| 55 | Atom.create(Equality.INSTANCE, y1, y3), | ||
| 56 | Atom.create(Equality.INSTANCE, y2, y3) | ||
| 57 | }; | ||
| 58 | |||
| 59 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | ||
| 60 | OWLOntology emptyOntology = null; | ||
| 61 | try { | ||
| 62 | emptyOntology = m.createOntology(); | ||
| 63 | } catch (Exception e) { | ||
| 64 | e.printStackTrace(); | ||
| 65 | Assert.fail("failed to create a new ontology"); | ||
| 66 | } | ||
| 67 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | ||
| 68 | System.out.println(c.toString()); | ||
| 69 | } | ||
| 70 | |||
| 71 | @Test | ||
| 72 | public void test_inverse() { | ||
| 73 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); | ||
| 74 | AtomicConcept A = AtomicConcept.create("A"); | ||
| 75 | AtomicRole r = AtomicRole.create("r"); | ||
| 76 | Atom[] bodyAtoms = new Atom[] { | ||
| 77 | Atom.create(A, x), | ||
| 78 | Atom.create(r, y1, x), | ||
| 79 | Atom.create(r, y2, x) | ||
| 80 | }; | ||
| 81 | |||
| 82 | Atom[] headAtoms = new Atom[] { | ||
| 83 | Atom.create(Equality.INSTANCE, y1, y2) | ||
| 84 | }; | ||
| 85 | |||
| 86 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | ||
| 87 | OWLOntology emptyOntology = null; | ||
| 88 | try { | ||
| 89 | emptyOntology = m.createOntology(); | ||
| 90 | } catch (Exception e) { | ||
| 91 | e.printStackTrace(); | ||
| 92 | Assert.fail("failed to create a new ontology"); | ||
| 93 | } | ||
| 94 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | ||
| 95 | System.out.println(c.toString()); | ||
| 96 | } | ||
| 97 | |||
| 98 | @Test | ||
| 99 | public void test_fillter() { | ||
| 100 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); | ||
| 101 | AtomicConcept A = AtomicConcept.create("A"); | ||
| 102 | AtomicConcept B = AtomicConcept.create("B"); | ||
| 103 | AtomicRole r = AtomicRole.create("r"); | ||
| 104 | Atom[] bodyAtoms = new Atom[] { | ||
| 105 | Atom.create(A, x), | ||
| 106 | Atom.create(r, y1, x), | ||
| 107 | Atom.create(r, y2, x), | ||
| 108 | Atom.create(B, y1), | ||
| 109 | Atom.create(B, y2) | ||
| 110 | }; | ||
| 111 | |||
| 112 | Atom[] headAtoms = new Atom[] { | ||
| 113 | Atom.create(Equality.INSTANCE, y1, y2) | ||
| 114 | }; | ||
| 115 | |||
| 116 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | ||
| 117 | OWLOntology emptyOntology = null; | ||
| 118 | try { | ||
| 119 | emptyOntology = m.createOntology(); | ||
| 120 | } catch (Exception e) { | ||
| 121 | e.printStackTrace(); | ||
| 122 | Assert.fail("failed to create a new ontology"); | ||
| 123 | } | ||
| 124 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | ||
| 125 | System.out.println(c.toString()); | ||
| 126 | } | ||
| 127 | |||
| 128 | @Test | ||
| 129 | public void test_negFillter() { | ||
| 130 | Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"); | ||
| 131 | AtomicConcept A = AtomicConcept.create("A"); | ||
| 132 | AtomicConcept B = AtomicConcept.create("B"); | ||
| 133 | AtomicRole r = AtomicRole.create("r"); | ||
| 134 | Atom[] bodyAtoms = new Atom[] { | ||
| 135 | Atom.create(A, x), | ||
| 136 | Atom.create(r, y1, x), | ||
| 137 | Atom.create(r, y2, x) | ||
| 138 | }; | ||
| 139 | |||
| 140 | Atom[] headAtoms = new Atom[] { | ||
| 141 | Atom.create(Equality.INSTANCE, y1, y2), | ||
| 142 | Atom.create(B, y1), | ||
| 143 | Atom.create(B, y2) | ||
| 144 | }; | ||
| 145 | |||
| 146 | OWLOntologyManager m = OWLManager.createOWLOntologyManager(); | ||
| 147 | OWLOntology emptyOntology = null; | ||
| 148 | try { | ||
| 149 | emptyOntology = m.createOntology(); | ||
| 150 | } catch (Exception e) { | ||
| 151 | e.printStackTrace(); | ||
| 152 | Assert.fail("failed to create a new ontology"); | ||
| 153 | } | ||
| 154 | Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms)); | ||
| 155 | System.out.println(c.toString()); | ||
| 156 | } | ||
| 157 | |||
| 158 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java new file mode 100644 index 0000000..01e8203 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 4 | import org.testng.annotations.Test; | ||
| 5 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 6 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 7 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type; | ||
| 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; | ||
| 11 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 12 | |||
| 13 | public class CostEvaluation { | ||
| 14 | |||
| 15 | @Test | ||
| 16 | public void lubm100() { | ||
| 17 | int number = 1; | ||
| 18 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 19 | PagodaTester.main( | ||
| 20 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 21 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), | ||
| 22 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql") | ||
| 23 | ); | ||
| 24 | // AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); | ||
| 25 | } | ||
| 26 | |||
| 27 | public void lubm1000() { | ||
| 28 | int number = 1000; | ||
| 29 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 30 | String[] args = new String[] { | ||
| 31 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 32 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), | ||
| 33 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql") | ||
| 34 | }; | ||
| 35 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | ||
| 36 | QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); | ||
| 37 | Timer t = new Timer(); | ||
| 38 | reasoner.loadOntology(ontology); | ||
| 39 | reasoner.importData(args[1]); | ||
| 40 | if (!reasoner.preprocess()) | ||
| 41 | return ; | ||
| 42 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | ||
| 43 | |||
| 44 | reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); | ||
| 45 | // AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); | ||
| 46 | } | ||
| 47 | |||
| 48 | @Test | ||
| 49 | public void uobm5() { | ||
| 50 | int number = 1; | ||
| 51 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 52 | String[] args = new String[] { | ||
| 53 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 54 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 55 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql") | ||
| 56 | }; | ||
| 57 | PagodaTester.main(args); | ||
| 58 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); | ||
| 59 | } | ||
| 60 | |||
| 61 | public void uobm100() { | ||
| 62 | int number = 200; | ||
| 63 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 64 | String[] args = new String[] { | ||
| 65 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 66 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 67 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_group3_all.sparql") | ||
| 68 | }; | ||
| 69 | PagodaTester.main(args); | ||
| 70 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); | ||
| 71 | } | ||
| 72 | |||
| 73 | public void uobm500() { | ||
| 74 | int number = 500; | ||
| 75 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 76 | String[] args = new String[] { | ||
| 77 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 78 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 79 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql") | ||
| 80 | }; | ||
| 81 | |||
| 82 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | ||
| 83 | QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); | ||
| 84 | Timer t = new Timer(); | ||
| 85 | reasoner.loadOntology(ontology); | ||
| 86 | reasoner.importData(args[1]); | ||
| 87 | if (!reasoner.preprocess()) | ||
| 88 | return ; | ||
| 89 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | ||
| 90 | |||
| 91 | reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); | ||
| 92 | // AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | public static void main(String... args) { | ||
| 97 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 98 | args = new String[] { | ||
| 99 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 100 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 101 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql") | ||
| 102 | }; | ||
| 103 | |||
| 104 | OWLOntology ontology = OWLHelper.loadOntology(args[0]); | ||
| 105 | QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); | ||
| 106 | Timer t = new Timer(); | ||
| 107 | reasoner.loadOntology(ontology); | ||
| 108 | reasoner.importData(args[1]); | ||
| 109 | if (!reasoner.preprocess()) | ||
| 110 | return ; | ||
| 111 | Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds."); | ||
| 112 | |||
| 113 | reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2])); | ||
| 114 | } | ||
| 115 | } | ||
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..0d77fdb --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java | |||
| @@ -0,0 +1,193 @@ | |||
| 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 | @Test | ||
| 12 | public void lubm1() throws IOException { | ||
| 13 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 14 | String[] args = new String[] { | ||
| 15 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 16 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 17 | TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql") | ||
| 18 | }; | ||
| 19 | PagodaTester.main(args); | ||
| 20 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda"); | ||
| 21 | } | ||
| 22 | |||
| 23 | @Test | ||
| 24 | public void lubm1_conj() throws IOException { | ||
| 25 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 26 | String[] args = new String[] { | ||
| 27 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 28 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 29 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_pellet.sparql") | ||
| 30 | }; | ||
| 31 | PagodaTester.main(args); | ||
| 32 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_conj"); | ||
| 33 | } | ||
| 34 | |||
| 35 | @Test | ||
| 36 | public void lubm1_rolledUp() throws IOException { | ||
| 37 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 38 | PagodaTester.main( | ||
| 39 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", | ||
| 40 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 41 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") | ||
| 42 | ); | ||
| 43 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/lubm1/pagoda_rolledUp"); | ||
| 44 | } | ||
| 45 | |||
| 46 | @Test | ||
| 47 | public void uobm1() throws IOException { | ||
| 48 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 49 | String[] args = new String[] { | ||
| 50 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 51 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 52 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 53 | }; | ||
| 54 | PagodaTester.main(args); | ||
| 55 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda"); | ||
| 56 | } | ||
| 57 | |||
| 58 | @Test | ||
| 59 | public void uobm1_conj() throws IOException { | ||
| 60 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 61 | String[] args = new String[] { | ||
| 62 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 63 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 64 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_pellet.sparql") | ||
| 65 | }; | ||
| 66 | PagodaTester.main(args); | ||
| 67 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_conj"); | ||
| 68 | } | ||
| 69 | |||
| 70 | @Test | ||
| 71 | public void uobm1_rolledUp() { | ||
| 72 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 73 | String[] args = new String[] { | ||
| 74 | "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", | ||
| 75 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 76 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") | ||
| 77 | }; | ||
| 78 | PagodaTester.main(args); | ||
| 79 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/uobm1/pagoda_rolledUp"); | ||
| 80 | } | ||
| 81 | |||
| 82 | @Test | ||
| 83 | public void fly() { | ||
| 84 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 85 | String[] args = new String[] { | ||
| 86 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 87 | null, | ||
| 88 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 89 | }; | ||
| 90 | PagodaTester.main(args); | ||
| 91 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda"); | ||
| 92 | } | ||
| 93 | |||
| 94 | @Test | ||
| 95 | public void fly_conj() throws IOException { | ||
| 96 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 97 | String[] args = new String[] { | ||
| 98 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 99 | null, | ||
| 100 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 101 | }; | ||
| 102 | PagodaTester.main(args); | ||
| 103 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_conj"); | ||
| 104 | } | ||
| 105 | |||
| 106 | |||
| 107 | public void fly_rolledUp() { | ||
| 108 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 109 | PagodaTester.main( | ||
| 110 | // TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 111 | TestUtil.combinePaths(ontoDir, "fly/fly-all-in-one_rolledUp.owl"), | ||
| 112 | null, | ||
| 113 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql") | ||
| 114 | ); | ||
| 115 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/fly/pagoda_rolledUp"); | ||
| 116 | } | ||
| 117 | |||
| 118 | public void dbpedia() { | ||
| 119 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 120 | PagodaTester.main( | ||
| 121 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 122 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 123 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql"), | ||
| 124 | "dbpedia.ans" | ||
| 125 | ); | ||
| 126 | |||
| 127 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/dbpedia/pagoda"); | ||
| 128 | } | ||
| 129 | |||
| 130 | public void npd() { | ||
| 131 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 132 | PagodaTester.main( | ||
| 133 | TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"), | ||
| 134 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | ||
| 135 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql") | ||
| 136 | , "npd.ans" | ||
| 137 | ); | ||
| 138 | |||
| 139 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/npd/pagoda"); | ||
| 140 | } | ||
| 141 | |||
| 142 | public void reactome() throws IOException { | ||
| 143 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 144 | PagodaTester.main( | ||
| 145 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 146 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"), | ||
| 147 | // null, | ||
| 148 | // TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql") | ||
| 149 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/example.sparql") | ||
| 150 | , "pagoda_reactome.ans" | ||
| 151 | ); | ||
| 152 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); | ||
| 153 | |||
| 154 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_10p"); | ||
| 155 | } | ||
| 156 | |||
| 157 | public void chembl() throws IOException { | ||
| 158 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 159 | PagodaTester.main( | ||
| 160 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 161 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"), | ||
| 162 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 163 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/example.sparql") | ||
| 164 | , "pagoda_chembl.ans" | ||
| 165 | ); | ||
| 166 | 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"); | ||
| 168 | } | ||
| 169 | |||
| 170 | public void uniprot() throws IOException { | ||
| 171 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 172 | PagodaTester.main( | ||
| 173 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 174 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"), | ||
| 175 | // null, | ||
| 176 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 177 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/example.sparql") | ||
| 178 | , "pagoda_uniprot.ans" | ||
| 179 | ); | ||
| 180 | 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"); | ||
| 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 | } | ||
| 192 | |||
| 193 | } | ||
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..cdf55bd --- /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.Properties; | ||
| 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 | @Test | ||
| 15 | public void reactome() throws IOException { | ||
| 16 | testReactome(10, false); | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void chembl() throws IOException { | ||
| 21 | testChEMBL(1, false); | ||
| 22 | } | ||
| 23 | |||
| 24 | @Test | ||
| 25 | public void uniprot() throws IOException { | ||
| 26 | testUniProt(1, false); | ||
| 27 | } | ||
| 28 | |||
| 29 | public void testReactome(int percentage, boolean save) throws IOException { | ||
| 30 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 31 | String[] args = new String[] { | ||
| 32 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 33 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl"), | ||
| 34 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/test.sparql") | ||
| 35 | , "reactome.ans" | ||
| 36 | }; | ||
| 37 | if (percentage == 10) | ||
| 38 | args[1] = args[1].replace("simplifed", "reactome"); | ||
| 39 | |||
| 40 | PagodaTester.main(args); | ||
| 41 | if (save) | ||
| 42 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/reactome/pagoda_" + percentage + "p" + date); | ||
| 43 | } | ||
| 44 | |||
| 45 | public void testChEMBL(int percentage, boolean save) throws IOException { | ||
| 46 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 47 | String[] args = new String[] { | ||
| 48 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 49 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/sample_" + percentage + ".nt"), | ||
| 50 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 51 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/test.sparql") | ||
| 52 | , "chembl.ans" | ||
| 53 | }; | ||
| 54 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 55 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); | ||
| 56 | else | ||
| 57 | if (percentage == 100) | ||
| 58 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; | ||
| 59 | |||
| 60 | PagodaTester.main(args); | ||
| 61 | if (save) | ||
| 62 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-share/results_new/chembl/pagoda_" + percentage + "p" + date); | ||
| 63 | } | ||
| 64 | |||
| 65 | public void testUniProt(int percentage, boolean save) throws IOException { | ||
| 66 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 67 | String[] args = new String[] { | ||
| 68 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 69 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/sample_" + percentage + ".nt"), | ||
| 70 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 71 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/test.sparql") | ||
| 72 | , "uniprot.ans" | ||
| 73 | }; | ||
| 74 | |||
| 75 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 76 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); | ||
| 77 | else | ||
| 78 | if (percentage == 100) | ||
| 79 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; | ||
| 80 | |||
| 81 | PagodaTester.main(args); | ||
| 82 | if (save) | ||
| 83 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/test-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 | } | ||
| 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..3ee268e --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.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 LightEvaluation { | ||
| 10 | |||
| 11 | @Test | ||
| 12 | public void uobm1() throws IOException { | ||
| 13 | int number = 1; | ||
| 14 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 15 | PagodaTester.main( | ||
| 16 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 17 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 18 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 19 | ); | ||
| 20 | TestUtil.copyFile("log4j.log", "output/jair/uobm1.out"); | ||
| 21 | } | ||
| 22 | |||
| 23 | @Test | ||
| 24 | public void lubm100() throws IOException { | ||
| 25 | int number = 100; | ||
| 26 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 27 | PagodaTester.main( | ||
| 28 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 29 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"), | ||
| 30 | TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql") | ||
| 31 | ); | ||
| 32 | TestUtil.copyFile("log4j.log", "results-backup/current/lubm100.out"); | ||
| 33 | } | ||
| 34 | |||
| 35 | @Test | ||
| 36 | public void fly() throws IOException { | ||
| 37 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 38 | PagodaTester.main( | ||
| 39 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 40 | TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql") | ||
| 41 | ); | ||
| 42 | TestUtil.copyFile("log4j.log", "results-backup/current/fly.out"); | ||
| 43 | } | ||
| 44 | |||
| 45 | @Test | ||
| 46 | public void dbpedia() throws IOException { | ||
| 47 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 48 | PagodaTester.main( | ||
| 49 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 50 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 51 | TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql") | ||
| 52 | ); | ||
| 53 | TestUtil.copyFile("log4j.log", "results-backup/current/dbpedia.out"); | ||
| 54 | } | ||
| 55 | |||
| 56 | @Test | ||
| 57 | public void npdWithoutDataType() throws IOException { | ||
| 58 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 59 | PagodaTester.main( | ||
| 60 | TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"), | ||
| 61 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | ||
| 62 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql") | ||
| 63 | ); | ||
| 64 | TestUtil.copyFile("log4j.log", "results-backup/current/npd_minus.out"); | ||
| 65 | } | ||
| 66 | |||
| 67 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java new file mode 100644 index 0000000..2b9cdbd --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | |||
| 10 | import static org.junit.Assert.fail; | ||
| 11 | |||
| 12 | public class PagodaDBPedia { | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void test() throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | PagodaTester.main( | ||
| 18 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 19 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 20 | TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql") | ||
| 21 | ); | ||
| 22 | |||
| 23 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 24 | String diff = stat.diff("results-backup/benchmark/dbpedia.out"); | ||
| 25 | TestUtil.copyFile("output/log4j.log", "results-backup/current/dbpedia.out"); | ||
| 26 | if (!diff.isEmpty()) | ||
| 27 | fail(diff); | ||
| 28 | } | ||
| 29 | |||
| 30 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java new file mode 100644 index 0000000..da059f9 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | public class PagodaELU { | ||
| 8 | |||
| 9 | @Test void test() { | ||
| 10 | int number = 1; | ||
| 11 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 12 | PagodaTester.main( | ||
| 13 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 14 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 15 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 16 | ); | ||
| 17 | } | ||
| 18 | |||
| 19 | |||
| 20 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java new file mode 100644 index 0000000..d558e0f --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | public class PagodaFLY { | ||
| 8 | |||
| 9 | @Test | ||
| 10 | public void test() { | ||
| 11 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 12 | PagodaTester.main( | ||
| 13 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 14 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 15 | ); | ||
| 16 | |||
| 17 | // Statistics stat = new Statistics("output/log4j.log"); | ||
| 18 | // String diff = stat.diff("results-backup/benchmark/fly.out"); | ||
| 19 | // AllTests.copy("output/log4j.log", "results-backup/current/fly.out"); | ||
| 20 | // if (!diff.isEmpty()) | ||
| 21 | // fail(diff); | ||
| 22 | } | ||
| 23 | |||
| 24 | |||
| 25 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java new file mode 100644 index 0000000..2014ec1 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 5 | |||
| 6 | import java.io.IOException; | ||
| 7 | import java.nio.file.Paths; | ||
| 8 | |||
| 9 | public class PagodaLUBM { | ||
| 10 | |||
| 11 | private void testN(int number ) throws IOException { | ||
| 12 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 13 | TestGlobalCorrectness.test(Paths.get(ontoDir, "lubm/univ-bench.owl"), | ||
| 14 | Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"), | ||
| 15 | Paths.get(ontoDir, "lubm/queries/test.sparql"), | ||
| 16 | Paths.get(ontoDir, "lubm/lubm" + number + ".json")); | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void test1() throws IOException { | ||
| 21 | testN(1); | ||
| 22 | } | ||
| 23 | |||
| 24 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java new file mode 100644 index 0000000..17d1e82 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | |||
| 10 | import static org.junit.Assert.fail; | ||
| 11 | |||
| 12 | public class PagodaNPD { | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void testNPDwithoutDataType() throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | PagodaTester.main( | ||
| 18 | TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"), | ||
| 19 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | ||
| 20 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql") | ||
| 21 | ); | ||
| 22 | |||
| 23 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 24 | String diff = stat.diff("results-backup/benchmark/npd_minus.out"); | ||
| 25 | TestUtil.copyFile("output/log4j.log", "results-backup/current/npd_minus.out"); | ||
| 26 | if (!diff.isEmpty()) | ||
| 27 | fail(diff); | ||
| 28 | } | ||
| 29 | |||
| 30 | @Test | ||
| 31 | public void testNPD() throws IOException { | ||
| 32 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 33 | PagodaTester.main( | ||
| 34 | TestUtil.combinePaths(ontoDir, "npd/npd-all.owl"), | ||
| 35 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-processed.ttl"), | ||
| 36 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql") | ||
| 37 | ); | ||
| 38 | |||
| 39 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 40 | String diff = stat.diff("results-backup/benchmark/npd.out"); | ||
| 41 | TestUtil.copyFile("output/log4j.log", "results-backup/current/npd.out"); | ||
| 42 | if (!diff.isEmpty()) | ||
| 43 | fail(diff); | ||
| 44 | } | ||
| 45 | |||
| 46 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java new file mode 100644 index 0000000..c908cb4 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.tester.Statistics; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | |||
| 10 | import static org.junit.Assert.fail; | ||
| 11 | |||
| 12 | public class PagodaNPD_bench { | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void test() throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | PagodaTester.main( | ||
| 18 | TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.owl"), | ||
| 19 | TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.ttl"), | ||
| 20 | TestUtil.combinePaths(ontoDir, "npd-benchmark/queries/all.sparql") | ||
| 21 | ); | ||
| 22 | |||
| 23 | Statistics stat = new Statistics("output/log4j.log"); | ||
| 24 | String diff = stat.diff("results-backup/benchmark/npd-bench.out"); | ||
| 25 | TestUtil.copyFile("output/log4j.log", "results-backup/current/npd-bench.out"); | ||
| 26 | if (!diff.isEmpty()) | ||
| 27 | fail(diff); | ||
| 28 | } | ||
| 29 | |||
| 30 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java new file mode 100644 index 0000000..88e0835 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.junit.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | public class PagodaRLU { | ||
| 8 | |||
| 9 | @Test | ||
| 10 | public void testRL() { | ||
| 11 | int number = 1; | ||
| 12 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 13 | PagodaTester.main( | ||
| 14 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 15 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 16 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 17 | ); | ||
| 18 | } | ||
| 19 | |||
| 20 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java new file mode 100644 index 0000000..065fb29 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java | |||
| @@ -0,0 +1,53 @@ | |||
| 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.tester.PagodaTester; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | import java.nio.file.Paths; | ||
| 10 | |||
| 11 | import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; | ||
| 12 | |||
| 13 | public class PagodaUOBM { | ||
| 14 | |||
| 15 | private void testN(int number ) throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | TestGlobalCorrectness.test(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 18 | Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 19 | Paths.get(ontoDir, "uobm/queries/test.sparql"), | ||
| 20 | Paths.get(ontoDir, "uobm/uobm" + number + ".json")); | ||
| 21 | } | ||
| 22 | |||
| 23 | @Test | ||
| 24 | public void test1() throws IOException { | ||
| 25 | testN(1); | ||
| 26 | } | ||
| 27 | |||
| 28 | private static final int N_1 = 8; | ||
| 29 | private static final int N_2 = 10; | ||
| 30 | |||
| 31 | |||
| 32 | @DataProvider(name = "uobmNumbers") | ||
| 33 | public static Object[][] uobmNumbers() { | ||
| 34 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 35 | for (int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 36 | integers[i][0]= N_1 + i; | ||
| 37 | return integers; | ||
| 38 | } | ||
| 39 | |||
| 40 | // @Test | ||
| 41 | // public void justExecute3() { | ||
| 42 | // justExecute(1); | ||
| 43 | // } | ||
| 44 | |||
| 45 | @Test(dataProvider = "uobmNumbers") | ||
| 46 | public void justExecute(int number) { | ||
| 47 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 48 | PagodaTester.main(combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 49 | combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), | ||
| 50 | combinePaths(ontoDir, "uobm/queries/test.sparql")); | ||
| 51 | } | ||
| 52 | |||
| 53 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java new file mode 100644 index 0000000..dff2366 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java | |||
| @@ -0,0 +1,53 @@ | |||
| 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.apache.log4j.Level; | ||
| 6 | import org.testng.Assert; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 8 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 9 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 10 | |||
| 11 | import java.io.BufferedReader; | ||
| 12 | import java.io.File; | ||
| 13 | import java.io.IOException; | ||
| 14 | import java.lang.reflect.Type; | ||
| 15 | import java.nio.file.Files; | ||
| 16 | import java.nio.file.Path; | ||
| 17 | import java.nio.file.Paths; | ||
| 18 | import java.util.Set; | ||
| 19 | |||
| 20 | /** | ||
| 21 | * This is a unit test for TestNG. | ||
| 22 | * <p> | ||
| 23 | * It tests the correctness on the final output. | ||
| 24 | * */ | ||
| 25 | public class TestGlobalCorrectness { | ||
| 26 | |||
| 27 | public static void test(Path ontology, Path data, Path queries, Path givenAnswers) { | ||
| 28 | try { | ||
| 29 | Utility.setLogLevel(Level.DEBUG); | ||
| 30 | Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 31 | new File(computedAnswers.toString()).deleteOnExit(); | ||
| 32 | PagodaTester.main(ontology.toString(), data.toString(), queries.toString(), computedAnswers.toString()); | ||
| 33 | assertSameContent(computedAnswers, givenAnswers); | ||
| 34 | } catch (IOException e) { | ||
| 35 | e.printStackTrace(); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | private static void assertSameContent(Path computedAnswersFile, Path givenAnswersFile) throws IOException { | ||
| 40 | BufferedReader computedReader = Files.newBufferedReader(computedAnswersFile); | ||
| 41 | BufferedReader givenReader = Files.newBufferedReader(givenAnswersFile); | ||
| 42 | |||
| 43 | Gson gson = QueryRecord.GsonCreator.getInstance(); | ||
| 44 | |||
| 45 | Type cqType = new TypeToken<Set<QueryRecord>>() {}.getType(); | ||
| 46 | Set<QueryRecord> computedAnswers = gson.fromJson(computedReader, cqType); | ||
| 47 | Set<QueryRecord> givenAnswers = gson.fromJson(givenReader, cqType); | ||
| 48 | |||
| 49 | Assert.assertEquals(computedAnswers, givenAnswers); | ||
| 50 | } | ||
| 51 | |||
| 52 | |||
| 53 | } | ||
