diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-05-14 16:56:26 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-05-14 16:56:26 +0100 |
| commit | bd995407098d1b0c79c17a28b0b23a2c24a493c6 (patch) | |
| tree | e4bf7a3abf566a0ae29a7cf27d8685f2e8343909 /src/uk/ac/ox/cs | |
| parent | 6fd8b21066852cbc21e247e7cf0a2f423ebc1658 (diff) | |
| download | ACQuA-bd995407098d1b0c79c17a28b0b23a2c24a493c6.tar.gz ACQuA-bd995407098d1b0c79c17a28b0b23a2c24a493c6.zip | |
It executes. Matching bounds for query 18 of UOBM.
It is not stable: several critical fixes to do!
Diffstat (limited to 'src/uk/ac/ox/cs')
6 files changed, 44 insertions, 40 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java b/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java index f80da5f..4ba2715 100644 --- a/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java +++ b/src/uk/ac/ox/cs/pagoda/multistage/MultiStageQueryEngine.java | |||
| @@ -143,6 +143,10 @@ public class MultiStageQueryEngine extends StageQueryEngine { | |||
| 143 | subTimer.reset(); | 143 | subTimer.reset(); |
| 144 | oldTripleCount = store.getTriplesCount(); | 144 | oldTripleCount = store.getTriplesCount(); |
| 145 | for (Violation v : violations) { | 145 | for (Violation v : violations) { |
| 146 | |||
| 147 | Utility.logDebug("Dealing with violation: " + v.constraint); | ||
| 148 | Utility.logDebug("Number of violation tuples: " + v.size()); | ||
| 149 | |||
| 146 | Timer localTimer = new Timer(); | 150 | Timer localTimer = new Timer(); |
| 147 | int number = v.size(); | 151 | int number = v.size(); |
| 148 | long vOldCounter = store.getTriplesCount(); | 152 | long vOldCounter = store.getTriplesCount(); |
| @@ -151,8 +155,8 @@ public class MultiStageQueryEngine extends StageQueryEngine { | |||
| 151 | Utility.logInfo(name + " store FAILED for multi-stage materialisation in " + t.duration() + " seconds."); | 155 | Utility.logInfo(name + " store FAILED for multi-stage materialisation in " + t.duration() + " seconds."); |
| 152 | return 0; | 156 | return 0; |
| 153 | } | 157 | } |
| 154 | Utility.logDebug("Time to make the constraint being satisfied: " + localTimer.duration() + " " + number + " tuples for " + v.constraint); | 158 | Utility.logDebug("Time to make the constraint being satisfied: " + localTimer.duration()); |
| 155 | Utility.logDebug("tuple number: " + v.size() + " before: " + vOldCounter + " after: " + store.getTriplesCount() + " (" + (store.getTriplesCount() - vOldCounter) + " new) ." ); | 159 | Utility.logDebug("Triples in the store: before=" + vOldCounter + ", after=" + store.getTriplesCount() + ", new=" + (store.getTriplesCount() - vOldCounter)); |
| 156 | } | 160 | } |
| 157 | Utility.logDebug(name + " store after adding facts for violations: " + (tripleCount = store.getTriplesCount()) + " (" + (tripleCount - oldTripleCount) + " new)"); | 161 | Utility.logDebug(name + " store after adding facts for violations: " + (tripleCount = store.getTriplesCount()) + " (" + (tripleCount - oldTripleCount) + " new)"); |
| 158 | Utility.logDebug("Time to add triples for violations: " + subTimer.duration()); | 162 | Utility.logDebug("Time to add triples for violations: " + subTimer.duration()); |
diff --git a/src/uk/ac/ox/cs/pagoda/multistage/Violation.java b/src/uk/ac/ox/cs/pagoda/multistage/Violation.java index b872f00..2f98784 100644 --- a/src/uk/ac/ox/cs/pagoda/multistage/Violation.java +++ b/src/uk/ac/ox/cs/pagoda/multistage/Violation.java | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.multistage; | 1 | package uk.ac.ox.cs.pagoda.multistage; |
| 2 | 2 | ||
| 3 | import java.util.LinkedList; | ||
| 4 | |||
| 5 | import org.semanticweb.HermiT.model.DLClause; | 3 | import org.semanticweb.HermiT.model.DLClause; |
| 6 | 4 | ||
| 5 | import java.util.LinkedList; | ||
| 6 | |||
| 7 | public class Violation { | 7 | public class Violation { |
| 8 | 8 | ||
| 9 | DLClause clause = null; | 9 | DLClause clause = null; |
| @@ -41,6 +41,13 @@ public class Violation { | |||
| 41 | public String[] getVariables() { | 41 | public String[] getVariables() { |
| 42 | return vars; | 42 | return vars; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | 45 | @Override | |
| 46 | public String toString() { | ||
| 47 | return "Violation{" + | ||
| 48 | "constraint=" + constraint + | ||
| 49 | ", clause=" + clause + | ||
| 50 | ", tuples=" + tuples + | ||
| 51 | '}'; | ||
| 52 | } | ||
| 46 | } | 53 | } |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java index d179d14..b7a3667 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/ConsistencyManager.java | |||
| @@ -73,6 +73,9 @@ public class ConsistencyManager { | |||
| 73 | AnswerTuples tuples = null; | 73 | AnswerTuples tuples = null; |
| 74 | try { | 74 | try { |
| 75 | tuples = m_reasoner.lazyUpperStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables()); | 75 | tuples = m_reasoner.lazyUpperStore.evaluate(fullQueryRecord.getQueryText(), fullQueryRecord.getAnswerVariables()); |
| 76 | |||
| 77 | Utility.logDebug("CheckLazyUpperBound: answerVars=" + fullQueryRecord.getAnswerVariables()); | ||
| 78 | |||
| 76 | if (!tuples.isValid()) { | 79 | if (!tuples.isValid()) { |
| 77 | Utility.logInfo("There are no contradictions derived in the lazy upper bound materialisation."); | 80 | Utility.logInfo("There are no contradictions derived in the lazy upper bound materialisation."); |
| 78 | return satisfiability(t.duration()); | 81 | return satisfiability(t.duration()); |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java index 233963e..36ea7de 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/MyQueryReasoner.java | |||
| @@ -33,7 +33,8 @@ public class MyQueryReasoner extends QueryReasoner { | |||
| 33 | DatalogProgram program; | 33 | DatalogProgram program; |
| 34 | 34 | ||
| 35 | BasicQueryEngine rlLowerStore = null; | 35 | BasicQueryEngine rlLowerStore = null; |
| 36 | BasicQueryEngine lazyUpperStore = null; | 36 | BasicQueryEngine lazyUpperStore = null; |
| 37 | BasicQueryEngine limitedSkolemUpperStore; | ||
| 37 | // boolean[] namedIndividuals_lazyUpper; | 38 | // boolean[] namedIndividuals_lazyUpper; |
| 38 | 39 | ||
| 39 | OWLOntology elho_ontology; | 40 | OWLOntology elho_ontology; |
| @@ -49,7 +50,6 @@ public class MyQueryReasoner extends QueryReasoner { | |||
| 49 | private Collection<String> predicatesWithGap = null; | 50 | private Collection<String> predicatesWithGap = null; |
| 50 | private Boolean satisfiable; | 51 | private Boolean satisfiable; |
| 51 | private ConsistencyManager consistency = new ConsistencyManager(this); | 52 | private ConsistencyManager consistency = new ConsistencyManager(this); |
| 52 | BasicQueryEngine limitedSkolemUpperStore; | ||
| 53 | 53 | ||
| 54 | public MyQueryReasoner() { | 54 | public MyQueryReasoner() { |
| 55 | setup(true, true); | 55 | setup(true, true); |
| @@ -163,10 +163,11 @@ public class MyQueryReasoner extends QueryReasoner { | |||
| 163 | } | 163 | } |
| 164 | if (tag == -1) return false; | 164 | if (tag == -1) return false; |
| 165 | } | 165 | } |
| 166 | if (consistency.checkSkolemUpper()) { | 166 | // FIXME nullPointerException |
| 167 | satisfiable = true; | 167 | // if (consistency.checkSkolemUpper()) { |
| 168 | Utility.logInfo("time for satisfiability checking: " + t.duration()); | 168 | // satisfiable = true; |
| 169 | } | 169 | // Utility.logInfo("time for satisfiability checking: " + t.duration()); |
| 170 | // } | ||
| 170 | 171 | ||
| 171 | trackingStore.importRDFData(name, datafile); | 172 | trackingStore.importRDFData(name, datafile); |
| 172 | trackingStore.materialise("saturate named individuals", originalMarkProgram); | 173 | trackingStore.materialise("saturate named individuals", originalMarkProgram); |
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxTripleManager.java b/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxTripleManager.java index c2065dc..232bc31 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxTripleManager.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxTripleManager.java | |||
| @@ -1,31 +1,17 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.reasoner.light; | 1 | package uk.ac.ox.cs.pagoda.reasoner.light; |
| 2 | 2 | ||
| 3 | import java.util.Collection; | 3 | import org.semanticweb.HermiT.model.*; |
| 4 | import java.util.HashMap; | ||
| 5 | import java.util.LinkedList; | ||
| 6 | import java.util.Map; | ||
| 7 | import java.util.Queue; | ||
| 8 | import org.semanticweb.HermiT.model.AnnotatedEquality; | ||
| 9 | import org.semanticweb.HermiT.model.Atom; | ||
| 10 | import org.semanticweb.HermiT.model.AtomicConcept; | ||
| 11 | import org.semanticweb.HermiT.model.AtomicRole; | ||
| 12 | import org.semanticweb.HermiT.model.Constant; | ||
| 13 | import org.semanticweb.HermiT.model.DLPredicate; | ||
| 14 | import org.semanticweb.HermiT.model.Equality; | ||
| 15 | import org.semanticweb.HermiT.model.Individual; | ||
| 16 | import org.semanticweb.HermiT.model.Inequality; | ||
| 17 | import org.semanticweb.HermiT.model.Term; | ||
| 18 | import org.semanticweb.HermiT.model.Variable; | ||
| 19 | |||
| 20 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 21 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 22 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; | 4 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; |
| 5 | import uk.ac.ox.cs.JRDFox.model.Datatype; | ||
| 23 | import uk.ac.ox.cs.JRDFox.model.GroundTerm; | 6 | import uk.ac.ox.cs.JRDFox.model.GroundTerm; |
| 24 | import uk.ac.ox.cs.JRDFox.store.DataStore; | 7 | import uk.ac.ox.cs.JRDFox.store.DataStore; |
| 25 | import uk.ac.ox.cs.JRDFox.model.Datatype; | ||
| 26 | import uk.ac.ox.cs.JRDFox.store.Dictionary; | ||
| 27 | import uk.ac.ox.cs.JRDFox.store.DataStore.UpdateType; | 8 | import uk.ac.ox.cs.JRDFox.store.DataStore.UpdateType; |
| 9 | import uk.ac.ox.cs.JRDFox.store.Dictionary; | ||
| 28 | import uk.ac.ox.cs.JRDFox.store.Resource; | 10 | import uk.ac.ox.cs.JRDFox.store.Resource; |
| 11 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 12 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 13 | |||
| 14 | import java.util.*; | ||
| 29 | 15 | ||
| 30 | public class RDFoxTripleManager { | 16 | public class RDFoxTripleManager { |
| 31 | 17 | ||
| @@ -183,10 +169,11 @@ public class RDFoxTripleManager { | |||
| 183 | int sizeLimit = 10000; | 169 | int sizeLimit = 10000; |
| 184 | 170 | ||
| 185 | private int getResourceID(Term arg, Map<Variable, Integer> assignment) { | 171 | private int getResourceID(Term arg, Map<Variable, Integer> assignment) { |
| 186 | while (termCache.size() > sizeLimit) | 172 | // FIXME infinite loop |
| 187 | termCache.remove(termList.poll()); | 173 | // while (termCache.size() > sizeLimit) |
| 174 | // termCache.remove(termList.poll()); | ||
| 188 | 175 | ||
| 189 | if (arg instanceof Variable) return assignment.get((Variable) arg); | 176 | if (arg instanceof Variable) return assignment.get(arg); |
| 190 | Integer id = null; | 177 | Integer id = null; |
| 191 | if ((id = termCache.get(arg)) != null) | 178 | if ((id = termCache.get(arg)) != null) |
| 192 | return id; | 179 | return id; |
diff --git a/src/uk/ac/ox/cs/pagoda/rules/approximators/LimitedSkolemisationApproximator.java b/src/uk/ac/ox/cs/pagoda/rules/approximators/LimitedSkolemisationApproximator.java index 4444c00..ba58e23 100644 --- a/src/uk/ac/ox/cs/pagoda/rules/approximators/LimitedSkolemisationApproximator.java +++ b/src/uk/ac/ox/cs/pagoda/rules/approximators/LimitedSkolemisationApproximator.java | |||
| @@ -79,9 +79,11 @@ public class LimitedSkolemisationApproximator implements TupleDependentApproxima | |||
| 79 | TupleBuilder<Individual> commonIndividualsBuilder = new TupleBuilder<>(); | 79 | TupleBuilder<Individual> commonIndividualsBuilder = new TupleBuilder<>(); |
| 80 | for (int i = 0; i < commonVars.length; i++) | 80 | for (int i = 0; i < commonVars.length; i++) |
| 81 | commonIndividualsBuilder.add(violationTuple.get(i)); | 81 | commonIndividualsBuilder.add(violationTuple.get(i)); |
| 82 | Tuple<Individual> commonIndividuals = commonIndividualsBuilder.create(); | ||
| 82 | 83 | ||
| 83 | Atom headAtom = clause.getHeadAtom(0); | 84 | Atom headAtom = clause.getHeadAtom(0); |
| 84 | Atom[] bodyAtoms = clause.getBodyAtoms(); | 85 | |
| 86 | // Atom[] bodyAtoms = clause.getBodyAtoms(); | ||
| 85 | int offset = OverApproxExist.indexOfExistential(headAtom, originalClause); | 87 | int offset = OverApproxExist.indexOfExistential(headAtom, originalClause); |
| 86 | 88 | ||
| 87 | // BEGIN: copy and paste | 89 | // BEGIN: copy and paste |
| @@ -111,15 +113,15 @@ public class LimitedSkolemisationApproximator implements TupleDependentApproxima | |||
| 111 | for (int i = 0; i < card; ++i) | 113 | for (int i = 0; i < card; ++i) |
| 112 | individuals[i] = termsManager.getFreshIndividual(originalClause, | 114 | individuals[i] = termsManager.getFreshIndividual(originalClause, |
| 113 | offset + i, | 115 | offset + i, |
| 114 | commonIndividualsBuilder.create()); | 116 | commonIndividuals); |
| 115 | 117 | ||
| 116 | for (int i = 0; i < card; ++i) { | 118 | for (int i = 0; i < card; ++i) { |
| 117 | if (atomicConcept != null) | 119 | if (atomicConcept != null) |
| 118 | ret.add(DLClause.create(new Atom[] {Atom.create(atomicConcept, individuals[i])}, EMPTY_BODY)); | 120 | ret.add(DLClause.create(new Atom[] {Atom.create(atomicConcept, individuals[i])}, EMPTY_BODY)); |
| 119 | 121 | ||
| 120 | Atom atom = role instanceof AtomicRole ? | 122 | Atom atom = role instanceof AtomicRole ? |
| 121 | Atom.create((AtomicRole) role, X, individuals[i]) : | 123 | Atom.create((AtomicRole) role, commonIndividuals.get(0), individuals[i]) : |
| 122 | Atom.create(((InverseRole) role).getInverseOf(), individuals[i], X); | 124 | Atom.create(((InverseRole) role).getInverseOf(), individuals[i], commonIndividuals.get(0)); |
| 123 | 125 | ||
| 124 | ret.add(DLClause.create(new Atom[] {atom}, EMPTY_BODY)); | 126 | ret.add(DLClause.create(new Atom[] {atom}, EMPTY_BODY)); |
| 125 | } | 127 | } |
