diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java b/src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java index 3207ff1..11588ce 100644 --- a/src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java +++ b/src/uk/ac/ox/cs/pagoda/reasoner/light/BasicQueryEngine.java | |||
| @@ -47,8 +47,8 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 47 | getDataStore().clearRulesAndMakeFactsExplicit(); | 47 | getDataStore().clearRulesAndMakeFactsExplicit(); |
| 48 | } catch (JRDFStoreException e) { | 48 | } catch (JRDFStoreException e) { |
| 49 | e.printStackTrace(); | 49 | e.printStackTrace(); |
| 50 | gap.clear(); | ||
| 51 | } finally { | 50 | } finally { |
| 51 | gap.clear(); | ||
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| 54 | else | 54 | else |
| @@ -149,9 +149,14 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 149 | if (instanceTuples != null) instanceTuples.dispose(); | 149 | if (instanceTuples != null) instanceTuples.dispose(); |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | } catch (JRDFStoreException e) { | ||
| 153 | e.printStackTrace(); | ||
| 154 | } finally { | ||
| 155 | if (predicateTuples != null) predicateTuples.dispose(); | ||
| 156 | predicateTuples = null; | ||
| 157 | } | ||
| 152 | 158 | ||
| 153 | predicateTuples.dispose(); | 159 | try { |
| 154 | |||
| 155 | predicateTuples = getDataStore().compileQuery("SELECT DISTINCT ?Y WHERE { ?X ?Y ?Z }", prefixes, parameters); | 160 | predicateTuples = getDataStore().compileQuery("SELECT DISTINCT ?Y WHERE { ?X ?Y ?Z }", prefixes, parameters); |
| 156 | for (long multi = predicateTuples.open(); multi != 0; multi = predicateTuples.getNext()) { | 161 | for (long multi = predicateTuples.open(); multi != 0; multi = predicateTuples.getNext()) { |
| 157 | predicate = RDFoxTripleManager.getQuotedTerm(predicateTuples.getResource(0)); | 162 | predicate = RDFoxTripleManager.getQuotedTerm(predicateTuples.getResource(0)); |
| @@ -172,6 +177,7 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 172 | e.printStackTrace(); | 177 | e.printStackTrace(); |
| 173 | } finally { | 178 | } finally { |
| 174 | if (predicateTuples != null) predicateTuples.dispose(); | 179 | if (predicateTuples != null) predicateTuples.dispose(); |
| 180 | predicateTuples = null; | ||
| 175 | } | 181 | } |
| 176 | 182 | ||
| 177 | Utility.redirectCurrentOut(filename); | 183 | Utility.redirectCurrentOut(filename); |
| @@ -184,13 +190,13 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 184 | 190 | ||
| 185 | public TupleIterator internal_evaluateAgainstIDBs(String queryText) throws JRDFStoreException { | 191 | public TupleIterator internal_evaluateAgainstIDBs(String queryText) throws JRDFStoreException { |
| 186 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters, TripleStatus.TUPLE_STATUS_IDB.union(TripleStatus.TUPLE_STATUS_EDB), TripleStatus.TUPLE_STATUS_IDB); | 192 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters, TripleStatus.TUPLE_STATUS_IDB.union(TripleStatus.TUPLE_STATUS_EDB), TripleStatus.TUPLE_STATUS_IDB); |
| 187 | iter.open(); | 193 | // iter.open(); |
| 188 | return iter; | 194 | return iter; |
| 189 | } | 195 | } |
| 190 | 196 | ||
| 191 | public TupleIterator internal_evaluate(String queryText) throws JRDFStoreException { | 197 | public TupleIterator internal_evaluate(String queryText) throws JRDFStoreException { |
| 192 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters); | 198 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters); |
| 193 | iter.open(); | 199 | // iter.open(); |
| 194 | return iter; | 200 | return iter; |
| 195 | } | 201 | } |
| 196 | 202 | ||
| @@ -201,7 +207,7 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 201 | public TupleIterator internal_evaluateNotExpanded(String queryText) throws JRDFStoreException { | 207 | public TupleIterator internal_evaluateNotExpanded(String queryText) throws JRDFStoreException { |
| 202 | parameters.m_expandEquality = false; | 208 | parameters.m_expandEquality = false; |
| 203 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters); | 209 | TupleIterator iter = store.compileQuery(queryText, prefixes, parameters); |
| 204 | iter.open(); | 210 | // iter.open(); |
| 205 | parameters.m_expandEquality = true; | 211 | parameters.m_expandEquality = true; |
| 206 | return iter; | 212 | return iter; |
| 207 | } | 213 | } |
| @@ -346,19 +352,22 @@ public class BasicQueryEngine extends RDFoxQueryEngine { | |||
| 346 | for (int[] t: collection) | 352 | for (int[] t: collection) |
| 347 | store.addTriplesByResourceIDs(t, ut); | 353 | store.addTriplesByResourceIDs(t, ut); |
| 348 | 354 | ||
| 349 | iter = internal_evaluateAgainstIDBs("select ?x ?y ?z where { ?x ?y ?z . }"); | 355 | try { |
| 350 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) { | 356 | iter = internal_evaluateAgainstIDBs("select ?x ?y ?z where { ?x ?y ?z . }"); |
| 351 | int[] triple = new int[3]; | 357 | for (long multi = iter.open(); multi != 0; multi = iter.getNext()) { |
| 352 | for (int i = 0; i < 3; ++i) | 358 | int[] triple = new int[3]; |
| 353 | triple[i] = iter.getResourceID(i); | 359 | for (int i = 0; i < 3; ++i) |
| 354 | store.addTriplesByResourceIDs(triple, ut); | 360 | triple[i] = iter.getResourceID(i); |
| 361 | store.addTriplesByResourceIDs(triple, ut); | ||
| 362 | } | ||
| 363 | } finally { | ||
| 364 | if (iter != null) iter.dispose(); | ||
| 365 | iter = null; | ||
| 355 | } | 366 | } |
| 356 | store.applyReasoning(true); | 367 | store.applyReasoning(true); |
| 357 | } catch (JRDFStoreException e) { | 368 | } catch (JRDFStoreException e) { |
| 358 | e.printStackTrace(); | 369 | e.printStackTrace(); |
| 359 | } finally { | 370 | } |
| 360 | if (iter != null) iter.dispose(); | ||
| 361 | } | ||
| 362 | Utility.logInfo("Time for deletion: " + timer.duration()); | 371 | Utility.logInfo("Time for deletion: " + timer.duration()); |
| 363 | } | 372 | } |
| 364 | 373 | ||
