From 9ce65c5a963b03ee97fe9cb6c5aa65a3c04a80a8 Mon Sep 17 00:00:00 2001 From: yzhou Date: Tue, 21 Apr 2015 10:34:27 +0100 Subject: initial version --- .../ox/cs/pagoda/reasoner/ConsistencyManager2.java | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager2.java') 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 @@ +package uk.ac.ox.cs.pagoda.reasoner; + +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; + +import uk.ac.ox.cs.pagoda.query.QueryRecord; +import uk.ac.ox.cs.pagoda.reasoner.full.Checker; +import uk.ac.ox.cs.pagoda.summary.HermitSummaryFilter; +import uk.ac.ox.cs.pagoda.tracking.QueryTracker; +import uk.ac.ox.cs.pagoda.util.Utility; + +@Deprecated +public class ConsistencyManager2 extends ConsistencyManager { + + public ConsistencyManager2(MyQueryReasoner reasoner) { + super(reasoner); + fragmentExtracted = true; + } + + protected boolean unsatisfiability(double duration) { + Utility.logDebug("The ontology and dataset is unsatisfiable."); + return false; + } + + protected boolean satisfiability(double duration) { + Utility.logDebug("The ontology and dataset is satisfiable."); + return true; + } + + @Override + boolean check() { +// if (!checkRLLowerBound()) return false; +// if (!checkELLowerBound()) return false; + if (checkLazyUpper()) return true; + + fullQueryRecord.updateUpperBoundAnswers(m_reasoner.trackingStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables())); + if (fullQueryRecord.getNoOfCompleteAnswers() == 0) + return satisfiability(t.duration()); + + try { + extractAxioms(); + } catch (OWLOntologyCreationException e) { + e.printStackTrace(); + } + + Checker checker = new HermitSummaryFilter(fullQueryRecord); // m_reasoner.factory.getSummarisedReasoner(fullQueryRecord); +// fullQueryRecord.saveRelevantOntology("fragment_bottom.owl"); + boolean satisfiable = checker.isConsistent(); + checker.dispose(); + if (!satisfiable) return unsatisfiability(t.duration()); + + return satisfiability(t.duration()); + } + + private void extractAxioms() throws OWLOntologyCreationException { + OWLOntologyManager manager = m_reasoner.encoder.getProgram().getOntology().getOWLOntologyManager(); + fullQueryRecord.setRelevantOntology(manager.createOntology()); + QueryTracker tracker = new QueryTracker(m_reasoner.encoder, m_reasoner.rlLowerStore, fullQueryRecord); + m_reasoner.encoder.setCurrentQuery(fullQueryRecord); + tracker.extract(m_reasoner.trackingStore, null, true); + } + + @Override + public QueryRecord[] getQueryRecords() { + if (botQueryRecords == null) + botQueryRecords = new QueryRecord[] {fullQueryRecord}; + return botQueryRecords; + } + +} -- cgit v1.2.3