aboutsummaryrefslogtreecommitdiff
path: root/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-05-15 17:32:22 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-05-15 17:32:22 +0100
commit1b6a128137e5d7a6ff75566869232fc054afabef (patch)
tree3def49c3c9c1e2ebebc49b82d9eb562b6d097cad /test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java
parentbd995407098d1b0c79c17a28b0b23a2c24a493c6 (diff)
downloadACQuA-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/test_units/ClauseTester.java')
-rw-r--r--test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java164
1 files changed, 0 insertions, 164 deletions
diff --git a/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java b/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java
deleted file mode 100644
index a0f16d4..0000000
--- a/test/uk/ac/ox/cs/pagoda/test_units/ClauseTester.java
+++ /dev/null
@@ -1,164 +0,0 @@
1package uk.ac.ox.cs.pagoda.test_units;
2
3import org.semanticweb.HermiT.model.Atom;
4import org.semanticweb.HermiT.model.AtomicConcept;
5import org.semanticweb.HermiT.model.AtomicRole;
6import org.semanticweb.HermiT.model.DLClause;
7import org.semanticweb.HermiT.model.Equality;
8import org.semanticweb.HermiT.model.Variable;
9import org.semanticweb.owlapi.apibinding.OWLManager;
10import org.semanticweb.owlapi.model.OWLOntology;
11import org.semanticweb.owlapi.model.OWLOntologyManager;
12
13import org.testng.Assert;
14import org.testng.annotations.Test;
15import uk.ac.ox.cs.pagoda.approx.Clause;
16import uk.ac.ox.cs.pagoda.approx.Clausifier;
17
18public class ClauseTester {
19
20 @Test
21 public void test_simple() {
22 Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2");
23 AtomicConcept A = AtomicConcept.create("A");
24 AtomicRole r = AtomicRole.create("r");
25 Atom[] bodyAtoms = new Atom[] {
26 Atom.create(A, x),
27 Atom.create(r, x, y1),
28 Atom.create(r, x, y2)
29 };
30
31 Atom[] headAtoms = new Atom[] {
32 Atom.create(Equality.INSTANCE, y1, y2)
33 };
34
35 OWLOntologyManager m = OWLManager.createOWLOntologyManager();
36 OWLOntology emptyOntology = null;
37 try {
38 emptyOntology = m.createOntology();
39 } catch (Exception e) {
40 e.printStackTrace();
41 Assert.fail("failed to create a new ontology");
42 }
43 Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms));
44 System.out.println(c.toString());
45 }
46
47 @Test
48 public void test_more() {
49 Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2"), y3 = Variable.create("y3");
50 AtomicConcept A = AtomicConcept.create("A");
51 AtomicRole r = AtomicRole.create("r");
52 Atom[] bodyAtoms = new Atom[] {
53 Atom.create(A, x),
54 Atom.create(r, x, y1),
55 Atom.create(r, x, y2),
56 Atom.create(r, x, y3),
57 };
58
59 Atom[] headAtoms = new Atom[] {
60 Atom.create(Equality.INSTANCE, y1, y2),
61 Atom.create(Equality.INSTANCE, y1, y3),
62 Atom.create(Equality.INSTANCE, y2, y3)
63 };
64
65 OWLOntologyManager m = OWLManager.createOWLOntologyManager();
66 OWLOntology emptyOntology = null;
67 try {
68 emptyOntology = m.createOntology();
69 } catch (Exception e) {
70 e.printStackTrace();
71 Assert.fail("failed to create a new ontology");
72 }
73 Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms));
74 System.out.println(c.toString());
75 }
76
77 @Test
78 public void test_inverse() {
79 Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2");
80 AtomicConcept A = AtomicConcept.create("A");
81 AtomicRole r = AtomicRole.create("r");
82 Atom[] bodyAtoms = new Atom[] {
83 Atom.create(A, x),
84 Atom.create(r, y1, x),
85 Atom.create(r, y2, x)
86 };
87
88 Atom[] headAtoms = new Atom[] {
89 Atom.create(Equality.INSTANCE, y1, y2)
90 };
91
92 OWLOntologyManager m = OWLManager.createOWLOntologyManager();
93 OWLOntology emptyOntology = null;
94 try {
95 emptyOntology = m.createOntology();
96 } catch (Exception e) {
97 e.printStackTrace();
98 Assert.fail("failed to create a new ontology");
99 }
100 Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms));
101 System.out.println(c.toString());
102 }
103
104 @Test
105 public void test_fillter() {
106 Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2");
107 AtomicConcept A = AtomicConcept.create("A");
108 AtomicConcept B = AtomicConcept.create("B");
109 AtomicRole r = AtomicRole.create("r");
110 Atom[] bodyAtoms = new Atom[] {
111 Atom.create(A, x),
112 Atom.create(r, y1, x),
113 Atom.create(r, y2, x),
114 Atom.create(B, y1),
115 Atom.create(B, y2)
116 };
117
118 Atom[] headAtoms = new Atom[] {
119 Atom.create(Equality.INSTANCE, y1, y2)
120 };
121
122 OWLOntologyManager m = OWLManager.createOWLOntologyManager();
123 OWLOntology emptyOntology = null;
124 try {
125 emptyOntology = m.createOntology();
126 } catch (Exception e) {
127 e.printStackTrace();
128 Assert.fail("failed to create a new ontology");
129 }
130 Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms));
131 System.out.println(c.toString());
132 }
133
134 @Test
135 public void test_negFillter() {
136 Variable x = Variable.create("X"), y1 = Variable.create("y1"), y2 = Variable.create("y2");
137 AtomicConcept A = AtomicConcept.create("A");
138 AtomicConcept B = AtomicConcept.create("B");
139 AtomicRole r = AtomicRole.create("r");
140 Atom[] bodyAtoms = new Atom[] {
141 Atom.create(A, x),
142 Atom.create(r, y1, x),
143 Atom.create(r, y2, x)
144 };
145
146 Atom[] headAtoms = new Atom[] {
147 Atom.create(Equality.INSTANCE, y1, y2),
148 Atom.create(B, y1),
149 Atom.create(B, y2)
150 };
151
152 OWLOntologyManager m = OWLManager.createOWLOntologyManager();
153 OWLOntology emptyOntology = null;
154 try {
155 emptyOntology = m.createOntology();
156 } catch (Exception e) {
157 e.printStackTrace();
158 Assert.fail("failed to create a new ontology");
159 }
160 Clause c = new Clause(Clausifier.getInstance(emptyOntology), DLClause.create(headAtoms, bodyAtoms));
161 System.out.println(c.toString());
162 }
163
164}