On 14/05/14 08:38, Md Mizanur Rahoman wrote:
Dear Experts,

I am using JAVA JENA 264.

2.6.4?

I need to set execution time out in a particular
SELECT query
(which is coming from some iterative queries). That is, for example, if a
particular SELECT query execution time is more than 5 Mins, I will go for
another query. Code snippet could be as below:

-----------------------
String query = ".... ";
Query sparql1 = QueryFactory.create(query, Syntax.syntaxSPARQL_11);
VirtuosoQueryExecution vqe1 = VirtuosoQueryExecutionFactory.create(sparql1,
dataset);
ResultSet results1 = vqe1.execSelect();

----------------------

I researched that there might be a method in VirtuosoQueryExecution
possibly named
"settimeout". However, with Jena 264, I not finding such method. Can you
please guide me.

That's rather an old version. It was released December 2010, before jena moved to Apache.

Jena/ARQ didn't have any setTimeout methods on the interfaces back then.
Even if it did, all it would be doing is passing the calls to the execution implementation (Virtuoso) so your question is really about Virtuoso.

ARQ can't add the capability to have different first/last timeouts if the underlying engine doesn't provide them, or provides something different.

        Andy


By the way,

I tried work-around by setting up connection time for dataset, such as

---------------------

VirtGraph dataset = new VirtGraph (url, "dba", "dba");
             try {
             dataset.getConnection().createStatement().execute("set
result_timeout = 300000");
             }
             catch(SQLException e) {
                 e.printStackTrace();
             }
-------------------------

However, it does not suffice my requirement because, if I do so, in some
cases, my query gets executed but I have not finish catching result from
the ResultSet. So, I need, if execution is finished (i.e.,
vqe1.execSelect(); successfully finished within 5 Mins), I want to catch my
result. But with this work-around, I can not catch my ResultSet.



-
Regards
Mizanur
NII, Japan


Reply via email to