diff options
Diffstat (limited to 'test/uk/ac/ox/cs/pagoda/global_tests')
14 files changed, 0 insertions, 1514 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java b/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java deleted file mode 100644 index 3f14ec7..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java +++ /dev/null | |||
| @@ -1,240 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 4 | import org.semanticweb.owlapi.model.*; | ||
| 5 | import org.testng.Assert; | ||
| 6 | import org.testng.annotations.Test; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 9 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 10 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 11 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 12 | |||
| 13 | import java.io.IOException; | ||
| 14 | import java.nio.file.Files; | ||
| 15 | import java.nio.file.Paths; | ||
| 16 | |||
| 17 | import static uk.ac.ox.cs.pagoda.util.TestUtil.getEntityIRI; | ||
| 18 | |||
| 19 | public class BugTests { | ||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | @Test | ||
| 24 | public void minimumCardinalityAxiom2() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Build test ontology | ||
| 28 | * */ | ||
| 29 | |||
| 30 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 31 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 32 | OWLOntology ontology = manager.createOntology(); | ||
| 33 | |||
| 34 | // OWLClass student = factory.getOWLClass(getEntityIRI("Student")); | ||
| 35 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(student)); | ||
| 36 | // OWLClass course = factory.getOWLClass(getEntityIRI("Course")); | ||
| 37 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(course)); | ||
| 38 | OWLClass hardWorkingStudent = factory.getOWLClass(getEntityIRI("HardWorkingStudent")); | ||
| 39 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(hardWorkingStudent)); | ||
| 40 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 41 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 42 | OWLObjectProperty takesCourse = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "takesCourse"))); | ||
| 43 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(takesCourse)); | ||
| 44 | |||
| 45 | // Class assertions | ||
| 46 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, a)); // HardWorkingStudent(a) | ||
| 47 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, b)); // HardWorkingStudent(b) | ||
| 48 | |||
| 49 | // Minimum cardinality axiom | ||
| 50 | manager.addAxiom(ontology, | ||
| 51 | factory.getOWLEquivalentClassesAxiom(hardWorkingStudent, | ||
| 52 | factory.getOWLObjectMinCardinality(3, | ||
| 53 | takesCourse))); | ||
| 54 | |||
| 55 | // manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Test one query | ||
| 59 | * */ | ||
| 60 | |||
| 61 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 62 | pagoda.loadOntology(ontology); | ||
| 63 | if (pagoda.preprocess()) { | ||
| 64 | String query = "select distinct ?x ?y " + | ||
| 65 | " where { " | ||
| 66 | + " ?x <" + takesCourse.toStringID() + "> _:z . " | ||
| 67 | + " ?y <" + takesCourse.toStringID() + "> _:z " + | ||
| 68 | " }"; | ||
| 69 | AnswerTuples answers = pagoda.evaluate(query); | ||
| 70 | int count = 0; | ||
| 71 | for (AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 72 | ans = answers.getTuple(); | ||
| 73 | TestUtil.logInfo(ans); | ||
| 74 | count++; | ||
| 75 | } | ||
| 76 | Assert.assertEquals(count, 2); | ||
| 77 | } | ||
| 78 | pagoda.dispose(); | ||
| 79 | } | ||
| 80 | |||
| 81 | // @Test | ||
| 82 | public void minimumCardinalityAxiom() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Build test ontology | ||
| 86 | * */ | ||
| 87 | |||
| 88 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 89 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 90 | OWLOntology ontology = manager.createOntology(); | ||
| 91 | |||
| 92 | OWLClass student = factory.getOWLClass(getEntityIRI("Student")); | ||
| 93 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(student)); | ||
| 94 | OWLClass course = factory.getOWLClass(getEntityIRI("Course")); | ||
| 95 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(course)); | ||
| 96 | OWLClass hardWorkingStudent = factory.getOWLClass(getEntityIRI("HardWorkingStudent")); | ||
| 97 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(hardWorkingStudent)); | ||
| 98 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 99 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 100 | OWLNamedIndividual c1 = factory.getOWLNamedIndividual(getEntityIRI("c1")); | ||
| 101 | OWLNamedIndividual c2 = factory.getOWLNamedIndividual(getEntityIRI("c2")); | ||
| 102 | OWLNamedIndividual c3 = factory.getOWLNamedIndividual(getEntityIRI("c3")); | ||
| 103 | OWLNamedIndividual d1 = factory.getOWLNamedIndividual(getEntityIRI("d1")); | ||
| 104 | OWLNamedIndividual d2 = factory.getOWLNamedIndividual(getEntityIRI("d2")); | ||
| 105 | OWLNamedIndividual d3 = factory.getOWLNamedIndividual(getEntityIRI("d3")); | ||
| 106 | OWLObjectProperty takesCourse = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "takesCourse"))); | ||
| 107 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(takesCourse)); | ||
| 108 | |||
| 109 | // Class assertions | ||
| 110 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(student, a)); // Student(a) | ||
| 111 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(student, b)); // Student(b) | ||
| 112 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, c1)); // Course(c1) | ||
| 113 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, c2)); // Course(c2) | ||
| 114 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, c3)); // Course(c3) | ||
| 115 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, d1)); // Course(d1) | ||
| 116 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, d2)); // Course(d2) | ||
| 117 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(course, d3)); // Course(d3) | ||
| 118 | |||
| 119 | // Role assertions | ||
| 120 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, a, c1)); // takesCourse(a,c1) | ||
| 121 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, a, c2)); // takesCourse(a,c2) | ||
| 122 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, a, c3)); // takesCourse(a,c3) | ||
| 123 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, b, d1)); // takesCourse(b,d1) | ||
| 124 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, b, d2)); // takesCourse(b,d2) | ||
| 125 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(takesCourse, b, d3)); // takesCourse(b,d3) | ||
| 126 | |||
| 127 | // Minimum cardinality axiom | ||
| 128 | manager.addAxiom(ontology, | ||
| 129 | factory.getOWLEquivalentClassesAxiom(hardWorkingStudent, | ||
| 130 | factory.getOWLObjectMinCardinality(3, | ||
| 131 | takesCourse))); | ||
| 132 | |||
| 133 | manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 134 | |||
| 135 | /* | ||
| 136 | * Test one query | ||
| 137 | * */ | ||
| 138 | |||
| 139 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 140 | pagoda.loadOntology(ontology); | ||
| 141 | if (pagoda.preprocess()) { | ||
| 142 | String query = "select distinct ?x ?y " + | ||
| 143 | " where { " | ||
| 144 | + " ?x <" + takesCourse.toStringID() + "> _:z . " | ||
| 145 | + " ?y <" + takesCourse.toStringID() + "> _:z " + | ||
| 146 | " }"; | ||
| 147 | AnswerTuples answers = pagoda.evaluate(query); | ||
| 148 | int count = 0; | ||
| 149 | for (AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 150 | ans = answers.getTuple(); | ||
| 151 | TestUtil.logInfo(ans); | ||
| 152 | count++; | ||
| 153 | } | ||
| 154 | Assert.assertEquals(count, 2); | ||
| 155 | } | ||
| 156 | pagoda.dispose(); | ||
| 157 | } | ||
| 158 | |||
| 159 | /** | ||
| 160 | * Bug: the relevant ontology is not a subset of the original one. | ||
| 161 | * | ||
| 162 | * @throws OWLOntologyCreationException | ||
| 163 | * @throws IOException | ||
| 164 | * @throws OWLOntologyStorageException | ||
| 165 | */ | ||
| 166 | // @Test | ||
| 167 | public void rTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Build test ontology | ||
| 171 | * */ | ||
| 172 | |||
| 173 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 174 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 175 | OWLOntology ontology = manager.createOntology(); | ||
| 176 | |||
| 177 | OWLClass classA = factory.getOWLClass(getEntityIRI("A")); | ||
| 178 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classA)); | ||
| 179 | OWLClass classB = factory.getOWLClass(getEntityIRI("B")); | ||
| 180 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classB)); | ||
| 181 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 182 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 183 | OWLNamedIndividual c = factory.getOWLNamedIndividual(getEntityIRI("c")); | ||
| 184 | OWLObjectProperty roleR = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "R"))); | ||
| 185 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleR)); | ||
| 186 | OWLObjectProperty roleP = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "P"))); | ||
| 187 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleP)); | ||
| 188 | |||
| 189 | // Class assertions | ||
| 190 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, a)); // A(a) | ||
| 191 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, b)); // A(b) | ||
| 192 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(roleP, c, a)); // P(c,a) | ||
| 193 | |||
| 194 | // Axioms | ||
| 195 | // subsetOf(A someValuesFrom(R owl:Thing)) | ||
| 196 | manager.addAxiom(ontology, | ||
| 197 | factory.getOWLSubClassOfAxiom(classA, | ||
| 198 | factory.getOWLObjectSomeValuesFrom(roleR, | ||
| 199 | factory.getOWLThing()))); | ||
| 200 | |||
| 201 | // inverseFunctional(R) | ||
| 202 | manager.addAxiom(ontology, | ||
| 203 | factory.getOWLInverseFunctionalObjectPropertyAxiom(roleR)); | ||
| 204 | |||
| 205 | // subsetOf(someValuesFrom(inverseOf(P) owl:thing) B) | ||
| 206 | manager.addAxiom(ontology, | ||
| 207 | factory.getOWLSubClassOfAxiom(factory.getOWLObjectSomeValuesFrom(roleP.getInverseProperty(), | ||
| 208 | factory.getOWLThing()), | ||
| 209 | classB)); | ||
| 210 | /* | ||
| 211 | * Save the ontology | ||
| 212 | * */ | ||
| 213 | |||
| 214 | // manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 215 | |||
| 216 | /* | ||
| 217 | * Test one query | ||
| 218 | * */ | ||
| 219 | |||
| 220 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 221 | pagoda.loadOntology(ontology); | ||
| 222 | if(pagoda.preprocess()) { | ||
| 223 | String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + | ||
| 224 | "select distinct ?x" + | ||
| 225 | " where { " | ||
| 226 | + " ?x rdf:type " + classB + | ||
| 227 | " }"; | ||
| 228 | QueryRecord queryRecord = pagoda.getQueryManager().create(queryStr); | ||
| 229 | System.out.println(queryRecord); | ||
| 230 | pagoda.evaluate(queryRecord); | ||
| 231 | AnswerTuples answers = queryRecord.getAnswers(); | ||
| 232 | System.out.println("Difficulty: " + queryRecord.getDifficulty()); | ||
| 233 | for(AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 234 | ans = answers.getTuple(); | ||
| 235 | TestUtil.logInfo(ans); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | pagoda.dispose(); | ||
| 239 | } | ||
| 240 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java deleted file mode 100644 index 01e8203..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java +++ /dev/null | |||
| @@ -1,115 +0,0 @@ | |||
| 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 deleted file mode 100644 index 18f6cf9..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_PAGOdA.java +++ /dev/null | |||
| @@ -1,191 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | |||
| 9 | public class JAIR_PAGOdA { | ||
| 10 | |||
| 11 | public static void main(String... args) { | ||
| 12 | try { | ||
| 13 | new JAIR_PAGOdA().lubm1(); | ||
| 14 | } catch(IOException e) { | ||
| 15 | e.printStackTrace(); | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void lubm1() throws IOException { | ||
| 21 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 22 | String[] args = new String[] { | ||
| 23 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 24 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 25 | TestUtil.combinePaths(ontoDir, "lubm/queries/answersCorrectness.sparql") | ||
| 26 | }; | ||
| 27 | PagodaTester.main(args); | ||
| 28 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda"); | ||
| 29 | } | ||
| 30 | |||
| 31 | @Test | ||
| 32 | public void lubm1_conj() throws IOException { | ||
| 33 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 34 | String[] args = new String[] { | ||
| 35 | TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"), | ||
| 36 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 37 | TestUtil.combinePaths(ontoDir, "lubm/queries/test_pellet.sparql") | ||
| 38 | }; | ||
| 39 | PagodaTester.main(args); | ||
| 40 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_conj"); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Test | ||
| 44 | public void lubm1_rolledUp() throws IOException { | ||
| 45 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 46 | PagodaTester.main( | ||
| 47 | "/home/yzhou/backup/20141212/univ-bench-queries.owl", | ||
| 48 | TestUtil.combinePaths(ontoDir, "lubm/data/lubm1.ttl"), | ||
| 49 | TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql") | ||
| 50 | ); | ||
| 51 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/lubm1/pagoda_rolledUp"); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Test | ||
| 55 | public void uobm1() throws IOException { | ||
| 56 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 57 | String[] args = new String[] { | ||
| 58 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 59 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 60 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql") | ||
| 61 | }; | ||
| 62 | PagodaTester.main(args); | ||
| 63 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda"); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Test | ||
| 67 | public void uobm1_conj() throws IOException { | ||
| 68 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 69 | String[] args = new String[] { | ||
| 70 | TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), | ||
| 71 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 72 | TestUtil.combinePaths(ontoDir, "uobm/queries/standard_pellet.sparql") | ||
| 73 | }; | ||
| 74 | PagodaTester.main(args); | ||
| 75 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_conj"); | ||
| 76 | } | ||
| 77 | |||
| 78 | @Test | ||
| 79 | public void uobm1_rolledUp() { | ||
| 80 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 81 | String[] args = new String[] { | ||
| 82 | "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", | ||
| 83 | TestUtil.combinePaths(ontoDir, "uobm/data/uobm1.ttl"), | ||
| 84 | TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql") | ||
| 85 | }; | ||
| 86 | PagodaTester.main(args); | ||
| 87 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uobm1/pagoda_rolledUp"); | ||
| 88 | } | ||
| 89 | |||
| 90 | @Test | ||
| 91 | public void fly() { | ||
| 92 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 93 | String[] args = new String[] { | ||
| 94 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 95 | null, | ||
| 96 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 97 | }; | ||
| 98 | PagodaTester.main(args); | ||
| 99 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda"); | ||
| 100 | } | ||
| 101 | |||
| 102 | @Test | ||
| 103 | public void fly_conj() throws IOException { | ||
| 104 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 105 | String[] args = new String[] { | ||
| 106 | TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"), | ||
| 107 | null, | ||
| 108 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql") | ||
| 109 | }; | ||
| 110 | PagodaTester.main(args); | ||
| 111 | TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_conj"); | ||
| 112 | } | ||
| 113 | |||
| 114 | public void fly_rolledUp() { | ||
| 115 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 116 | PagodaTester.main( | ||
| 117 | // TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", | ||
| 118 | TestUtil.combinePaths(ontoDir, "fly/fly-all-in-one_rolledUp.owl"), | ||
| 119 | null, | ||
| 120 | TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql") | ||
| 121 | ); | ||
| 122 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/fly/pagoda_rolledUp"); | ||
| 123 | } | ||
| 124 | |||
| 125 | public void dbpedia() { | ||
| 126 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 127 | PagodaTester.main( | ||
| 128 | TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"), | ||
| 129 | TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"), | ||
| 130 | TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql"), | ||
| 131 | "dbpedia.ans" | ||
| 132 | ); | ||
| 133 | |||
| 134 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/dbpedia/pagoda"); | ||
| 135 | } | ||
| 136 | |||
| 137 | public void npd() { | ||
| 138 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 139 | PagodaTester.main( | ||
| 140 | TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"), | ||
| 141 | TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"), | ||
| 142 | TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql") | ||
| 143 | , "npd.ans" | ||
| 144 | ); | ||
| 145 | |||
| 146 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/npd/pagoda"); | ||
| 147 | } | ||
| 148 | |||
| 149 | public void reactome() throws IOException { | ||
| 150 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 151 | PagodaTester.main( | ||
| 152 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 153 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"), | ||
| 154 | // null, | ||
| 155 | // TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql") | ||
| 156 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/example.sparql") | ||
| 157 | , "pagoda_reactome.ans" | ||
| 158 | ); | ||
| 159 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_reactome.example"); | ||
| 160 | |||
| 161 | // TestUtil.copyFile(("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_10p"); | ||
| 162 | } | ||
| 163 | |||
| 164 | public void chembl() throws IOException { | ||
| 165 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 166 | PagodaTester.main( | ||
| 167 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 168 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"), | ||
| 169 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 170 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/example.sparql") | ||
| 171 | , "pagoda_chembl.ans" | ||
| 172 | ); | ||
| 173 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_chembl.example"); | ||
| 174 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_1p"); | ||
| 175 | } | ||
| 176 | |||
| 177 | public void uniprot() throws IOException { | ||
| 178 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 179 | PagodaTester.main( | ||
| 180 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 181 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"), | ||
| 182 | // null, | ||
| 183 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 184 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/example.sparql") | ||
| 185 | , "pagoda_uniprot.ans" | ||
| 186 | ); | ||
| 187 | TestUtil.copyFile("log4j.log", "output/jair/pagoda_uniprot.example"); | ||
| 188 | // TestUtil.copyFile("output/log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_1p"); | ||
| 189 | } | ||
| 190 | |||
| 191 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java deleted file mode 100644 index 01f3568..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.tester.PagodaTester; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.IOException; | ||
| 9 | |||
| 10 | public class JAIR_Scalability { | ||
| 11 | |||
| 12 | private static final String date = "_0123"; | ||
| 13 | |||
| 14 | public static void main(String... args) throws IOException { | ||
| 15 | PagodaProperties.shellModeDefault = true; | ||
| 16 | new JAIR_Scalability().testUniProt(50, false); | ||
| 17 | } | ||
| 18 | |||
| 19 | @Test | ||
| 20 | public void reactome() throws IOException { | ||
| 21 | testReactome(10, false); | ||
| 22 | } | ||
| 23 | |||
| 24 | @Test | ||
| 25 | public void chembl() throws IOException { | ||
| 26 | testChEMBL(1, false); | ||
| 27 | } | ||
| 28 | |||
| 29 | @Test | ||
| 30 | public void uniprot() throws IOException { | ||
| 31 | testUniProt(1, false); | ||
| 32 | } | ||
| 33 | |||
| 34 | public void testReactome(int percentage, boolean save) throws IOException { | ||
| 35 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 36 | String[] args = new String[] { | ||
| 37 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"), | ||
| 38 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/simplifed_sample_" + percentage + ".ttl"), | ||
| 39 | TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/answersCorrectness.sparql") | ||
| 40 | , "reactome.ans" | ||
| 41 | }; | ||
| 42 | if (percentage == 10) | ||
| 43 | args[1] = args[1].replace("simplifed", "reactome"); | ||
| 44 | |||
| 45 | PagodaTester.main(args); | ||
| 46 | if (save) | ||
| 47 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/reactome/pagoda_" + percentage + "p" + date); | ||
| 48 | } | ||
| 49 | |||
| 50 | public void testChEMBL(int percentage, boolean save) throws IOException { | ||
| 51 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 52 | String[] args = new String[] { | ||
| 53 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"), | ||
| 54 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/sample_" + percentage + ".nt"), | ||
| 55 | // TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql") | ||
| 56 | TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/answersCorrectness.sparql") | ||
| 57 | , "chembl.ans" | ||
| 58 | }; | ||
| 59 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 60 | args[1] = args[1].replace("chembl", "chembl/graph sampling"); | ||
| 61 | else | ||
| 62 | if (percentage == 100) | ||
| 63 | args[1] = "/home/yzhou/RDFData/ChEMBL/facts/ChEMBL.ttl"; | ||
| 64 | |||
| 65 | PagodaTester.main(args); | ||
| 66 | if (save) | ||
| 67 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/chembl/pagoda_" + percentage + "p" + date); | ||
| 68 | } | ||
| 69 | |||
| 70 | public void testUniProt(int percentage, boolean save) throws IOException { | ||
| 71 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 72 | String[] args = new String[] { | ||
| 73 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat-processed.owl"), | ||
| 74 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/sample_" + percentage + ".nt"), | ||
| 75 | // TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql") | ||
| 76 | TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/answersCorrectness.sparql") | ||
| 77 | , "uniprot.ans" | ||
| 78 | }; | ||
| 79 | |||
| 80 | if (percentage == 1 || percentage == 10 || percentage == 50) | ||
| 81 | args[1] = args[1].replace("uniprot", "uniprot/graph sampling"); | ||
| 82 | else | ||
| 83 | if (percentage == 100) | ||
| 84 | args[1] = "/home/yzhou/krr-nas-share/Yujiao/ontologies/bio2rdf/uniprot/data/uniprot_cleaned.nt"; | ||
| 85 | |||
| 86 | PagodaTester.main(args); | ||
| 87 | if (save) | ||
| 88 | TestUtil.copyFile("log4j.log", "/home/yzhou/java-workspace/answersCorrectness-share/results_new/uniprot/pagoda_" + percentage + "p" + date); | ||
| 89 | } | ||
| 90 | |||
| 91 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java deleted file mode 100644 index 3551b9b..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | |||
| 5 | import java.io.IOException; | ||
| 6 | |||
| 7 | @Deprecated | ||
| 8 | public class LightEvaluation { | ||
| 9 | |||
| 10 | @Test | ||
| 11 | public void evaluation() throws IOException { | ||
| 12 | new TestPagodaUOBM().answersCorrectness(1); | ||
| 13 | new TestPagodaLUBM().answersCorrectness(100); | ||
| 14 | // new TestPagodaFLY().answersCorrectness(); | ||
| 15 | new TestPagodaDBPedia().answersCorrectness(); | ||
| 16 | new TestPagodaNPD().testNPDwithoutDataType(); | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java b/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java deleted file mode 100644 index 3d154cb..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 4 | import org.semanticweb.owlapi.model.*; | ||
| 5 | import org.testng.Assert; | ||
| 6 | import org.testng.annotations.Test; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 9 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 11 | |||
| 12 | import java.io.IOException; | ||
| 13 | |||
| 14 | import static uk.ac.ox.cs.pagoda.util.TestUtil.getEntityIRI; | ||
| 15 | |||
| 16 | public class MadeUpCases { | ||
| 17 | |||
| 18 | @Test(groups = {"existential"}) | ||
| 19 | public void someTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Build test ontology | ||
| 23 | * */ | ||
| 24 | |||
| 25 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 26 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 27 | OWLOntology ontology = manager.createOntology(); | ||
| 28 | |||
| 29 | OWLClass A1 = factory.getOWLClass(getEntityIRI("A1")); | ||
| 30 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A1)); | ||
| 31 | OWLClass A2 = factory.getOWLClass(getEntityIRI("A2")); | ||
| 32 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A2)); | ||
| 33 | OWLClass A3 = factory.getOWLClass(getEntityIRI("A3")); | ||
| 34 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A3)); | ||
| 35 | OWLClass A4 = factory.getOWLClass(getEntityIRI("A4")); | ||
| 36 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A4)); | ||
| 37 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 38 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 39 | OWLObjectProperty R = factory.getOWLObjectProperty(IRI.create(String.format(TestUtil.NS, "R"))); | ||
| 40 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(R)); | ||
| 41 | |||
| 42 | // Class assertions | ||
| 43 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(A1, a)); | ||
| 44 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(A1, b)); | ||
| 45 | |||
| 46 | // Minimum cardinality axiom | ||
| 47 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A1, factory.getOWLObjectSomeValuesFrom(R, A2))); | ||
| 48 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A2, factory.getOWLObjectSomeValuesFrom(R, A3))); | ||
| 49 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A3, factory.getOWLObjectSomeValuesFrom(R, A4))); | ||
| 50 | manager.addAxiom(ontology, factory.getOWLTransitiveObjectPropertyAxiom(R)); | ||
| 51 | |||
| 52 | // manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Test one query | ||
| 56 | * */ | ||
| 57 | |||
| 58 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 59 | pagoda.loadOntology(ontology); | ||
| 60 | if (pagoda.preprocess()) { | ||
| 61 | String query = "select distinct ?x ?y " + | ||
| 62 | " where { " | ||
| 63 | + " ?x <" + R.toStringID() + "> _:z . " | ||
| 64 | + " ?y <" + R.toStringID() + "> _:z " + | ||
| 65 | " }"; | ||
| 66 | AnswerTuples answers = pagoda.evaluate(query); | ||
| 67 | int count = 0; | ||
| 68 | for (AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 69 | ans = answers.getTuple(); | ||
| 70 | TestUtil.logInfo(ans); | ||
| 71 | count++; | ||
| 72 | } | ||
| 73 | Assert.assertEquals(count, 2); | ||
| 74 | } | ||
| 75 | pagoda.dispose(); | ||
| 76 | } | ||
| 77 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/SkolemisationTests.java b/test/uk/ac/ox/cs/pagoda/global_tests/SkolemisationTests.java deleted file mode 100644 index 2fc682b..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/SkolemisationTests.java +++ /dev/null | |||
| @@ -1,269 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 4 | import org.semanticweb.owlapi.model.*; | ||
| 5 | import org.testng.Assert; | ||
| 6 | import org.testng.annotations.Test; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 9 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 10 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 11 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 12 | |||
| 13 | import java.io.IOException; | ||
| 14 | import java.nio.file.Files; | ||
| 15 | import java.nio.file.Paths; | ||
| 16 | |||
| 17 | public class SkolemisationTests { | ||
| 18 | |||
| 19 | public static final String NS = "http://example.org/test#%s"; | ||
| 20 | |||
| 21 | private IRI getEntityIRI(String name) { | ||
| 22 | return IRI.create(String.format(NS, name)); | ||
| 23 | } | ||
| 24 | |||
| 25 | // @Test | ||
| 26 | public void commonSuccessorTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Build test ontology | ||
| 30 | * */ | ||
| 31 | |||
| 32 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 33 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 34 | OWLOntology ontology = manager.createOntology(); | ||
| 35 | |||
| 36 | OWLClass classA = factory.getOWLClass(getEntityIRI("A")); | ||
| 37 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classA)); | ||
| 38 | OWLClass classB = factory.getOWLClass(getEntityIRI("B")); | ||
| 39 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classB)); | ||
| 40 | OWLClass classC = factory.getOWLClass(getEntityIRI("C")); | ||
| 41 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classC)); | ||
| 42 | OWLNamedIndividual c = factory.getOWLNamedIndividual(getEntityIRI("c")); | ||
| 43 | OWLNamedIndividual d = factory.getOWLNamedIndividual(getEntityIRI("d")); | ||
| 44 | OWLObjectProperty roleR = factory.getOWLObjectProperty(IRI.create(String.format(NS, "R"))); | ||
| 45 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleR)); | ||
| 46 | |||
| 47 | // Class assertions | ||
| 48 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, c)); // A(c) | ||
| 49 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, d)); // A(d) | ||
| 50 | |||
| 51 | // Minimum cardinality axiom | ||
| 52 | manager.addAxiom(ontology, | ||
| 53 | factory.getOWLSubClassOfAxiom(classA, | ||
| 54 | factory.getOWLObjectUnionOf( | ||
| 55 | factory.getOWLObjectSomeValuesFrom(roleR, classB), | ||
| 56 | factory.getOWLObjectSomeValuesFrom(roleR, classC)))); | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Save the ontology | ||
| 60 | * */ | ||
| 61 | |||
| 62 | // manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 63 | |||
| 64 | /* | ||
| 65 | * Test one query | ||
| 66 | * */ | ||
| 67 | |||
| 68 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 69 | pagoda.loadOntology(ontology); | ||
| 70 | if(pagoda.preprocess()) { | ||
| 71 | String queryStr = "select distinct ?x ?y " + | ||
| 72 | " where { " | ||
| 73 | + " ?x <" + roleR.toStringID() + "> _:z . " | ||
| 74 | + " ?y <" + roleR.toStringID() + "> _:z " + | ||
| 75 | " }"; | ||
| 76 | QueryRecord queryRecord = pagoda.getQueryManager().create(queryStr); | ||
| 77 | pagoda.evaluate(queryRecord); | ||
| 78 | AnswerTuples answers = queryRecord.getAnswers(); | ||
| 79 | System.out.println("Difficulty: " + queryRecord.getDifficulty()); | ||
| 80 | int count = 0; | ||
| 81 | for(AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 82 | ans = answers.getTuple(); | ||
| 83 | TestUtil.logInfo(ans); | ||
| 84 | count++; | ||
| 85 | } | ||
| 86 | Assert.assertEquals(count, 2); | ||
| 87 | } | ||
| 88 | pagoda.dispose(); | ||
| 89 | } | ||
| 90 | |||
| 91 | // @Test | ||
| 92 | public void yTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 93 | |||
| 94 | /* | ||
| 95 | * Build test ontology | ||
| 96 | * */ | ||
| 97 | |||
| 98 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 99 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 100 | OWLOntology ontology = manager.createOntology(); | ||
| 101 | |||
| 102 | OWLClass classA = factory.getOWLClass(getEntityIRI("A")); | ||
| 103 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classA)); | ||
| 104 | OWLClass classB = factory.getOWLClass(getEntityIRI("B")); | ||
| 105 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classB)); | ||
| 106 | OWLClass classC = factory.getOWLClass(getEntityIRI("C")); | ||
| 107 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classC)); | ||
| 108 | OWLClass classD = factory.getOWLClass(getEntityIRI("D")); | ||
| 109 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classD)); | ||
| 110 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 111 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 112 | OWLNamedIndividual c = factory.getOWLNamedIndividual(getEntityIRI("c")); | ||
| 113 | OWLNamedIndividual d = factory.getOWLNamedIndividual(getEntityIRI("d")); | ||
| 114 | OWLObjectProperty roleR = factory.getOWLObjectProperty(IRI.create(String.format(NS, "R"))); | ||
| 115 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleR)); | ||
| 116 | OWLObjectProperty roleS = factory.getOWLObjectProperty(IRI.create(String.format(NS, "S"))); | ||
| 117 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleS)); | ||
| 118 | OWLObjectProperty roleP = factory.getOWLObjectProperty(IRI.create(String.format(NS, "P"))); | ||
| 119 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleP)); | ||
| 120 | |||
| 121 | // Class assertions | ||
| 122 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classD, a)); // D(a) | ||
| 123 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classD, b)); // D(b) | ||
| 124 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(roleS, c, a)); // S(c,a) | ||
| 125 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(roleP, d, b)); // P(d,b) | ||
| 126 | |||
| 127 | // Axioms | ||
| 128 | // subsetOf(D someValuesFrom(R owl:Thing)) | ||
| 129 | manager.addAxiom(ontology, | ||
| 130 | factory.getOWLSubClassOfAxiom(classD, | ||
| 131 | factory.getOWLObjectSomeValuesFrom(roleR, | ||
| 132 | factory.getOWLThing()))); | ||
| 133 | // subsetOf(someValuesFrom(inverseOf(S) owl:Thing) allValuesFrom(R A)) | ||
| 134 | manager.addAxiom(ontology, | ||
| 135 | factory.getOWLSubClassOfAxiom(factory.getOWLObjectSomeValuesFrom(roleS.getInverseProperty(), | ||
| 136 | factory.getOWLThing()), | ||
| 137 | factory.getOWLObjectAllValuesFrom(roleR, classA))); | ||
| 138 | // subsetOf(someValuesFrom(inverseOf(P) owl:Thing) B) | ||
| 139 | manager.addAxiom(ontology, | ||
| 140 | factory.getOWLSubClassOfAxiom(factory.getOWLObjectSomeValuesFrom(roleP.getInverseProperty(), | ||
| 141 | factory.getOWLThing()), | ||
| 142 | classB)); | ||
| 143 | // subsetOf(someValuesFrom(R A) C) | ||
| 144 | manager.addAxiom(ontology, | ||
| 145 | factory.getOWLSubClassOfAxiom(factory.getOWLObjectSomeValuesFrom(roleR, classA), classC)); | ||
| 146 | |||
| 147 | /* | ||
| 148 | * Save the ontology | ||
| 149 | * */ | ||
| 150 | |||
| 151 | manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 152 | |||
| 153 | /* | ||
| 154 | * Test one query | ||
| 155 | * */ | ||
| 156 | |||
| 157 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 158 | pagoda.loadOntology(ontology); | ||
| 159 | if(pagoda.preprocess()) { | ||
| 160 | String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + | ||
| 161 | "select distinct ?x" + | ||
| 162 | " where { " | ||
| 163 | // + " ?x rdf:type " + classB + " ." | ||
| 164 | // + " ?x " + roleR + " "+ "_:y . " | ||
| 165 | + " ?x rdf:type " + classC + | ||
| 166 | " }"; | ||
| 167 | QueryRecord queryRecord = pagoda.getQueryManager().create(queryStr); | ||
| 168 | System.out.println(queryRecord); | ||
| 169 | pagoda.evaluate(queryRecord); | ||
| 170 | AnswerTuples answers = queryRecord.getAnswers(); | ||
| 171 | System.out.println("Difficulty: " + queryRecord.getDifficulty()); | ||
| 172 | int count = 0; | ||
| 173 | for(AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 174 | ans = answers.getTuple(); | ||
| 175 | TestUtil.logInfo(ans); | ||
| 176 | count++; | ||
| 177 | } | ||
| 178 | // Assert.assertEquals(count, 1); | ||
| 179 | } | ||
| 180 | pagoda.dispose(); | ||
| 181 | } | ||
| 182 | |||
| 183 | @Test | ||
| 184 | public void rTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { | ||
| 185 | |||
| 186 | /* | ||
| 187 | * Build test ontology | ||
| 188 | * */ | ||
| 189 | |||
| 190 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 191 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 192 | OWLOntology ontology = manager.createOntology(); | ||
| 193 | |||
| 194 | OWLClass classA = factory.getOWLClass(getEntityIRI("A")); | ||
| 195 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classA)); | ||
| 196 | OWLClass classB = factory.getOWLClass(getEntityIRI("B")); | ||
| 197 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classB)); | ||
| 198 | // OWLClass classC = factory.getOWLClass(getEntityIRI("C")); | ||
| 199 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classC)); | ||
| 200 | // OWLClass classD = factory.getOWLClass(getEntityIRI("D")); | ||
| 201 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(classD)); | ||
| 202 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 203 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 204 | OWLNamedIndividual c = factory.getOWLNamedIndividual(getEntityIRI("c")); | ||
| 205 | // OWLNamedIndividual d = factory.getOWLNamedIndividual(getEntityIRI("d")); | ||
| 206 | OWLObjectProperty roleR = factory.getOWLObjectProperty(IRI.create(String.format(NS, "R"))); | ||
| 207 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleR)); | ||
| 208 | // OWLObjectProperty roleF = factory.getOWLObjectProperty(IRI.create(String.format(NS, "F"))); | ||
| 209 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleF)); | ||
| 210 | OWLObjectProperty roleP = factory.getOWLObjectProperty(IRI.create(String.format(NS, "P"))); | ||
| 211 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleP)); | ||
| 212 | // OWLObjectProperty roleL = factory.getOWLObjectProperty(IRI.create(String.format(NS, "L"))); | ||
| 213 | // manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(roleL)); | ||
| 214 | |||
| 215 | // Class assertions | ||
| 216 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, a)); // A(a) | ||
| 217 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(classA, b)); // A(b) | ||
| 218 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(roleP, c, a)); // P(c,a) | ||
| 219 | |||
| 220 | // Axioms | ||
| 221 | // subsetOf(A someValuesFrom(R owl:Thing)) | ||
| 222 | manager.addAxiom(ontology, | ||
| 223 | factory.getOWLSubClassOfAxiom(classA, | ||
| 224 | factory.getOWLObjectSomeValuesFrom(roleR, | ||
| 225 | factory.getOWLThing()))); | ||
| 226 | |||
| 227 | // inverseFunctional(R) | ||
| 228 | manager.addAxiom(ontology, | ||
| 229 | factory.getOWLInverseFunctionalObjectPropertyAxiom(roleR)); | ||
| 230 | |||
| 231 | // subsetOf(someValuesFrom(inverseOf(P) owl:thing) B) | ||
| 232 | manager.addAxiom(ontology, | ||
| 233 | factory.getOWLSubClassOfAxiom(factory.getOWLObjectSomeValuesFrom(roleP.getInverseProperty(), | ||
| 234 | factory.getOWLThing()), | ||
| 235 | classB)); | ||
| 236 | /* | ||
| 237 | * Save the ontology | ||
| 238 | * */ | ||
| 239 | |||
| 240 | manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl"))); | ||
| 241 | |||
| 242 | /* | ||
| 243 | * Test one query | ||
| 244 | * */ | ||
| 245 | |||
| 246 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 247 | pagoda.loadOntology(ontology); | ||
| 248 | if(pagoda.preprocess()) { | ||
| 249 | String queryStr = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + | ||
| 250 | "select distinct ?x" + | ||
| 251 | " where { " | ||
| 252 | + " ?x rdf:type " + classB + | ||
| 253 | " }"; | ||
| 254 | QueryRecord queryRecord = pagoda.getQueryManager().create(queryStr); | ||
| 255 | System.out.println(queryRecord); | ||
| 256 | pagoda.evaluate(queryRecord); | ||
| 257 | AnswerTuples answers = queryRecord.getAnswers(); | ||
| 258 | System.out.println("Difficulty: " + queryRecord.getDifficulty()); | ||
| 259 | int count = 0; | ||
| 260 | for(AnswerTuple ans; answers.isValid(); answers.moveNext()) { | ||
| 261 | ans = answers.getTuple(); | ||
| 262 | TestUtil.logInfo(ans); | ||
| 263 | count++; | ||
| 264 | } | ||
| 265 | // Assert.assertEquals(count, 1); | ||
| 266 | } | ||
| 267 | pagoda.dispose(); | ||
| 268 | } | ||
| 269 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestGapMappedToLower.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestGapMappedToLower.java deleted file mode 100644 index 4b1ec6d..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestGapMappedToLower.java +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import junit.framework.Assert; | ||
| 4 | import org.semanticweb.owlapi.apibinding.OWLManager; | ||
| 5 | import org.semanticweb.owlapi.model.*; | ||
| 6 | import org.testng.annotations.Test; | ||
| 7 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 8 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 9 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 11 | |||
| 12 | public class TestGapMappedToLower { | ||
| 13 | |||
| 14 | public static final String ns = "http://example.org/test#%s"; | ||
| 15 | |||
| 16 | public IRI getEntityIRI(String name) { | ||
| 17 | return IRI.create(String.format(ns, name)); | ||
| 18 | } | ||
| 19 | |||
| 20 | @Test | ||
| 21 | public void test() throws OWLOntologyCreationException { | ||
| 22 | OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
| 23 | OWLDataFactory factory = manager.getOWLDataFactory(); | ||
| 24 | OWLOntology ontology = manager.createOntology(); | ||
| 25 | OWLClass A = factory.getOWLClass(getEntityIRI("A")); | ||
| 26 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A)); | ||
| 27 | OWLClass B = factory.getOWLClass(getEntityIRI("B")); | ||
| 28 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(B)); | ||
| 29 | OWLClass C = factory.getOWLClass(getEntityIRI("C")); | ||
| 30 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(C)); | ||
| 31 | OWLClass A1 = factory.getOWLClass(getEntityIRI("A1")); | ||
| 32 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A1)); | ||
| 33 | OWLClass A2 = factory.getOWLClass(getEntityIRI("A2")); | ||
| 34 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(A2)); | ||
| 35 | OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a")); | ||
| 36 | OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b")); | ||
| 37 | OWLNamedIndividual c = factory.getOWLNamedIndividual(getEntityIRI("c")); | ||
| 38 | OWLObjectProperty r = factory.getOWLObjectProperty(IRI.create(String.format(ns, "r"))); | ||
| 39 | manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(r)); | ||
| 40 | |||
| 41 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(A, a)); // A(a) | ||
| 42 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(B, b)); // B(b) | ||
| 43 | manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(C, c)); // C(c) | ||
| 44 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(r, a, b)); // r(a,b) | ||
| 45 | manager.addAxiom(ontology, factory.getOWLObjectPropertyAssertionAxiom(r, a, c)); // r(a,c) | ||
| 46 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A, factory.getOWLObjectUnionOf(A1, A2))); // A \sqsubseteq A1 \sqcup A2 | ||
| 47 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A1, factory.getOWLObjectMaxCardinality(1, r))); // A1 \sqsubseteq \leq 1 r.\top | ||
| 48 | manager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(A2, factory.getOWLObjectMaxCardinality(1, r))); // A2 \sqsubseteq \leq 1 r.\top | ||
| 49 | |||
| 50 | QueryReasoner pagoda = QueryReasoner.getInstance(ontology); | ||
| 51 | pagoda.loadOntology(ontology); | ||
| 52 | if (pagoda.preprocess()) { | ||
| 53 | String sparql = "select ?x where { " | ||
| 54 | + "?x <" + r.toStringID() + "> ?y . " | ||
| 55 | + "?y " + Namespace.RDF_TYPE_QUOTED + " <" + B.toStringID() + "> . " | ||
| 56 | + "?y " + Namespace.RDF_TYPE_QUOTED + " <" + C.toStringID() + "> . } "; | ||
| 57 | AnswerTuples rs = pagoda.evaluate(sparql); | ||
| 58 | int count = 0; | ||
| 59 | for (AnswerTuple ans; rs.isValid(); rs.moveNext()) { | ||
| 60 | ans = rs.getTuple(); | ||
| 61 | System.out.println(ans.getGroundTerm(0)); | ||
| 62 | ++count; | ||
| 63 | } | ||
| 64 | Assert.assertEquals(1, count); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java deleted file mode 100644 index 3642147..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | import java.nio.file.Paths; | ||
| 9 | |||
| 10 | public class TestPagodaDBPedia { | ||
| 11 | |||
| 12 | public static final String ANSWER_PATH = "~/TestPagodaDEBPedia.json"; | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void just_execute() throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | Pagoda pagoda = Pagoda.builder() | ||
| 18 | .ontology(Paths.get(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl")) | ||
| 19 | .data(Paths.get(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl")) | ||
| 20 | .query(Paths.get(ontoDir, "dbpedia/atomic.sparql")) | ||
| 21 | .answer(ANSWER_PATH) | ||
| 22 | .classify(true) | ||
| 23 | .hermit(true) | ||
| 24 | .build(); | ||
| 25 | pagoda.run(); | ||
| 26 | } | ||
| 27 | |||
| 28 | @Test | ||
| 29 | public void answersCorrectness() { | ||
| 30 | // TODO implement | ||
| 31 | } | ||
| 32 | |||
| 33 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java deleted file mode 100644 index 3eb956f..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java +++ /dev/null | |||
| @@ -1,107 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.query.CheckAnswers; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; | ||
| 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 8 | import uk.ac.ox.cs.pagoda.util.Timer; | ||
| 9 | |||
| 10 | import java.io.File; | ||
| 11 | import java.io.IOException; | ||
| 12 | import java.nio.file.Path; | ||
| 13 | import java.nio.file.Paths; | ||
| 14 | |||
| 15 | public class TestPagodaFLY { | ||
| 16 | |||
| 17 | // @Test(groups = {"light"}) | ||
| 18 | public void answersCorrectness_withGJFC() throws IOException { | ||
| 19 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 20 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 21 | new File(answers.toString()).deleteOnExit(); | ||
| 22 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-with-GJ-FC-individuals.json"); | ||
| 23 | |||
| 24 | Pagoda pagoda = Pagoda.builder() | ||
| 25 | .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) | ||
| 26 | .query(Paths.get(ontoDir, "fly/queries/fly.sparql")) | ||
| 27 | .answer(answers) | ||
| 28 | .classify(false) | ||
| 29 | .build(); | ||
| 30 | |||
| 31 | pagoda.run(); | ||
| 32 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 33 | } | ||
| 34 | |||
| 35 | @Test(groups = {"light", "correctness"}) | ||
| 36 | public void answersCorrectness_rolledUp() throws IOException { | ||
| 37 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 38 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 39 | new File(answers.toString()).deleteOnExit(); | ||
| 40 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-fly-rolledup.json"); | ||
| 41 | |||
| 42 | Pagoda pagoda = Pagoda.builder() | ||
| 43 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 44 | .query(Paths.get(ontoDir, "fly/queries/fly_rolledUp.sparql")) | ||
| 45 | .answer(answers) | ||
| 46 | // .answer(Paths.get("/home/alessandro/Desktop/answers.json")) | ||
| 47 | .classify(false) | ||
| 48 | .build(); | ||
| 49 | |||
| 50 | pagoda.run(); | ||
| 51 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Test(groups = {"light", "justExecute", "nonOriginal", "existential"}) | ||
| 55 | public void justExecute_newQueries() throws IOException { | ||
| 56 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 57 | |||
| 58 | Pagoda.builder() | ||
| 59 | // .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 60 | .ontology(Paths.get(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl")) | ||
| 61 | // .query(Paths.get(ontoDir, "fly/queries/fly_rolledUp.sparql")) | ||
| 62 | // .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 63 | .query("/home/alessandro/Desktop/query-8.sparql") | ||
| 64 | // .answer(Paths.get("/home/alessandro/Desktop/answers.json")) | ||
| 65 | .classify(false) | ||
| 66 | .hermit(true) | ||
| 67 | .skolemDepth(3) | ||
| 68 | .skolem(PagodaProperties.SkolemUpperBoundOptions.BEFORE_SUMMARISATION) | ||
| 69 | .build() | ||
| 70 | .run(); | ||
| 71 | } | ||
| 72 | |||
| 73 | @Test(groups = {"comparison"}) | ||
| 74 | public void compare_newQueries() throws IOException { | ||
| 75 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 76 | |||
| 77 | Timer timer = new Timer(); | ||
| 78 | Pagoda.builder() | ||
| 79 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 80 | .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 81 | .classify(false) | ||
| 82 | .hermit(true) | ||
| 83 | .skolem(PagodaProperties.SkolemUpperBoundOptions.AFTER_SUMMARISATION) // <----<< Skolem upper bound is ENABLED <<< | ||
| 84 | .build() | ||
| 85 | .run(); | ||
| 86 | double t1 = timer.duration(); | ||
| 87 | |||
| 88 | timer.reset(); | ||
| 89 | |||
| 90 | Pagoda.builder() | ||
| 91 | .ontology(Paths.get(ontoDir, "fly/fly_rolledUp.owl")) | ||
| 92 | .query(Paths.get(ontoDir, "fly/queries/new_queries.sparql")) | ||
| 93 | .classify(false) | ||
| 94 | .hermit(true) | ||
| 95 | .skolem(PagodaProperties.SkolemUpperBoundOptions.DISABLED) // <----<< Skolem upper bound is DISABLED <<< | ||
| 96 | .build() | ||
| 97 | .run(); | ||
| 98 | double t2 = timer.duration(); | ||
| 99 | |||
| 100 | if(t1 < t2) | ||
| 101 | TestUtil.logInfo( | ||
| 102 | "Overall reasoning with Skolem upper bound was " + (int) (t2 / t1 * 100 - 100) + "x faster!"); | ||
| 103 | else | ||
| 104 | TestUtil.logInfo( | ||
| 105 | "Overall reasoning with Skolem upper bound was " + (int) (t1 / t2 * 100 - 100) + "x slower..."); | ||
| 106 | } | ||
| 107 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java deleted file mode 100644 index 019fafa..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.query.CheckAnswers; | ||
| 6 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 7 | |||
| 8 | import java.io.File; | ||
| 9 | import java.io.IOException; | ||
| 10 | import java.nio.file.Path; | ||
| 11 | import java.nio.file.Paths; | ||
| 12 | |||
| 13 | public class TestPagodaLUBM { | ||
| 14 | |||
| 15 | public void answersCorrectness(int number) throws IOException { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 18 | new File(answers.toString()).deleteOnExit(); | ||
| 19 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json"); | ||
| 20 | |||
| 21 | Pagoda pagoda = Pagoda.builder() | ||
| 22 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | ||
| 23 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | ||
| 24 | .query(Paths.get(ontoDir, "lubm/queries/test.sparql")) | ||
| 25 | .answer(answers) | ||
| 26 | .build(); | ||
| 27 | |||
| 28 | pagoda.run(); | ||
| 29 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 30 | } | ||
| 31 | |||
| 32 | @Test(groups = {"light", "correctness"}) | ||
| 33 | public void answersCorrectness_1() throws IOException { | ||
| 34 | answersCorrectness(1); | ||
| 35 | } | ||
| 36 | |||
| 37 | public void justExecute_sygenia(int number) throws IOException { | ||
| 38 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 39 | // Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 40 | // new File(answers.toString()).deleteOnExit(); | ||
| 41 | // Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json"); | ||
| 42 | |||
| 43 | Pagoda pagoda = Pagoda.builder() | ||
| 44 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | ||
| 45 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | ||
| 46 | .query(Paths.get(ontoDir, "lubm/queries/lubm_sygenia.sparql")) | ||
| 47 | // .answer(answers) | ||
| 48 | .build(); | ||
| 49 | |||
| 50 | pagoda.run(); | ||
| 51 | // CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Test(groups = {"sygenia"}) | ||
| 55 | public void justExecute_sygenia_1() throws IOException { | ||
| 56 | justExecute_sygenia(1); | ||
| 57 | } | ||
| 58 | |||
| 59 | public void justExecute_sygenia_allBlanks(int number) throws IOException { | ||
| 60 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 61 | // Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 62 | // new File(answers.toString()).deleteOnExit(); | ||
| 63 | // Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json"); | ||
| 64 | |||
| 65 | Pagoda pagoda = Pagoda.builder() | ||
| 66 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | ||
| 67 | .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl")) | ||
| 68 | .query(Paths.get(ontoDir, "lubm/queries/lubm_sygenia_all-blanks.sparql")) | ||
| 69 | // .answer(answers) | ||
| 70 | .build(); | ||
| 71 | |||
| 72 | pagoda.run(); | ||
| 73 | // CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 74 | } | ||
| 75 | |||
| 76 | @Test(groups = {"sygenia"}) | ||
| 77 | public void justExecute_sygenia_1_allBlanks() throws IOException { | ||
| 78 | justExecute_sygenia_allBlanks(1); | ||
| 79 | } | ||
| 80 | |||
| 81 | @Test(groups = {"existential"}) | ||
| 82 | public void justExecute_feier() throws IOException { | ||
| 83 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 84 | |||
| 85 | Pagoda.builder() | ||
| 86 | .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl")) | ||
| 87 | .data(Paths.get(ontoDir, "lubm/data/lubm1.ttl")) | ||
| 88 | .query(Paths.get(ontoDir, "lubm/queries/queries_from_rules.sparql")) | ||
| 89 | .build() | ||
| 90 | .run(); | ||
| 91 | } | ||
| 92 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java deleted file mode 100644 index 939ee6e..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | import java.nio.file.Paths; | ||
| 9 | |||
| 10 | public class TestPagodaNPD { | ||
| 11 | |||
| 12 | public static final String ANSWER_PATH = "~/PagodaNPDWithoutDatatype.json"; | ||
| 13 | |||
| 14 | @Test | ||
| 15 | public void justExecuteNPDWithoutDataType() { | ||
| 16 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 17 | Pagoda pagoda = Pagoda.builder() | ||
| 18 | .ontology(Paths.get(ontoDir, "npd/npd-all-minus-datatype.owl")) | ||
| 19 | .data(Paths.get(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl")) | ||
| 20 | .query(Paths.get(ontoDir, "npd/queries/atomic.sparql")) | ||
| 21 | .answer(ANSWER_PATH) | ||
| 22 | .classify(true) | ||
| 23 | .hermit(true) | ||
| 24 | .build(); | ||
| 25 | pagoda.run(); | ||
| 26 | } | ||
| 27 | |||
| 28 | @Test | ||
| 29 | public void testNPDwithoutDataType() throws IOException { | ||
| 30 | // TODO implement | ||
| 31 | } | ||
| 32 | |||
| 33 | @Test | ||
| 34 | public void testNPD() throws IOException { | ||
| 35 | // TODO implement | ||
| 36 | } | ||
| 37 | |||
| 38 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java deleted file mode 100644 index 8a8a596..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.Test; | ||
| 4 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 5 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 6 | |||
| 7 | import java.io.IOException; | ||
| 8 | import java.nio.file.Paths; | ||
| 9 | |||
| 10 | public class TestPagodaReactome { | ||
| 11 | |||
| 12 | @Test(groups = {"justExecute"}) | ||
| 13 | public void justExecute() throws IOException { | ||
| 14 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 15 | |||
| 16 | Pagoda.builder() | ||
| 17 | .ontology(Paths.get(ontoDir, "reactome/biopax-level3-processed.owl")) | ||
| 18 | .data(Paths.get(ontoDir, "reactome/data/sample_10.ttl")) | ||
| 19 | .query(Paths.get(ontoDir, "reactome/test.sparql")) | ||
| 20 | .classify(true) | ||
| 21 | .hermit(true) | ||
| 22 | .build() | ||
| 23 | .run(); | ||
| 24 | } | ||
| 25 | |||
| 26 | @Test(groups = {"sygenia"}) | ||
| 27 | public void justExecute_sygenia() throws IOException { | ||
| 28 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 29 | |||
| 30 | Pagoda.builder() | ||
| 31 | .ontology(Paths.get(ontoDir, "reactome/biopax-level3-processed.owl")) | ||
| 32 | .data(Paths.get(ontoDir, "reactome/data/sample_10.ttl")) | ||
| 33 | .query(Paths.get(ontoDir, "reactome/reactome_sygenia_queries.sparql")) | ||
| 34 | .classify(true) | ||
| 35 | .hermit(true) | ||
| 36 | .build() | ||
| 37 | .run(); | ||
| 38 | } | ||
| 39 | |||
| 40 | @Test(groups = {"existential"}) | ||
| 41 | public void justExecute_existential() throws IOException { | ||
| 42 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 43 | |||
| 44 | Pagoda.builder() | ||
| 45 | .ontology(Paths.get(ontoDir, "reactome/biopax-level3-processed.owl")) | ||
| 46 | .data(Paths.get(ontoDir, "reactome/data/sample_10.ttl")) | ||
| 47 | .query(Paths.get(ontoDir, "reactome/existential_queries.sparql")) | ||
| 48 | // .query(Paths.get(ontoDir, "reactome/Queries_by_Feier-et-al.sparql")) | ||
| 49 | .build() | ||
| 50 | .run(); | ||
| 51 | } | ||
| 52 | |||
| 53 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java deleted file mode 100644 index 4dae223..0000000 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ /dev/null | |||
| @@ -1,122 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.global_tests; | ||
| 2 | |||
| 3 | import org.testng.annotations.DataProvider; | ||
| 4 | import org.testng.annotations.Test; | ||
| 5 | import uk.ac.ox.cs.pagoda.Pagoda; | ||
| 6 | import uk.ac.ox.cs.pagoda.query.CheckAnswers; | ||
| 7 | import uk.ac.ox.cs.pagoda.util.TestUtil; | ||
| 8 | |||
| 9 | import java.io.File; | ||
| 10 | import java.io.IOException; | ||
| 11 | import java.nio.file.Path; | ||
| 12 | import java.nio.file.Paths; | ||
| 13 | |||
| 14 | public class TestPagodaUOBM { | ||
| 15 | |||
| 16 | private static final int N_1 = 1; | ||
| 17 | private static final int N_2 = 4; | ||
| 18 | |||
| 19 | @DataProvider(name = "UOBMNumbers") | ||
| 20 | private static Object[][] UOBMNumbers() { | ||
| 21 | Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; | ||
| 22 | for(int i = 0; i < N_2 - N_1 + 1; i++) | ||
| 23 | integers[i][0] = N_1 + i; | ||
| 24 | return integers; | ||
| 25 | } | ||
| 26 | |||
| 27 | @Test(groups = {"light", "correctness"}) | ||
| 28 | public void answersCorrectness_1() throws IOException { | ||
| 29 | answersCorrectness(1); | ||
| 30 | } | ||
| 31 | |||
| 32 | @Test(groups = {"heavy", "correctness"}, dataProvider = "UOBMNumbers") | ||
| 33 | public void answersCorrectness(int number) throws IOException { | ||
| 34 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 35 | Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 36 | new File(answers.toString()).deleteOnExit(); | ||
| 37 | Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-uobm" + number + ".json"); | ||
| 38 | |||
| 39 | Pagoda pagoda = Pagoda.builder() | ||
| 40 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 41 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | ||
| 42 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) | ||
| 43 | .answer(answers) | ||
| 44 | .build(); | ||
| 45 | |||
| 46 | pagoda.run(); | ||
| 47 | CheckAnswers.assertSameAnswers(answers, givenAnswers); | ||
| 48 | } | ||
| 49 | |||
| 50 | @Test(groups = {"sygenia"}) | ||
| 51 | public void answersCorrectness_sygenia_1() throws IOException { | ||
| 52 | answersCorrectness_sygenia(1); | ||
| 53 | } | ||
| 54 | |||
| 55 | @Test(groups = {"heavy",}, dataProvider = "UOBMNumbers") | ||
| 56 | public void answersCorrectness_sygenia(int number) throws IOException { | ||
| 57 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 58 | // Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); | ||
| 59 | // new File(answers.toString()).deleteOnExit(); | ||
| 60 | // Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-uobm" + number + ".json"); | ||
| 61 | |||
| 62 | Pagoda pagoda = Pagoda.builder() | ||
| 63 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 64 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | ||
| 65 | .query(Paths.get(ontoDir, "uobm/queries/uobm_sygenia.sparql")) | ||
| 66 | .build(); | ||
| 67 | |||
| 68 | pagoda.run(); | ||
| 69 | } | ||
| 70 | |||
| 71 | @Test(groups = {"sygenia"}) | ||
| 72 | public void answersCorrectness_sygenia_allBlanks_1() throws IOException { | ||
| 73 | answersCorrectness_sygenia(1); | ||
| 74 | } | ||
| 75 | |||
| 76 | @Test(groups = {"heavy"}, dataProvider = "UOBMNumbers") | ||
| 77 | public void answersCorrectness_sygenia_allBlanks(int number) throws IOException { | ||
| 78 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 79 | |||
| 80 | Pagoda.builder() | ||
| 81 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 82 | .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl")) | ||
| 83 | .query(Paths.get(ontoDir, "uobm/queries/uobm_sygenia_all-blanks.sparql")) | ||
| 84 | .build() | ||
| 85 | .run(); | ||
| 86 | } | ||
| 87 | |||
| 88 | @Test(groups = {"justExecute", "heavy", "nonOriginal", "existential"}) | ||
| 89 | public void justExecute_modifiedUOBM() throws IOException { | ||
| 90 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 91 | |||
| 92 | Pagoda.builder() | ||
| 93 | .ontology(Paths.get(ontoDir, "uobm_modified/univ-bench-dl-modified.owl")) | ||
| 94 | .data(Paths.get(ontoDir, "uobm_modified/data/uobm1.ttl")) | ||
| 95 | .query(Paths.get(ontoDir, "uobm_modified/queries/additional_queries.sparql")) | ||
| 96 | .build() | ||
| 97 | .run(); | ||
| 98 | } | ||
| 99 | |||
| 100 | @Test(groups = {"justExecute"}) | ||
| 101 | public void justExecute_additionalQueries() throws IOException { | ||
| 102 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 103 | |||
| 104 | Pagoda.builder() | ||
| 105 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 106 | .data(Paths.get(ontoDir, "uobm/data/uobm1.ttl")) | ||
| 107 | .query(Paths.get(ontoDir, "uobm/queries/additional_queries.sparql")) | ||
| 108 | .build() | ||
| 109 | .run(); | ||
| 110 | } | ||
| 111 | |||
| 112 | @Test(groups = {"justExecute", "UOBM50"}) | ||
| 113 | public void justExecuteUOBM_50() throws IOException { | ||
| 114 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | ||
| 115 | Pagoda.builder() | ||
| 116 | .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl")) | ||
| 117 | .data(Paths.get(ontoDir, "uobm/data/uobm50.ttl")) | ||
| 118 | .query(Paths.get(ontoDir, "uobm/queries/test.sparql")) | ||
| 119 | .build() | ||
| 120 | .run(); | ||
| 121 | } | ||
| 122 | } | ||
