diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner')
| -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 |
3 files changed, 35 insertions, 29 deletions
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())); |
