diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java new file mode 100644 index 0000000..67dc4fc --- /dev/null +++ b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.reasoner; | ||
| 2 | |||
| 3 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; | ||
| 4 | import org.semanticweb.owlapi.model.OWLOntologyManager; | ||
| 5 | |||
| 6 | import uk.ac.ox.cs.pagoda.query.QueryRecord; | ||
| 7 | import uk.ac.ox.cs.pagoda.reasoner.full.Checker; | ||
| 8 | import uk.ac.ox.cs.pagoda.summary.HermitSummaryFilter; | ||
| 9 | import uk.ac.ox.cs.pagoda.tracking.QueryTracker; | ||
| 10 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 11 | |||
| 12 | @Deprecated | ||
| 13 | public class ConsistencyManager2 extends ConsistencyManager { | ||
| 14 | |||
| 15 | public ConsistencyManager2(MyQueryReasoner reasoner) { | ||
| 16 | super(reasoner); | ||
| 17 | fragmentExtracted = true; | ||
| 18 | } | ||
| 19 | |||
| 20 | protected boolean unsatisfiability(double duration) { | ||
| 21 | Utility.logDebug("The ontology and dataset is unsatisfiable."); | ||
| 22 | return false; | ||
| 23 | } | ||
| 24 | |||
| 25 | protected boolean satisfiability(double duration) { | ||
| 26 | Utility.logDebug("The ontology and dataset is satisfiable."); | ||
| 27 | return true; | ||
| 28 | } | ||
| 29 | |||
| 30 | @Override | ||
| 31 | boolean check() { | ||
| 32 | // if (!checkRLLowerBound()) return false; | ||
| 33 | // if (!checkELLowerBound()) return false; | ||
| 34 | if (checkLazyUpper()) return true; | ||
| 35 | |||
| 36 | fullQueryRecord.updateUpperBoundAnswers(m_reasoner.trackingStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables())); | ||
| 37 | if (fullQueryRecord.getNoOfCompleteAnswers() == 0) | ||
| 38 | return satisfiability(t.duration()); | ||
| 39 | |||
| 40 | try { | ||
| 41 | extractAxioms(); | ||
| 42 | } catch (OWLOntologyCreationException e) { | ||
| 43 | e.printStackTrace(); | ||
| 44 | } | ||
| 45 | |||
| 46 | Checker checker = new HermitSummaryFilter(fullQueryRecord); // m_reasoner.factory.getSummarisedReasoner(fullQueryRecord); | ||
| 47 | // fullQueryRecord.saveRelevantOntology("fragment_bottom.owl"); | ||
| 48 | boolean satisfiable = checker.isConsistent(); | ||
| 49 | checker.dispose(); | ||
| 50 | if (!satisfiable) return unsatisfiability(t.duration()); | ||
| 51 | |||
| 52 | return satisfiability(t.duration()); | ||
| 53 | } | ||
| 54 | |||
| 55 | private void extractAxioms() throws OWLOntologyCreationException { | ||
| 56 | OWLOntologyManager manager = m_reasoner.encoder.getProgram().getOntology().getOWLOntologyManager(); | ||
| 57 | fullQueryRecord.setRelevantOntology(manager.createOntology()); | ||
| 58 | QueryTracker tracker = new QueryTracker(m_reasoner.encoder, m_reasoner.rlLowerStore, fullQueryRecord); | ||
| 59 | m_reasoner.encoder.setCurrentQuery(fullQueryRecord); | ||
| 60 | tracker.extract(m_reasoner.trackingStore, null, true); | ||
| 61 | } | ||
| 62 | |||
| 63 | @Override | ||
| 64 | public QueryRecord[] getQueryRecords() { | ||
| 65 | if (botQueryRecords == null) | ||
| 66 | botQueryRecords = new QueryRecord[] {fullQueryRecord}; | ||
| 67 | return botQueryRecords; | ||
| 68 | } | ||
| 69 | |||
| 70 | } | ||
