I have a question about the execution of a qexec.execSelect() statement running a select sparql query.
I have found two functions 'close()' and 'abort()' however both of those do not cancel (and force) the query execution until the next ResultSet.hasNext() method is called. The query appears to be on the Database processing rows and hasn't returned the data back requestor.
Is there a way to programmatically force the Sparql Execution of the query to die from a second thread?
The time out in Jena Adapter for release 220.127.116.11 has been designed to be able to cancel an execution even inside a hasNext() call.
The way to use it is through the timeout= setting in the SPARQL query.
Please search for Test10.java in the following document.
We have a timeout in place, however we don't want to query to run all the way to the timeout length if our client has already canceled their request.
That being said, in a second thread, is there a way to kill the execution of the sparql query. For a Statement i can call Statment.cancel(). I was hoping that QueryExecution.abort() or QueryExection.close() would work, i also tried to close the model (connection) [ModelOracleSem.close()] and nothing forced the process on the database to die.
I also tried to load up the OracleQueryMgtServlet in my web.xml, however when I made the call to the URL with ?abortqid=<qid> it did nothing to the execution of the corresponding query. I found that's in the Joseki packaged with the Oracle Jena Adapater.
?abortqid should work as long as your query is still being executed. Behind
the scenes, we invoke cancel on the JDBC statement object. The abort will
have no effect if you have already started fetching answers. For your application, does it take
a long time to complete fetching all answers?
If I understand your situation correctly, the following are true:
- Timeout works as expected
- Your client wants to cancel the query before timeout
Then can you shorten the timeout? Or maybe you can use add something like "limit 5 offset 10"
to your queries?
The best thing you can do is to note down the elapsed time between issuing the query execution and completing the first hasNext(),
and the elapsed time between the first hasNext() and iterating through all the answers.