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