You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jérôme <je...@unicaen.fr> on 2011/10/05 16:25:47 UTC
ResultSet iterations duration
Hi all,
I am currently working with Jena and Fuseki. My web application queries
the remote fuseki server with a
"QueryExecutionFactory.sparqlService(url, query)" call.
The server answers quickly, but the resultSet iteration is really slow.
QueryExecution qExec =
QueryExecutionFactory.sparqlService(url, query);
ResultSet set = qExec.execSelect();
log.info("start");
while (set.hasNext()) {
set.next();
}
log.info("done");
between 2 and 6 seconds from "start" to "done".
1-Why is it so long? How can i boost it?
2-Is there a way to know the number of solutions without iterate over
the resultSet?
Thanks.
Jérôme.
Re: ResultSet iterations duration
Posted by Andy Seaborne <an...@apache.org>.
On 05/10/11 15:25, Jérôme wrote:
> Hi all,
>
> I am currently working with Jena and Fuseki. My web application queries
> the remote fuseki server with a
> "QueryExecutionFactory.sparqlService(url, query)" call.
>
> The server answers quickly, but the resultSet iteration is really slow.
>
>
> QueryExecution qExec = QueryExecutionFactory.sparqlService(url, query);
> ResultSet set = qExec.execSelect();
This sets things up and connects to the server - it does not recieve all
the results.
> log.info("start");
> while (set.hasNext()) {
This receives a result.
Underlying network buffers bytes.
> set.next();
> }
> log.info("done");
>
> between 2 and 6 seconds from "start" to "done".
>
> 1-Why is it so long? How can i boost it?
I guess the query is expensive in some way - what is the query? how much
data?
> 2-Is there a way to know the number of solutions without iterate over
> the resultSet?
ARQ is a streaming results system unless you want to do something
different. Counting needs to walk over the results (especially in the
case of a remote execution).
Force the results to be collected with ResultSetFactory.makeRewindable
and you can count them or print them, and reset the result set.
Andy
>
> Thanks.
>
> Jérôme.
>