diff options
5 files changed, 114 insertions, 3 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index 8a90a26..8cc9209 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | |||
| @@ -74,7 +74,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 74 | program = new DatalogProgram(ontology); | 74 | program = new DatalogProgram(ontology); |
| 75 | // program.getLower().save(); | 75 | // program.getLower().save(); |
| 76 | // program.getUpper().save(); | 76 | // program.getUpper().save(); |
| 77 | // program.getGeneral().save(); | 77 | program.getGeneral().save(); |
| 78 | 78 | ||
| 79 | if(!program.getGeneral().isHorn()) | 79 | if(!program.getGeneral().isHorn()) |
| 80 | lazyUpperStore = new MultiStageQueryEngine("lazy-upper-bound", true); | 80 | lazyUpperStore = new MultiStageQueryEngine("lazy-upper-bound", true); |
| @@ -459,7 +459,7 @@ class MyQueryReasoner extends QueryReasoner { | |||
| 459 | if(lastTwoTriplesCounts.size() > 2) | 459 | if(lastTwoTriplesCounts.size() > 2) |
| 460 | lastTwoTriplesCounts.remove(); | 460 | lastTwoTriplesCounts.remove(); |
| 461 | 461 | ||
| 462 | Utility.logInfo("Last two triples counts:" + lastTwoTriplesCounts); | 462 | Utility.logDebug("Last two triples counts:" + lastTwoTriplesCounts); |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | relevantStore.dispose(); | 465 | relevantStore.dispose(); |
diff --git a/test/resources/ExistentialEvaluation.xml b/test/resources/ExistentialEvaluation.xml new file mode 100644 index 0000000..c0149e9 --- /dev/null +++ b/test/resources/ExistentialEvaluation.xml | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
| 3 | |||
| 4 | <suite name="ExistentialEvaluation"> | ||
| 5 | |||
| 6 | <test name="ExistentialEvaluation"> | ||
| 7 | |||
| 8 | <groups> | ||
| 9 | <run> | ||
| 10 | <include name="existential"/> | ||
| 11 | </run> | ||
| 12 | </groups> | ||
| 13 | |||
| 14 | <classes> | ||
| 15 | <class name="uk.ac.ox.cs.pagoda.global_tests.MadeUpCases" /> | ||
| 16 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM" />--> | ||
| 17 | <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaReactome" />--> | ||
| 18 | </classes> | ||
| 19 | |||
| 20 | </test> | ||
| 21 | |||
| 22 | </suite> \ No newline at end of file | ||
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java b/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java new file mode 100644 index 0000000..3d154cb --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/global_tests/MadeUpCases.java | |||
| @@ -0,0 +1,77 @@ | |||
| 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/TestPagodaReactome.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java index 6ef03c5..a13b7f4 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaReactome.java | |||
| @@ -37,4 +37,16 @@ public class TestPagodaReactome { | |||
| 37 | .run(); | 37 | .run(); |
| 38 | } | 38 | } |
| 39 | 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 | .build() | ||
| 49 | .run(); | ||
| 50 | } | ||
| 51 | |||
| 40 | } | 52 | } |
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java index 426bdf2..4dae223 100644 --- a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java +++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java | |||
| @@ -85,7 +85,7 @@ public class TestPagodaUOBM { | |||
| 85 | .run(); | 85 | .run(); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | @Test(groups = {"justExecute", "heavy", "nonOriginal"}) | 88 | @Test(groups = {"justExecute", "heavy", "nonOriginal", "existential"}) |
| 89 | public void justExecute_modifiedUOBM() throws IOException { | 89 | public void justExecute_modifiedUOBM() throws IOException { |
| 90 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); | 90 | String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); |
| 91 | 91 | ||
