aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-07-08 18:53:00 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-07-08 18:53:00 +0100
commit8241a535a55508b6c504f4f0b426612fe95d15a5 (patch)
tree720a6572bbdf303b9ddfe69dd461b6640b36e6a0 /test
parent77dd8849f8e79d324c8e12cd699912f284a8fdba (diff)
downloadACQuA-8241a535a55508b6c504f4f0b426612fe95d15a5.tar.gz
ACQuA-8241a535a55508b6c504f4f0b426612fe95d15a5.zip
Internalisation: added condition for existential variables (classes HermitChecker and QueryGraph).
Answer dependencies: found bug, trying to solve; excluding dependency analysis solve the problem.
Diffstat (limited to 'test')
-rw-r--r--test/resources/MainTests.xml8
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java60
2 files changed, 63 insertions, 5 deletions
diff --git a/test/resources/MainTests.xml b/test/resources/MainTests.xml
index cfe6184..db8d977 100644
--- a/test/resources/MainTests.xml
+++ b/test/resources/MainTests.xml
@@ -5,17 +5,17 @@
5 <test name="main"> 5 <test name="main">
6 <groups> 6 <groups>
7 <run> 7 <run>
8 <!--<include name="correctness"/>--> 8 <include name="correctness"/>
9 <!--<include name="light"/>--> 9 <!--<include name="light"/>-->
10 <!--<include name="justExecute"/>--> 10 <!--<include name="justExecute"/>-->
11 <!--&lt;!&ndash;<include name="heavy"/>&ndash;&gt;--> 11 <!--&lt;!&ndash;<include name="heavy"/>&ndash;&gt;-->
12 <include name="nonOriginal"/> 12 <!--<include name="nonOriginal"/>-->
13 </run> 13 </run>
14 </groups> 14 </groups>
15 <classes> 15 <classes>
16 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaReactome"/>--> 16 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaReactome"/>-->
17 <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/> 17 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM"/>-->
18 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/>--> 18 <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM"/>
19 <!--Fly does not terminate: query-5 looks really hard--> 19 <!--Fly does not terminate: query-5 looks really hard-->
20 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaFLY"/>--> 20 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaFLY"/>-->
21 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.SkolemisationTests"/>--> 21 <!--<class name="uk.ac.ox.cs.pagoda.global_tests.SkolemisationTests"/>-->
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java b/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java
index 19e0b2a..6e60e24 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/BugTests.java
@@ -23,6 +23,64 @@ public class BugTests {
23 } 23 }
24 24
25 @Test 25 @Test
26 public void minimumCardinalityAxiom2() 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 student = factory.getOWLClass(getEntityIRI("Student"));
37// manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(student));
38// OWLClass course = factory.getOWLClass(getEntityIRI("Course"));
39// manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(course));
40 OWLClass hardWorkingStudent = factory.getOWLClass(getEntityIRI("HardWorkingStudent"));
41 manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(hardWorkingStudent));
42 OWLNamedIndividual a = factory.getOWLNamedIndividual(getEntityIRI("a"));
43 OWLNamedIndividual b = factory.getOWLNamedIndividual(getEntityIRI("b"));
44 OWLObjectProperty takesCourse = factory.getOWLObjectProperty(IRI.create(String.format(NS, "takesCourse")));
45 manager.addAxiom(ontology, factory.getOWLDeclarationAxiom(takesCourse));
46
47 // Class assertions
48 manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, a)); // HardWorkingStudent(a)
49 manager.addAxiom(ontology, factory.getOWLClassAssertionAxiom(hardWorkingStudent, b)); // HardWorkingStudent(b)
50
51 // Minimum cardinality axiom
52 manager.addAxiom(ontology,
53 factory.getOWLEquivalentClassesAxiom(hardWorkingStudent,
54 factory.getOWLObjectMinCardinality(3,
55 takesCourse)));
56
57// manager.saveOntology(ontology, Files.newOutputStream(Paths.get("/home/alessandro/Desktop/test-ontology.owl")));
58
59 /*
60 * Test one query
61 * */
62
63 QueryReasoner pagoda = QueryReasoner.getInstance(ontology);
64 pagoda.loadOntology(ontology);
65 if (pagoda.preprocess()) {
66 String query = "select distinct ?x ?y " +
67 " where { "
68 + " ?x <" + takesCourse.toStringID() + "> _:z . "
69 + " ?y <" + takesCourse.toStringID() + "> _:z " +
70 " }";
71 AnswerTuples answers = pagoda.evaluate(query);
72 int count = 0;
73 for (AnswerTuple ans; answers.isValid(); answers.moveNext()) {
74 ans = answers.getTuple();
75 TestUtil.logInfo(ans);
76 count++;
77 }
78 Assert.assertEquals(count, 2);
79 }
80 pagoda.dispose();
81 }
82
83// @Test
26 public void minimumCardinalityAxiom() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { 84 public void minimumCardinalityAxiom() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException {
27 85
28 /* 86 /*
@@ -107,7 +165,7 @@ public class BugTests {
107 * @throws IOException 165 * @throws IOException
108 * @throws OWLOntologyStorageException 166 * @throws OWLOntologyStorageException
109 */ 167 */
110 @Test 168// @Test
111 public void rTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException { 169 public void rTest() throws OWLOntologyCreationException, IOException, OWLOntologyStorageException {
112 170
113 /* 171 /*