diff options
Diffstat (limited to 'src/uk')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/approx/Clause.java | 91 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java | 31 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | 10 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java | 2 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | 7 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java | 55 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/rules/Program.java | 4 |
7 files changed, 120 insertions, 80 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 | } |
diff --git a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java index a43d9af..a60b664 100644 --- a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java +++ b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java | |||
| @@ -31,6 +31,8 @@ import org.semanticweb.owlapi.model.OWLDataMinCardinality; | |||
| 31 | import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; | 31 | import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; |
| 32 | import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom; | 32 | import org.semanticweb.owlapi.model.OWLDataSomeValuesFrom; |
| 33 | import org.semanticweb.owlapi.model.OWLDatatype; | 33 | import org.semanticweb.owlapi.model.OWLDatatype; |
| 34 | import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom; | ||
| 35 | import org.semanticweb.owlapi.model.OWLIndividual; | ||
| 34 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | 36 | import org.semanticweb.owlapi.model.OWLNamedIndividual; |
| 35 | import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; | 37 | import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; |
| 36 | import org.semanticweb.owlapi.model.OWLObjectComplementOf; | 38 | import org.semanticweb.owlapi.model.OWLObjectComplementOf; |
| @@ -46,6 +48,7 @@ import org.semanticweb.owlapi.model.OWLOntology; | |||
| 46 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; | 48 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; |
| 47 | import org.semanticweb.owlapi.model.OWLOntologyManager; | 49 | import org.semanticweb.owlapi.model.OWLOntologyManager; |
| 48 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; | 50 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; |
| 51 | import org.semanticweb.owlapi.model.OWLSameIndividualAxiom; | ||
| 49 | import org.semanticweb.owlapi.profiles.OWL2RLProfile; | 52 | import org.semanticweb.owlapi.profiles.OWL2RLProfile; |
| 50 | import org.semanticweb.owlapi.profiles.OWLProfileReport; | 53 | import org.semanticweb.owlapi.profiles.OWLProfileReport; |
| 51 | import org.semanticweb.owlapi.profiles.OWLProfileViolation; | 54 | import org.semanticweb.owlapi.profiles.OWLProfileViolation; |
| @@ -360,6 +363,9 @@ public class RLPlusOntology implements KnowledgeBase { | |||
| 360 | Map<OWLClassExpression, OWLClass> complex2atomic= new HashMap<OWLClassExpression, OWLClass>(); | 363 | Map<OWLClassExpression, OWLClass> complex2atomic= new HashMap<OWLClassExpression, OWLClass>(); |
| 361 | 364 | ||
| 362 | OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI")); | 365 | OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI")); |
| 366 | OWLObjectProperty sameAs = factory.getOWLObjectProperty(IRI.create(Namespace.EQUALITY)); | ||
| 367 | OWLObjectProperty differentFrom = factory.getOWLObjectProperty(IRI.create(Namespace.INEQUALITY)); | ||
| 368 | |||
| 363 | for (OWLOntology imported: inputOntology.getImportsClosure()) | 369 | for (OWLOntology imported: inputOntology.getImportsClosure()) |
| 364 | for (OWLAxiom axiom: imported.getAxioms()) { | 370 | for (OWLAxiom axiom: imported.getAxioms()) { |
| 365 | if (axiom instanceof OWLClassAssertionAxiom) { | 371 | if (axiom instanceof OWLClassAssertionAxiom) { |
| @@ -381,10 +387,33 @@ public class RLPlusOntology implements KnowledgeBase { | |||
| 381 | } | 387 | } |
| 382 | } | 388 | } |
| 383 | else if (axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) { | 389 | else if (axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) { |
| 384 | if (axiom.containsEntityInSignature(anyURI)) continue; | 390 | if (axiom.getDataPropertiesInSignature().contains(anyURI)) continue; |
| 385 | flag = true; | 391 | flag = true; |
| 386 | manager.addAxiom(aBox, axiom); | 392 | manager.addAxiom(aBox, axiom); |
| 387 | } | 393 | } |
| 394 | else if (axiom instanceof OWLSameIndividualAxiom) { | ||
| 395 | OWLIndividual firstIndividual = null, previousIndividual = null, lastIndividual = null; | ||
| 396 | for (OWLIndividual next: ((OWLSameIndividualAxiom) axiom).getIndividuals()) { | ||
| 397 | if (firstIndividual == null) firstIndividual = previousIndividual = next; | ||
| 398 | else | ||
| 399 | manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, previousIndividual, next)); | ||
| 400 | previousIndividual = lastIndividual = next; | ||
| 401 | } | ||
| 402 | manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, lastIndividual, firstIndividual)); | ||
| 403 | } | ||
| 404 | else if (axiom instanceof OWLDifferentIndividualsAxiom) { | ||
| 405 | int index1 = 0, index2; | ||
| 406 | for (OWLIndividual individual1: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) { | ||
| 407 | ++index1; | ||
| 408 | index2 = 0; | ||
| 409 | for (OWLIndividual individual2: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) { | ||
| 410 | if (index2++ < index1) { | ||
| 411 | manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(differentFrom, individual1, individual2)); | ||
| 412 | } | ||
| 413 | else break; | ||
| 414 | } | ||
| 415 | } | ||
| 416 | } | ||
| 388 | else | 417 | else |
| 389 | manager.addAxiom(tBox, axiom); | 418 | manager.addAxiom(tBox, axiom); |
| 390 | } | 419 | } |
diff --git a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java index 11b0c75..26b0c1a 100644 --- a/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java +++ b/src/uk/ac/ox/cs/pagoda/query/rollup/QueryGraph.java | |||
| @@ -42,6 +42,8 @@ import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; | |||
| 42 | import org.semanticweb.owlapi.model.OWLObjectUnionOf; | 42 | import org.semanticweb.owlapi.model.OWLObjectUnionOf; |
| 43 | import org.semanticweb.owlapi.model.OWLOntology; | 43 | import org.semanticweb.owlapi.model.OWLOntology; |
| 44 | 44 | ||
| 45 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 46 | |||
| 45 | public class QueryGraph { | 47 | public class QueryGraph { |
| 46 | 48 | ||
| 47 | Set<Variable> freeVars = new HashSet<Variable>(); | 49 | Set<Variable> freeVars = new HashSet<Variable>(); |
| @@ -63,10 +65,10 @@ public class QueryGraph { | |||
| 63 | 65 | ||
| 64 | for (Atom atom: bodyAtoms) { | 66 | for (Atom atom: bodyAtoms) { |
| 65 | if (atom.getArity() == 1) { | 67 | if (atom.getArity() == 1) { |
| 66 | updateExistentiallyVariables(atom.getArgumentVariable(0)); | 68 | updateExistentiallyVariables(atom.getArgumentVariable(0)); |
| 67 | IRI iri = IRI.create(((AtomicConcept) atom.getDLPredicate()).getIRI()); | 69 | String id = ((AtomicConcept) atom.getDLPredicate()).getIRI(); |
| 68 | if (ontology.containsClassInSignature(iri)) | 70 | if (!id.equals(Namespace.PAGODA_ORIGINAL)) |
| 69 | concepts.add(atom.getArgument(0), factory.getOWLClass(IRI.create(((AtomicConcept) atom.getDLPredicate()).getIRI()))); | 71 | concepts.add(atom.getArgument(0), factory.getOWLClass(IRI.create(id))); |
| 70 | } | 72 | } |
| 71 | else if (atom.getArity() == 2) { | 73 | else if (atom.getArity() == 2) { |
| 72 | updateExistentiallyVariables(atom.getArgumentVariable(0)); | 74 | updateExistentiallyVariables(atom.getArgumentVariable(0)); |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java index 7d3e40c..63fe246 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java | |||
| @@ -108,7 +108,7 @@ public class ConsistencyManager { | |||
| 108 | } catch (OWLOntologyCreationException e) { | 108 | } catch (OWLOntologyCreationException e) { |
| 109 | e.printStackTrace(); | 109 | e.printStackTrace(); |
| 110 | } | 110 | } |
| 111 | fullQueryRecord.saveRelevantClause(); | 111 | // fullQueryRecord.saveRelevantClause(); |
| 112 | 112 | ||
| 113 | boolean satisfiability; | 113 | boolean satisfiability; |
| 114 | 114 | ||
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index 875dcdd..17838ae 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | |||
| @@ -296,13 +296,14 @@ public class MyQueryReasoner extends QueryReasoner { | |||
| 296 | 296 | ||
| 297 | Timer t = new Timer(); | 297 | Timer t = new Timer(); |
| 298 | Checker summarisedChecker = new HermitSummaryFilter(queryRecord, properties.getToCallHermiT()); | 298 | Checker summarisedChecker = new HermitSummaryFilter(queryRecord, properties.getToCallHermiT()); |
| 299 | int validNumber = summarisedChecker.check(queryRecord.getGapAnswers()); | 299 | // int validNumber = |
| 300 | summarisedChecker.check(queryRecord.getGapAnswers()); | ||
| 300 | summarisedChecker.dispose(); | 301 | summarisedChecker.dispose(); |
| 301 | Utility.logDebug("Total time for full reasoner: " + t.duration()); | 302 | Utility.logDebug("Total time for full reasoner: " + t.duration()); |
| 302 | if (validNumber == 0) { | 303 | // if (validNumber == 0) { |
| 303 | queryRecord.markAsProcessed(); | 304 | queryRecord.markAsProcessed(); |
| 304 | Utility.logDebug("Difficulty of this query: " + queryRecord.getDifficulty()); | 305 | Utility.logDebug("Difficulty of this query: " + queryRecord.getDifficulty()); |
| 305 | } | 306 | // } |
| 306 | } | 307 | } |
| 307 | 308 | ||
| 308 | @Override | 309 | @Override |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java index 97925fc..4dd11d8 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/full/HermitChecker.java | |||
| @@ -77,7 +77,8 @@ public class HermitChecker implements Checker { | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | private int tag = 0; | 79 | private int tag = 0; |
| 80 | AnswerTuple topAnswerTuple = null, botAnswerTuple = null; | 80 | // AnswerTuple topAnswerTuple = null; |
| 81 | AnswerTuple botAnswerTuple = null; | ||
| 81 | 82 | ||
| 82 | private void initialiseReasoner() { | 83 | private void initialiseReasoner() { |
| 83 | qGraph = new QueryGraph(queryClause.getBodyAtoms(), answerVariable[1], ontology); | 84 | qGraph = new QueryGraph(queryClause.getBodyAtoms(), answerVariable[1], ontology); |
| @@ -96,8 +97,9 @@ public class HermitChecker implements Checker { | |||
| 96 | manager.removeAxioms(ontology, axioms); | 97 | manager.removeAxioms(ontology, axioms); |
| 97 | hermit = new Reasoner(ontology); | 98 | hermit = new Reasoner(ontology); |
| 98 | } else { | 99 | } else { |
| 99 | if (topAnswerTuple != null && !check(topAnswerTuple)) tag = -1; | 100 | // if (topAnswerTuple != null && !check(topAnswerTuple)) tag = -1; |
| 100 | else if (botAnswerTuple != null && check(botAnswerTuple)) tag = 1; | 101 | // else |
| 102 | if (botAnswerTuple != null && check(botAnswerTuple)) tag = 1; | ||
| 101 | } | 103 | } |
| 102 | } | 104 | } |
| 103 | else | 105 | else |
| @@ -105,19 +107,22 @@ public class HermitChecker implements Checker { | |||
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | private void addTopAndBotTuple(Set<OWLAxiom> axioms) { | 109 | private void addTopAndBotTuple(Set<OWLAxiom> axioms) { |
| 108 | String top_str = Namespace.PAGODA_ANONY + "top", bot_str = Namespace.PAGODA_ANONY + "bot"; | 110 | // String top_str = Namespace.PAGODA_ANONY + "top"; |
| 109 | topAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(top_str) } ); | 111 | String bot_str = Namespace.PAGODA_ANONY + "bot"; |
| 112 | // topAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(top_str) } ); | ||
| 110 | botAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(bot_str) } ); | 113 | botAnswerTuple = new AnswerTuple(new uk.ac.ox.cs.JRDFox.model.Individual[] { uk.ac.ox.cs.JRDFox.model.Individual.create(bot_str) } ); |
| 111 | OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)), bot_ind = factory.getOWLNamedIndividual(IRI.create(bot_str)); | 114 | // OWLIndividual top_ind = factory.getOWLNamedIndividual(IRI.create(top_str)); |
| 115 | OWLIndividual bot_ind = factory.getOWLNamedIndividual(IRI.create(bot_str)); | ||
| 112 | Map<OWLAxiom, Integer> counter = new HashMap<OWLAxiom, Integer>(); | 116 | Map<OWLAxiom, Integer> counter = new HashMap<OWLAxiom, Integer>(); |
| 113 | 117 | ||
| 114 | Set<String> topAnswers = new HashSet<String>(), botAnswers = new HashSet<String>(); | 118 | // Set<String> topAnswers = new HashSet<String>(); |
| 119 | Set<String> botAnswers = new HashSet<String>(); | ||
| 115 | OWLIndividual sub, obj; | 120 | OWLIndividual sub, obj; |
| 116 | if (dGraph.getExits().size() > 1) { | 121 | // if (dGraph.getExits().size() > 1) { |
| 117 | for (Clique answerClique: dGraph.getExits()) | 122 | // for (Clique answerClique: dGraph.getExits()) |
| 118 | topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative().getAnswerTuple().getGroundTerm(0)).getIRI()); | 123 | // topAnswers.add(((uk.ac.ox.cs.JRDFox.model.Individual) answerClique.getRepresentative().getAnswerTuple().getGroundTerm(0)).getIRI()); |
| 119 | } | 124 | // } |
| 120 | else topAnswerTuple = null; | 125 | // else topAnswerTuple = null; |
| 121 | 126 | ||
| 122 | if (dGraph.getEntrances().size() > 1) { | 127 | if (dGraph.getEntrances().size() > 1) { |
| 123 | for (Clique answerClique: dGraph.getEntrances()) | 128 | for (Clique answerClique: dGraph.getEntrances()) |
| @@ -129,23 +134,23 @@ public class HermitChecker implements Checker { | |||
| 129 | if (axiom instanceof OWLClassAssertionAxiom) { | 134 | if (axiom instanceof OWLClassAssertionAxiom) { |
| 130 | OWLClassAssertionAxiom ca = (OWLClassAssertionAxiom) axiom; | 135 | OWLClassAssertionAxiom ca = (OWLClassAssertionAxiom) axiom; |
| 131 | sub = ca.getIndividual(); | 136 | sub = ca.getIndividual(); |
| 132 | if (topAnswers.contains(sub.toStringID())) | 137 | // if (topAnswers.contains(sub.toStringID())) |
| 133 | axioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind)); | 138 | // axioms.add(factory.getOWLClassAssertionAxiom(ca.getClassExpression(), top_ind)); |
| 134 | if (botAnswers.contains(sub.toStringID())) | 139 | if (botAnswers.contains(sub.toStringID())) |
| 135 | inc(counter, factory.getOWLClassAssertionAxiom(ca.getClassExpression(), bot_ind)); | 140 | inc(counter, factory.getOWLClassAssertionAxiom(ca.getClassExpression(), bot_ind)); |
| 136 | } | 141 | } |
| 137 | else if (axiom instanceof OWLObjectPropertyAssertionAxiom) { | 142 | else if (axiom instanceof OWLObjectPropertyAssertionAxiom) { |
| 138 | OWLObjectPropertyAssertionAxiom oa = (OWLObjectPropertyAssertionAxiom) axiom; | 143 | OWLObjectPropertyAssertionAxiom oa = (OWLObjectPropertyAssertionAxiom) axiom; |
| 139 | sub = oa.getSubject(); obj = oa.getObject(); | 144 | sub = oa.getSubject(); obj = oa.getObject(); |
| 140 | if (topAnswers.contains(sub.toStringID())) | 145 | //// if (topAnswers.contains(sub.toStringID())) |
| 141 | if (topAnswers.contains(obj.toStringID())) | 146 | //// if (topAnswers.contains(obj.toStringID())) |
| 142 | axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind)); | 147 | //// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, top_ind)); |
| 143 | else | 148 | //// else |
| 144 | axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj)); | 149 | //// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), top_ind, obj)); |
| 145 | else { | 150 | //// else { |
| 146 | if (topAnswers.contains(obj.toStringID())) | 151 | //// if (topAnswers.contains(obj.toStringID())) |
| 147 | axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind)); | 152 | //// axioms.add(factory.getOWLObjectPropertyAssertionAxiom(oa.getProperty(), sub, top_ind)); |
| 148 | } | 153 | //// } |
| 149 | 154 | ||
| 150 | if (botAnswers.contains(sub.toStringID())) | 155 | if (botAnswers.contains(sub.toStringID())) |
| 151 | if (botAnswers.contains(obj.toStringID())) | 156 | if (botAnswers.contains(obj.toStringID())) |
| @@ -161,8 +166,8 @@ public class HermitChecker implements Checker { | |||
| 161 | else if (axiom instanceof OWLDataPropertyAssertionAxiom) { | 166 | else if (axiom instanceof OWLDataPropertyAssertionAxiom) { |
| 162 | OWLDataPropertyAssertionAxiom da = (OWLDataPropertyAssertionAxiom) axiom; | 167 | OWLDataPropertyAssertionAxiom da = (OWLDataPropertyAssertionAxiom) axiom; |
| 163 | sub = da.getSubject(); | 168 | sub = da.getSubject(); |
| 164 | if (topAnswers.contains(sub.toStringID())) | 169 | // if (topAnswers.contains(sub.toStringID())) |
| 165 | axioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject())); | 170 | // axioms.add(factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), top_ind, da.getObject())); |
| 166 | 171 | ||
| 167 | if (botAnswers.contains(sub.toStringID())) | 172 | if (botAnswers.contains(sub.toStringID())) |
| 168 | inc(counter, factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), bot_ind, da.getObject())); | 173 | inc(counter, factory.getOWLDataPropertyAssertionAxiom(da.getProperty(), bot_ind, da.getObject())); |
diff --git a/src/uk/ac/ox/cs/pagoda/rules/Program.java b/src/uk/ac/ox/cs/pagoda/rules/Program.java index b533e50..83cd21a 100644 --- a/src/uk/ac/ox/cs/pagoda/rules/Program.java +++ b/src/uk/ac/ox/cs/pagoda/rules/Program.java | |||
| @@ -138,7 +138,7 @@ public abstract class Program implements KnowledgeBase { | |||
| 138 | transitiveAxioms = new LinkedList<OWLTransitiveObjectPropertyAxiom>(); | 138 | transitiveAxioms = new LinkedList<OWLTransitiveObjectPropertyAxiom>(); |
| 139 | subPropChainAxioms = new LinkedList<OWLSubPropertyChainOfAxiom>(); | 139 | subPropChainAxioms = new LinkedList<OWLSubPropertyChainOfAxiom>(); |
| 140 | 140 | ||
| 141 | OWLEntity date = ontology.getOWLOntologyManager().getOWLDataFactory().getOWLDatatype(IRI.create("http://www.w3.org/2001/XMLSchema#date")); | 141 | OWLDatatype date = ontology.getOWLOntologyManager().getOWLDataFactory().getOWLDatatype(IRI.create("http://www.w3.org/2001/XMLSchema#date")); |
| 142 | int noOfDataPropertyRangeAxioms = 0, noOfAxioms = 0; | 142 | int noOfDataPropertyRangeAxioms = 0, noOfAxioms = 0; |
| 143 | for (OWLOntology onto: ontology.getImportsClosure()) | 143 | for (OWLOntology onto: ontology.getImportsClosure()) |
| 144 | for (OWLAxiom axiom: onto.getAxioms()) { | 144 | for (OWLAxiom axiom: onto.getAxioms()) { |
| @@ -152,7 +152,7 @@ public abstract class Program implements KnowledgeBase { | |||
| 152 | Utility.logInfo("The axiom: " + axiom + " is being ignored."); | 152 | Utility.logInfo("The axiom: " + axiom + " is being ignored."); |
| 153 | } | 153 | } |
| 154 | else { | 154 | else { |
| 155 | if (axiom.containsEntityInSignature(date)) { | 155 | if (axiom.getDatatypesInSignature().contains(date)) { |
| 156 | Utility.logInfo("The axiom: " + axiom + " is being ignored."); | 156 | Utility.logInfo("The axiom: " + axiom + " is being ignored."); |
| 157 | } | 157 | } |
| 158 | else manager.addAxiom(filteredOntology, axiom); | 158 | else manager.addAxiom(filteredOntology, axiom); |
