aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/approx/Clause.java
diff options
context:
space:
mode:
authoryzhou <yzhou@krr-linux.cs.ox.ac.uk>2015-04-28 17:13:55 +0100
committeryzhou <yzhou@krr-linux.cs.ox.ac.uk>2015-04-28 17:13:55 +0100
commit4013a9d33d0f1a06b87d12dd0543912c53bba137 (patch)
tree717d2ef6f8743031af689b2cd6f94ffc55fd5e70 /src/uk/ac/ox/cs/pagoda/approx/Clause.java
parent30b5afef93bdb4f0ee0e7647fb0dd3d9c84e452a (diff)
downloadACQuA-4013a9d33d0f1a06b87d12dd0543912c53bba137.tar.gz
ACQuA-4013a9d33d0f1a06b87d12dd0543912c53bba137.zip
pass the wine realisation
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/approx/Clause.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/approx/Clause.java91
1 files changed, 47 insertions, 44 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/approx/Clause.java b/src/uk/ac/ox/cs/pagoda/approx/Clause.java
index 9c3f5d0..29bc74e 100644
--- a/src/uk/ac/ox/cs/pagoda/approx/Clause.java
+++ b/src/uk/ac/ox/cs/pagoda/approx/Clause.java
@@ -68,7 +68,7 @@ public class Clause {
68 getVariableOccurrence(var2atom, bodyAtoms); 68 getVariableOccurrence(var2atom, bodyAtoms);
69 69
70 DLPredicate predicate; 70 DLPredicate predicate;
71 Variable W = null; 71 Term W = null;
72 72
73 Map<Variable, String> nom2iri = new HashMap<Variable, String>(); 73 Map<Variable, String> nom2iri = new HashMap<Variable, String>();
74 Map<Variable, Constant> nom2datatype = new HashMap<Variable, Constant>(); 74 Map<Variable, Constant> nom2datatype = new HashMap<Variable, Constant>();
@@ -97,8 +97,7 @@ public class Clause {
97 AtomicConcept concept = (AtomicConcept) predicate; 97 AtomicConcept concept = (AtomicConcept) predicate;
98 Variable v = atom.getArgumentVariable(0); 98 Variable v = atom.getArgumentVariable(0);
99 if (v == X) 99 if (v == X)
100 subClasses.add(factory.getOWLClass(IRI.create(concept 100 subClasses.add(factory.getOWLClass(IRI.create(concept.getIRI())));
101 .getIRI())));
102 else if (predicate.toString().startsWith("<internal:nom#")) 101 else if (predicate.toString().startsWith("<internal:nom#"))
103 nom2iri.put(v, DLClauseHelper.getIRI4Nominal(concept)); 102 nom2iri.put(v, DLClauseHelper.getIRI4Nominal(concept));
104 } else if (predicate instanceof AtomicRole) { 103 } else if (predicate instanceof AtomicRole) {
@@ -168,54 +167,58 @@ public class Clause {
168 167
169 OWLObjectPropertyExpression roleExp = factory 168 OWLObjectPropertyExpression roleExp = factory
170 .getOWLObjectProperty(IRI.create(role.getIRI())); 169 .getOWLObjectProperty(IRI.create(role.getIRI()));
171 if ((W = atom.getArgumentVariable(1)) == X) { 170 if ((W = atom.getArgument(1)).equals(X)) {
172 roleExp = roleExp.getInverseProperty(); 171 roleExp = roleExp.getInverseProperty();
173 W = atom.getArgumentVariable(0); 172 W = atom.getArgument(0);
174 } 173 }
175 174
176 if (X == W) 175 if (X == W)
177 subClasses.add(factory.getOWLObjectHasSelf(roleExp)); 176 subClasses.add(factory.getOWLObjectHasSelf(roleExp));
178 177 else if (W instanceof Individual)
179 AtomicConcept concept; 178 subClasses.add(factory.getOWLObjectHasValue(roleExp, factory.getOWLNamedIndividual(IRI.create(((Individual) W).getIRI()))));
180 OWLClassExpression clsExp = null; 179 else {
181 int number = 1; 180 AtomicConcept concept;
182 Set<Variable> set = varCliques.get(W); 181 OWLClassExpression clsExp = null;
183 if (set != null) 182 int number = 1;
184 number = set.size(); 183 Set<Variable> set = varCliques.get(W);
185 184 if (set != null)
186 if (var2atom.containsKey(W)) { 185 number = set.size();
187 Atom tAtom = var2atom.get(W); 186
188 DLPredicate tPredicate = tAtom.getDLPredicate(); 187 if (var2atom.containsKey(W)) {
189 if (tPredicate instanceof AtomicConcept) { 188 Atom tAtom = var2atom.get(W);
190 concept = (AtomicConcept) tPredicate; 189 DLPredicate tPredicate = tAtom.getDLPredicate();
191 clsExp = factory.getOWLClass(IRI.create(concept 190 if (tPredicate instanceof AtomicConcept) {
192 .getIRI())); 191 concept = (AtomicConcept) tPredicate;
193 if (headAtoms.contains(tAtom)) { 192 clsExp = factory.getOWLClass(IRI.create(concept
194 superClasses.add(factory.getOWLObjectAllValuesFrom( 193 .getIRI()));
195 roleExp, clsExp)); 194 if (headAtoms.contains(tAtom)) {
196 subClasses.add(factory.getOWLObjectSomeValuesFrom( 195 superClasses.add(factory.getOWLObjectAllValuesFrom(
197 roleExp, factory.getOWLThing())); 196 roleExp, clsExp));
198 headAtoms.remove(tAtom); 197 subClasses.add(factory.getOWLObjectSomeValuesFrom(
198 roleExp, factory.getOWLThing()));
199 headAtoms.remove(tAtom);
200 } else {
201 if (number == 1)
202 subClasses.add(factory
203 .getOWLObjectSomeValuesFrom(roleExp,
204 clsExp));
205 else
206 subClasses.add(factory
207 .getOWLObjectMinCardinality(number,
208 roleExp, clsExp));
209 }
199 } else { 210 } else {
200 if (number == 1) 211 Utility.logDebug(tAtom, "strange ... -___-|||");
201 subClasses.add(factory
202 .getOWLObjectSomeValuesFrom(roleExp,
203 clsExp));
204 else
205 subClasses.add(factory
206 .getOWLObjectMinCardinality(number,
207 roleExp, clsExp));
208 } 212 }
209 } else {
210 Utility.logDebug(tAtom, "strange ... -___-|||");
211 } 213 }
212 } else { 214 else {
213 if (number == 1) 215 if (number == 1)
214 subClasses.add(factory.getOWLObjectSomeValuesFrom( 216 subClasses.add(factory.getOWLObjectSomeValuesFrom(
215 roleExp, factory.getOWLThing())); 217 roleExp, factory.getOWLThing()));
216 else 218 else
217 subClasses.add(factory.getOWLObjectMinCardinality( 219 subClasses.add(factory.getOWLObjectMinCardinality(
218 number, roleExp)); 220 number, roleExp));
221 }
219 } 222 }
220 } 223 }
221 } 224 }