You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Md Mizanur Rahoman <mi...@nii.ac.jp> on 2014/05/14 09:38:20 UTC

Setting Time Out

Dear Experts,

I am using JAVA JENA 264. 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.

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

Re: Setting Time Out

Posted by Andy Seaborne <an...@apache.org>.
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
>


Re: Setting Time Out

Posted by Rob Vesse <rv...@dotnetrdf.org>.
This question appears to be specific to the Virtuoso Jena provider which
is an external component provided by OpenLink Software and not maintained
or affiliated with the Apache Jena project

You should ask your question to one of OpenLink's support channels:

- Forum - http://boards.openlinksw.com/support/
- Mailing List - virtuoso-users@lists.sf.net

Rob

On 14/05/2014 08:38, "Md Mizanur Rahoman" <mi...@nii.ac.jp> wrote:

>Dear Experts,
>
>I am using JAVA JENA 264. 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.
>
>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