diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java b/src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java index 1c0eb48..84929ad 100644 --- a/src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java +++ b/src/uk/ac/ox/cs/pagoda/query/GapByStore4ID.java | |||
| @@ -8,6 +8,7 @@ import uk.ac.ox.cs.pagoda.MyPrefixes; | |||
| 8 | //import uk.ac.ox.cs.pagoda.multistage.AnswerTupleID; | 8 | //import uk.ac.ox.cs.pagoda.multistage.AnswerTupleID; |
| 9 | import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine; | 9 | import uk.ac.ox.cs.pagoda.reasoner.light.BasicQueryEngine; |
| 10 | import uk.ac.ox.cs.pagoda.reasoner.light.RDFoxTripleManager; | 10 | import uk.ac.ox.cs.pagoda.reasoner.light.RDFoxTripleManager; |
| 11 | import uk.ac.ox.cs.pagoda.util.Namespace; | ||
| 11 | import uk.ac.ox.cs.pagoda.util.Timer; | 12 | import uk.ac.ox.cs.pagoda.util.Timer; |
| 12 | import uk.ac.ox.cs.pagoda.util.Utility; | 13 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 13 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; | 14 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; |
| @@ -17,14 +18,14 @@ import uk.ac.ox.cs.JRDFox.store.TupleIterator; | |||
| 17 | //public class GapByStore4ID extends GapTupleIterator<AnswerTupleID> { | 18 | //public class GapByStore4ID extends GapTupleIterator<AnswerTupleID> { |
| 18 | public class GapByStore4ID extends GapTupleIterator<int[]> { | 19 | public class GapByStore4ID extends GapTupleIterator<int[]> { |
| 19 | 20 | ||
| 20 | private MyPrefixes prefixes = MyPrefixes.PAGOdAPrefixes; | 21 | protected MyPrefixes prefixes = MyPrefixes.PAGOdAPrefixes; |
| 21 | private TupleIterator iterator = null; | 22 | protected TupleIterator iterator = null; |
| 22 | 23 | ||
| 23 | // AnswerTupleID tuple; | 24 | // AnswerTupleID tuple; |
| 24 | int[] tuple; | 25 | protected int[] tuple; |
| 25 | private BasicQueryEngine m_engine; | 26 | protected BasicQueryEngine m_engine; |
| 26 | private DataStore m_store; | 27 | protected DataStore m_store; |
| 27 | private RDFoxTripleManager tripleManager; | 28 | protected RDFoxTripleManager tripleManager; |
| 28 | 29 | ||
| 29 | public GapByStore4ID(BasicQueryEngine engine) { | 30 | public GapByStore4ID(BasicQueryEngine engine) { |
| 30 | m_engine = engine; | 31 | m_engine = engine; |
| @@ -32,7 +33,7 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 32 | tripleManager = new RDFoxTripleManager(m_store, false); | 33 | tripleManager = new RDFoxTripleManager(m_store, false); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | long multi; | 36 | protected long multi; |
| 36 | 37 | ||
| 37 | @Override | 38 | @Override |
| 38 | public void compile(String program) throws JRDFStoreException { | 39 | public void compile(String program) throws JRDFStoreException { |
| @@ -117,7 +118,7 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 117 | return predicatesWithGap; | 118 | return predicatesWithGap; |
| 118 | } | 119 | } |
| 119 | 120 | ||
| 120 | private Integer getGapPredicateID(int originalID) { | 121 | protected Integer getGapPredicateID(int originalID) { |
| 121 | Integer gapID; | 122 | Integer gapID; |
| 122 | if ((gapID = original2gap.get(originalID)) != null) | 123 | if ((gapID = original2gap.get(originalID)) != null) |
| 123 | return gapID; | 124 | return gapID; |
| @@ -136,11 +137,14 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 136 | return gapID; | 137 | return gapID; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | private boolean isAuxPredicate(String originalPredicate) { | 140 | protected boolean isAuxPredicate(String originalPredicate) { |
| 140 | return originalPredicate.contains("_AUX"); | 141 | if (originalPredicate.equals(Namespace.EQUALITY_QUOTED)) return false; |
| 142 | return originalPredicate.contains("_AUX") || | ||
| 143 | originalPredicate.startsWith("<" + Namespace.OWL_NS) || | ||
| 144 | originalPredicate.startsWith("<" + Namespace.PAGODA_ORIGINAL); | ||
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | private boolean isRDF_TYPE() { | 147 | protected boolean isRDF_TYPE() { |
| 144 | // return tripleManager.isRdfTypeID(tuple.getTerm(1)); | 148 | // return tripleManager.isRdfTypeID(tuple.getTerm(1)); |
| 145 | return tripleManager.isRdfTypeID(tuple[1]); | 149 | return tripleManager.isRdfTypeID(tuple[1]); |
| 146 | } | 150 | } |
| @@ -150,8 +154,6 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 150 | Utility.logError("Unsupported operation!"); | 154 | Utility.logError("Unsupported operation!"); |
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | private boolean valid = false; | ||
| 154 | |||
| 155 | @Override | 157 | @Override |
| 156 | public void save(String file) { | 158 | public void save(String file) { |
| 157 | Utility.logError("Unsupported Operation..."); | 159 | Utility.logError("Unsupported Operation..."); |
| @@ -168,7 +170,6 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 168 | ++tupleCounter; | 170 | ++tupleCounter; |
| 169 | tripleManager.addTripleByID(tuple); | 171 | tripleManager.addTripleByID(tuple); |
| 170 | } | 172 | } |
| 171 | valid = true; | ||
| 172 | 173 | ||
| 173 | long tripleCounter = m_store.getTriplesCount(); | 174 | long tripleCounter = m_store.getTriplesCount(); |
| 174 | Utility.logDebug("There are " + tupleCounter + " tuples in the gap between lower and upper bound materialisation.", | 175 | Utility.logDebug("There are " + tupleCounter + " tuples in the gap between lower and upper bound materialisation.", |
| @@ -183,8 +184,6 @@ public class GapByStore4ID extends GapTupleIterator<int[]> { | |||
| 183 | } | 184 | } |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | public boolean isValid() {return valid; } | ||
| 187 | |||
| 188 | @Override | 187 | @Override |
| 189 | public void addTo(DataStore store) throws JRDFStoreException { | 188 | public void addTo(DataStore store) throws JRDFStoreException { |
| 190 | Utility.logError("Unsupported Operation..."); | 189 | Utility.logError("Unsupported Operation..."); |
