diff options
| -rw-r--r-- | lib/ore/OREv2ReasonerWrapper.jar | bin | 0 -> 433263 bytes | |||
| -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 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java | 464 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java | 39 | ||||
| -rw-r--r-- | test/uk/ac/ox/cs/pagoda/tester/ORETester.java | 21 |
11 files changed, 623 insertions, 101 deletions
diff --git a/lib/ore/OREv2ReasonerWrapper.jar b/lib/ore/OREv2ReasonerWrapper.jar new file mode 100644 index 0000000..635dacc --- /dev/null +++ b/lib/ore/OREv2ReasonerWrapper.jar | |||
| Binary files differ | |||
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); |
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java new file mode 100644 index 0000000..4b0c1d4 --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java | |||
| @@ -0,0 +1,464 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.ore; | ||
| 2 | |||
| 3 | import java.util.HashMap; | ||
| 4 | import java.util.HashSet; | ||
| 5 | import java.util.List; | ||
| 6 | import java.util.Map; | ||
| 7 | import java.util.Set; | ||
| 8 | |||
| 9 | import org.semanticweb.owlapi.model.AxiomType; | ||
| 10 | import org.semanticweb.owlapi.model.IRI; | ||
| 11 | import org.semanticweb.owlapi.model.OWLAxiom; | ||
| 12 | import org.semanticweb.owlapi.model.OWLClass; | ||
| 13 | import org.semanticweb.owlapi.model.OWLClassExpression; | ||
| 14 | import org.semanticweb.owlapi.model.OWLDataFactory; | ||
| 15 | import org.semanticweb.owlapi.model.OWLDataProperty; | ||
| 16 | import org.semanticweb.owlapi.model.OWLDataPropertyExpression; | ||
| 17 | import org.semanticweb.owlapi.model.OWLLiteral; | ||
| 18 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | ||
| 19 | import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; | ||
| 20 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 21 | import org.semanticweb.owlapi.model.OWLOntologyChange; | ||
| 22 | import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException; | ||
| 23 | import org.semanticweb.owlapi.reasoner.BufferingMode; | ||
| 24 | import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException; | ||
| 25 | import org.semanticweb.owlapi.reasoner.FreshEntitiesException; | ||
| 26 | import org.semanticweb.owlapi.reasoner.FreshEntityPolicy; | ||
| 27 | import org.semanticweb.owlapi.reasoner.InconsistentOntologyException; | ||
| 28 | import org.semanticweb.owlapi.reasoner.IndividualNodeSetPolicy; | ||
| 29 | import org.semanticweb.owlapi.reasoner.InferenceType; | ||
| 30 | import org.semanticweb.owlapi.reasoner.Node; | ||
| 31 | import org.semanticweb.owlapi.reasoner.NodeSet; | ||
| 32 | import org.semanticweb.owlapi.reasoner.OWLReasoner; | ||
| 33 | import org.semanticweb.owlapi.reasoner.ReasonerInterruptedException; | ||
| 34 | import org.semanticweb.owlapi.reasoner.TimeOutException; | ||
| 35 | import org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException; | ||
| 36 | import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; | ||
| 37 | import org.semanticweb.owlapi.util.Version; | ||
| 38 | |||
| 39 | import uk.ac.ox.cs.JRDFox.model.GroundTerm; | ||
| 40 | import uk.ac.ox.cs.JRDFox.model.Individual; | ||
| 41 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 42 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 43 | |||
| 44 | public class PagodaOWLReasoner implements OWLReasoner { | ||
| 45 | |||
| 46 | QueryReasoner reasoner; | ||
| 47 | OWLOntology ontology; | ||
| 48 | OWLDataFactory factory; | ||
| 49 | boolean sat; | ||
| 50 | |||
| 51 | public PagodaOWLReasoner(OWLOntology ontology) { | ||
| 52 | this.ontology = ontology; | ||
| 53 | factory = ontology.getOWLOntologyManager().getOWLDataFactory(); | ||
| 54 | reasoner = QueryReasoner.getInstance(ontology); | ||
| 55 | reasoner.setToClassify(false); | ||
| 56 | reasoner.loadOntology(ontology); | ||
| 57 | sat = reasoner.preprocess(); | ||
| 58 | thing = new OWLClassNodeSet(factory.getOWLThing()); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public String getReasonerName() { | ||
| 63 | return "PAGOdA"; | ||
| 64 | } | ||
| 65 | |||
| 66 | @Override | ||
| 67 | public Version getReasonerVersion() { | ||
| 68 | return null; | ||
| 69 | } | ||
| 70 | |||
| 71 | @Override | ||
| 72 | public BufferingMode getBufferingMode() { | ||
| 73 | // TODO Auto-generated method stub | ||
| 74 | return null; | ||
| 75 | } | ||
| 76 | |||
| 77 | @Override | ||
| 78 | public void flush() { | ||
| 79 | // TODO Auto-generated method stub | ||
| 80 | |||
| 81 | } | ||
| 82 | |||
| 83 | @Override | ||
| 84 | public List<OWLOntologyChange> getPendingChanges() { | ||
| 85 | // TODO Auto-generated method stub | ||
| 86 | return null; | ||
| 87 | } | ||
| 88 | |||
| 89 | @Override | ||
| 90 | public Set<OWLAxiom> getPendingAxiomAdditions() { | ||
| 91 | // TODO Auto-generated method stub | ||
| 92 | return null; | ||
| 93 | } | ||
| 94 | |||
| 95 | @Override | ||
| 96 | public Set<OWLAxiom> getPendingAxiomRemovals() { | ||
| 97 | // TODO Auto-generated method stub | ||
| 98 | return null; | ||
| 99 | } | ||
| 100 | |||
| 101 | @Override | ||
| 102 | public OWLOntology getRootOntology() { | ||
| 103 | return ontology; | ||
| 104 | } | ||
| 105 | |||
| 106 | @Override | ||
| 107 | public void interrupt() { | ||
| 108 | // TODO Auto-generated method stub | ||
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | @Override | ||
| 113 | public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { | ||
| 114 | if (inferenceTypes.length == 1 && inferenceTypes[0].equals(InferenceType.CLASS_ASSERTIONS) && types.isEmpty()) { | ||
| 115 | Set<OWLClass> queriedClasses = new HashSet<OWLClass>(); | ||
| 116 | for (OWLOntology onto: ontology.getImportsClosure()) | ||
| 117 | for (OWLClass cls: onto.getClassesInSignature(true)) { | ||
| 118 | // if (cls.toStringID().equals("http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Meritage")); | ||
| 119 | // else continue; | ||
| 120 | if (!cls.equals(factory.getOWLThing()) && !queriedClasses.contains(cls)) { | ||
| 121 | queriedClasses.add(cls); | ||
| 122 | AnswerTuples tuples = null; | ||
| 123 | try { | ||
| 124 | tuples = reasoner.evaluate(String.format("select distinct ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <%s> .}", cls.toStringID())); | ||
| 125 | int cnt = 0; | ||
| 126 | for (GroundTerm t; tuples.isValid(); tuples.moveNext()) { | ||
| 127 | t = tuples.getTuple().getGroundTerm(0); | ||
| 128 | if (t instanceof Individual) { | ||
| 129 | addType(((Individual) t).getIRI(), cls); | ||
| 130 | ++cnt; | ||
| 131 | } | ||
| 132 | } | ||
| 133 | System.out.println("The number of answers: " + cnt); | ||
| 134 | } finally { | ||
| 135 | if (tuples != null) tuples.dispose(); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | private void addType(String iri, OWLClass cls) { | ||
| 143 | OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI.create(iri)); | ||
| 144 | OWLClassNodeSet set; | ||
| 145 | if (types.containsKey(ind)) { | ||
| 146 | set = types.get(ind); | ||
| 147 | } | ||
| 148 | else { | ||
| 149 | set = new OWLClassNodeSet(factory.getOWLThing()); | ||
| 150 | types.put(ind, set); | ||
| 151 | } | ||
| 152 | set.addEntity(cls); | ||
| 153 | } | ||
| 154 | |||
| 155 | @Override | ||
| 156 | public boolean isPrecomputed(InferenceType inferenceType) { | ||
| 157 | // TODO Auto-generated method stub | ||
| 158 | return false; | ||
| 159 | } | ||
| 160 | |||
| 161 | @Override | ||
| 162 | public Set<InferenceType> getPrecomputableInferenceTypes() { | ||
| 163 | return java.util.Collections.singleton(InferenceType.CLASS_ASSERTIONS); | ||
| 164 | } | ||
| 165 | |||
| 166 | @Override | ||
| 167 | public boolean isConsistent() throws ReasonerInterruptedException, TimeOutException { | ||
| 168 | return sat; | ||
| 169 | } | ||
| 170 | |||
| 171 | @Override | ||
| 172 | public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException { | ||
| 173 | // TODO Auto-generated method stub | ||
| 174 | return false; | ||
| 175 | } | ||
| 176 | |||
| 177 | @Override | ||
| 178 | public Node<OWLClass> getUnsatisfiableClasses() throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { | ||
| 179 | // TODO Auto-generated method stub | ||
| 180 | return null; | ||
| 181 | } | ||
| 182 | |||
| 183 | @Override | ||
| 184 | public boolean isEntailed(OWLAxiom axiom) | ||
| 185 | throws ReasonerInterruptedException, | ||
| 186 | UnsupportedEntailmentTypeException, TimeOutException, | ||
| 187 | AxiomNotInProfileException, FreshEntitiesException, | ||
| 188 | InconsistentOntologyException { | ||
| 189 | // TODO Auto-generated method stub | ||
| 190 | return false; | ||
| 191 | } | ||
| 192 | |||
| 193 | @Override | ||
| 194 | public boolean isEntailed(Set<? extends OWLAxiom> axioms) | ||
| 195 | throws ReasonerInterruptedException, | ||
| 196 | UnsupportedEntailmentTypeException, TimeOutException, | ||
| 197 | AxiomNotInProfileException, FreshEntitiesException, | ||
| 198 | InconsistentOntologyException { | ||
| 199 | // TODO Auto-generated method stub | ||
| 200 | return false; | ||
| 201 | } | ||
| 202 | |||
| 203 | @Override | ||
| 204 | public boolean isEntailmentCheckingSupported(AxiomType<?> axiomType) { | ||
| 205 | // TODO Auto-generated method stub | ||
| 206 | return false; | ||
| 207 | } | ||
| 208 | |||
| 209 | @Override | ||
| 210 | public Node<OWLClass> getTopClassNode() { | ||
| 211 | // TODO Auto-generated method stub | ||
| 212 | return null; | ||
| 213 | } | ||
| 214 | |||
| 215 | @Override | ||
| 216 | public Node<OWLClass> getBottomClassNode() { | ||
| 217 | // TODO Auto-generated method stub | ||
| 218 | return null; | ||
| 219 | } | ||
| 220 | |||
| 221 | @Override | ||
| 222 | public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct) | ||
| 223 | throws ReasonerInterruptedException, TimeOutException, | ||
| 224 | FreshEntitiesException, InconsistentOntologyException, | ||
| 225 | ClassExpressionNotInProfileException { | ||
| 226 | // TODO Auto-generated method stub | ||
| 227 | return null; | ||
| 228 | } | ||
| 229 | |||
| 230 | @Override | ||
| 231 | public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce, | ||
| 232 | boolean direct) throws InconsistentOntologyException, | ||
| 233 | ClassExpressionNotInProfileException, FreshEntitiesException, | ||
| 234 | ReasonerInterruptedException, TimeOutException { | ||
| 235 | // TODO Auto-generated method stub | ||
| 236 | return null; | ||
| 237 | } | ||
| 238 | |||
| 239 | @Override | ||
| 240 | public Node<OWLClass> getEquivalentClasses(OWLClassExpression ce) | ||
| 241 | throws InconsistentOntologyException, | ||
| 242 | ClassExpressionNotInProfileException, FreshEntitiesException, | ||
| 243 | ReasonerInterruptedException, TimeOutException { | ||
| 244 | // TODO Auto-generated method stub | ||
| 245 | return null; | ||
| 246 | } | ||
| 247 | |||
| 248 | @Override | ||
| 249 | public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) | ||
| 250 | throws ReasonerInterruptedException, TimeOutException, | ||
| 251 | FreshEntitiesException, InconsistentOntologyException { | ||
| 252 | // TODO Auto-generated method stub | ||
| 253 | return null; | ||
| 254 | } | ||
| 255 | |||
| 256 | @Override | ||
| 257 | public Node<OWLObjectPropertyExpression> getTopObjectPropertyNode() { | ||
| 258 | // TODO Auto-generated method stub | ||
| 259 | return null; | ||
| 260 | } | ||
| 261 | |||
| 262 | @Override | ||
| 263 | public Node<OWLObjectPropertyExpression> getBottomObjectPropertyNode() { | ||
| 264 | // TODO Auto-generated method stub | ||
| 265 | return null; | ||
| 266 | } | ||
| 267 | |||
| 268 | @Override | ||
| 269 | public NodeSet<OWLObjectPropertyExpression> getSubObjectProperties( | ||
| 270 | OWLObjectPropertyExpression pe, boolean direct) | ||
| 271 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 272 | ReasonerInterruptedException, TimeOutException { | ||
| 273 | // TODO Auto-generated method stub | ||
| 274 | return null; | ||
| 275 | } | ||
| 276 | |||
| 277 | @Override | ||
| 278 | public NodeSet<OWLObjectPropertyExpression> getSuperObjectProperties( | ||
| 279 | OWLObjectPropertyExpression pe, boolean direct) | ||
| 280 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 281 | ReasonerInterruptedException, TimeOutException { | ||
| 282 | // TODO Auto-generated method stub | ||
| 283 | return null; | ||
| 284 | } | ||
| 285 | |||
| 286 | @Override | ||
| 287 | public Node<OWLObjectPropertyExpression> getEquivalentObjectProperties( | ||
| 288 | OWLObjectPropertyExpression pe) | ||
| 289 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 290 | ReasonerInterruptedException, TimeOutException { | ||
| 291 | // TODO Auto-generated method stub | ||
| 292 | return null; | ||
| 293 | } | ||
| 294 | |||
| 295 | @Override | ||
| 296 | public NodeSet<OWLObjectPropertyExpression> getDisjointObjectProperties( | ||
| 297 | OWLObjectPropertyExpression pe) | ||
| 298 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 299 | ReasonerInterruptedException, TimeOutException { | ||
| 300 | // TODO Auto-generated method stub | ||
| 301 | return null; | ||
| 302 | } | ||
| 303 | |||
| 304 | @Override | ||
| 305 | public Node<OWLObjectPropertyExpression> getInverseObjectProperties( | ||
| 306 | OWLObjectPropertyExpression pe) | ||
| 307 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 308 | ReasonerInterruptedException, TimeOutException { | ||
| 309 | // TODO Auto-generated method stub | ||
| 310 | return null; | ||
| 311 | } | ||
| 312 | |||
| 313 | @Override | ||
| 314 | public NodeSet<OWLClass> getObjectPropertyDomains( | ||
| 315 | OWLObjectPropertyExpression pe, boolean direct) | ||
| 316 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 317 | ReasonerInterruptedException, TimeOutException { | ||
| 318 | // TODO Auto-generated method stub | ||
| 319 | return null; | ||
| 320 | } | ||
| 321 | |||
| 322 | @Override | ||
| 323 | public NodeSet<OWLClass> getObjectPropertyRanges( | ||
| 324 | OWLObjectPropertyExpression pe, boolean direct) | ||
| 325 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 326 | ReasonerInterruptedException, TimeOutException { | ||
| 327 | // TODO Auto-generated method stub | ||
| 328 | return null; | ||
| 329 | } | ||
| 330 | |||
| 331 | @Override | ||
| 332 | public Node<OWLDataProperty> getTopDataPropertyNode() { | ||
| 333 | // TODO Auto-generated method stub | ||
| 334 | return null; | ||
| 335 | } | ||
| 336 | |||
| 337 | @Override | ||
| 338 | public Node<OWLDataProperty> getBottomDataPropertyNode() { | ||
| 339 | // TODO Auto-generated method stub | ||
| 340 | return null; | ||
| 341 | } | ||
| 342 | |||
| 343 | @Override | ||
| 344 | public NodeSet<OWLDataProperty> getSubDataProperties(OWLDataProperty pe, | ||
| 345 | boolean direct) throws InconsistentOntologyException, | ||
| 346 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 347 | TimeOutException { | ||
| 348 | // TODO Auto-generated method stub | ||
| 349 | return null; | ||
| 350 | } | ||
| 351 | |||
| 352 | @Override | ||
| 353 | public NodeSet<OWLDataProperty> getSuperDataProperties(OWLDataProperty pe, | ||
| 354 | boolean direct) throws InconsistentOntologyException, | ||
| 355 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 356 | TimeOutException { | ||
| 357 | // TODO Auto-generated method stub | ||
| 358 | return null; | ||
| 359 | } | ||
| 360 | |||
| 361 | @Override | ||
| 362 | public Node<OWLDataProperty> getEquivalentDataProperties(OWLDataProperty pe) | ||
| 363 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 364 | ReasonerInterruptedException, TimeOutException { | ||
| 365 | // TODO Auto-generated method stub | ||
| 366 | return null; | ||
| 367 | } | ||
| 368 | |||
| 369 | @Override | ||
| 370 | public NodeSet<OWLDataProperty> getDisjointDataProperties( | ||
| 371 | OWLDataPropertyExpression pe) throws InconsistentOntologyException, | ||
| 372 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 373 | TimeOutException { | ||
| 374 | // TODO Auto-generated method stub | ||
| 375 | return null; | ||
| 376 | } | ||
| 377 | |||
| 378 | @Override | ||
| 379 | public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe, | ||
| 380 | boolean direct) throws InconsistentOntologyException, | ||
| 381 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 382 | TimeOutException { | ||
| 383 | // TODO Auto-generated method stub | ||
| 384 | return null; | ||
| 385 | } | ||
| 386 | |||
| 387 | private Map<OWLNamedIndividual, OWLClassNodeSet> types = new HashMap<OWLNamedIndividual, OWLClassNodeSet>(); | ||
| 388 | private OWLClassNodeSet thing; | ||
| 389 | |||
| 390 | @Override | ||
| 391 | public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { | ||
| 392 | if (types.containsKey(ind)) return types.get(ind); | ||
| 393 | return thing; | ||
| 394 | } | ||
| 395 | |||
| 396 | @Override | ||
| 397 | public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce, | ||
| 398 | boolean direct) throws InconsistentOntologyException, | ||
| 399 | ClassExpressionNotInProfileException, FreshEntitiesException, | ||
| 400 | ReasonerInterruptedException, TimeOutException { | ||
| 401 | // TODO Auto-generated method stub | ||
| 402 | return null; | ||
| 403 | } | ||
| 404 | |||
| 405 | @Override | ||
| 406 | public NodeSet<OWLNamedIndividual> getObjectPropertyValues( | ||
| 407 | OWLNamedIndividual ind, OWLObjectPropertyExpression pe) | ||
| 408 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 409 | ReasonerInterruptedException, TimeOutException { | ||
| 410 | // TODO Auto-generated method stub | ||
| 411 | return null; | ||
| 412 | } | ||
| 413 | |||
| 414 | @Override | ||
| 415 | public Set<OWLLiteral> getDataPropertyValues(OWLNamedIndividual ind, | ||
| 416 | OWLDataProperty pe) throws InconsistentOntologyException, | ||
| 417 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 418 | TimeOutException { | ||
| 419 | // TODO Auto-generated method stub | ||
| 420 | return null; | ||
| 421 | } | ||
| 422 | |||
| 423 | @Override | ||
| 424 | public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual ind) | ||
| 425 | throws InconsistentOntologyException, FreshEntitiesException, | ||
| 426 | ReasonerInterruptedException, TimeOutException { | ||
| 427 | // TODO Auto-generated method stub | ||
| 428 | return null; | ||
| 429 | } | ||
| 430 | |||
| 431 | @Override | ||
| 432 | public NodeSet<OWLNamedIndividual> getDifferentIndividuals( | ||
| 433 | OWLNamedIndividual ind) throws InconsistentOntologyException, | ||
| 434 | FreshEntitiesException, ReasonerInterruptedException, | ||
| 435 | TimeOutException { | ||
| 436 | // TODO Auto-generated method stub | ||
| 437 | return null; | ||
| 438 | } | ||
| 439 | |||
| 440 | @Override | ||
| 441 | public long getTimeOut() { | ||
| 442 | // TODO Auto-generated method stub | ||
| 443 | return 0; | ||
| 444 | } | ||
| 445 | |||
| 446 | @Override | ||
| 447 | public FreshEntityPolicy getFreshEntityPolicy() { | ||
| 448 | // TODO Auto-generated method stub | ||
| 449 | return null; | ||
| 450 | } | ||
| 451 | |||
| 452 | @Override | ||
| 453 | public IndividualNodeSetPolicy getIndividualNodeSetPolicy() { | ||
| 454 | // TODO Auto-generated method stub | ||
| 455 | return null; | ||
| 456 | } | ||
| 457 | |||
| 458 | @Override | ||
| 459 | public void dispose() { | ||
| 460 | // TODO Auto-generated method stub | ||
| 461 | |||
| 462 | } | ||
| 463 | |||
| 464 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java new file mode 100644 index 0000000..8ecdf1d --- /dev/null +++ b/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.ore; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 4 | import org.semanticweb.owlapi.reasoner.IllegalConfigurationException; | ||
| 5 | import org.semanticweb.owlapi.reasoner.OWLReasoner; | ||
| 6 | import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration; | ||
| 7 | import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; | ||
| 8 | |||
| 9 | public class PagodaReasonerFactory implements OWLReasonerFactory { | ||
| 10 | |||
| 11 | @Override | ||
| 12 | public String getReasonerName() { | ||
| 13 | return "PAGOdA"; | ||
| 14 | } | ||
| 15 | |||
| 16 | @Override | ||
| 17 | public OWLReasoner createNonBufferingReasoner(OWLOntology ontology) { | ||
| 18 | // TODO Auto-generated method stub | ||
| 19 | return null; | ||
| 20 | } | ||
| 21 | |||
| 22 | @Override | ||
| 23 | public OWLReasoner createReasoner(OWLOntology ontology) { | ||
| 24 | return new PagodaOWLReasoner(ontology); | ||
| 25 | } | ||
| 26 | |||
| 27 | @Override | ||
| 28 | public OWLReasoner createNonBufferingReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException { | ||
| 29 | // TODO Auto-generated method stub | ||
| 30 | return null; | ||
| 31 | } | ||
| 32 | |||
| 33 | @Override | ||
| 34 | public OWLReasoner createReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException { | ||
| 35 | // TODO Auto-generated method stub | ||
| 36 | return null; | ||
| 37 | } | ||
| 38 | |||
| 39 | } | ||
diff --git a/test/uk/ac/ox/cs/pagoda/tester/ORETester.java b/test/uk/ac/ox/cs/pagoda/tester/ORETester.java deleted file mode 100644 index ae58ba9..0000000 --- a/test/uk/ac/ox/cs/pagoda/tester/ORETester.java +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.tester; | ||
| 2 | |||
| 3 | import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; | ||
| 4 | import uk.ac.ox.cs.pagoda.util.Properties; | ||
| 5 | |||
| 6 | public class ORETester { | ||
| 7 | |||
| 8 | public static void main(String... args) { | ||
| 9 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/DL/00a1118a-5420-46f0-b4b2-a2585165b28a_ePizza.owl" }; | ||
| 10 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/DL/77de15c6-cc39-4960-a38a-e35e487d52b0_owl%2Fcoma" }; | ||
| 11 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/DL/wine_nodatatype.owl" }; | ||
| 12 | |||
| 13 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/b7700fe1-103b-4b32-a21c-f6604a763ba5_t-cell.owl" }; | ||
| 14 | // args = new String[] { "/home/yzhou/krr-nas-share/Yujiao/ontologies/ORE2014/EL/baa29363-f93c-4285-827e-0e2380c82efc_cations.n3" }; | ||
| 15 | |||
| 16 | Properties properties = new Properties("config/sys.conf"); | ||
| 17 | QueryReasoner pagoda = QueryReasoner.getInstance(properties); | ||
| 18 | pagoda.dispose(); | ||
| 19 | } | ||
| 20 | |||
| 21 | } | ||
