You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "Khandeshi, Ami D" <Am...@pfizer.com> on 2011/03/18 20:19:37 UTC
jena and StmtIterator is time consuming operation
Hi all,
I noticed that iterating thru stmtiterator (thru hasNext) seems take
long time. Can you suggest better/more efficient way to get information
in a stattments?
Here is a code base where execution query is fast, iterating thru result
is time consuming.
Thanks,
Ami
ResultSet results = qexec.execSelect();
System.out.println("got result");
List<Entity> entities = new ArrayList();
long time=System.currentTimeMillis();
System.out.println("Start Iteator");
for ( ; results.hasNext() ; ) {
System.out.println("In
iterator"+(time-System.currentTimeMillis()));
Re: jena and StmtIterator is time consuming operation
Posted by Andy Seaborne <an...@epimorphics.com>.
What kind of dataset are you querying?
Often, much of th work is done on first call of .hasNext and .execSelect
is just setup. You can do:
ResultSet results = qexec.execSelect();
qexec.hasNext() ;
as hasNext() is (as is correct for iterators) idempotent between calls
of .next.
Results aren't a StmtIterator,
Andy
On 18/03/11 19:19, Khandeshi, Ami D wrote:
> Hi all,
>
>
>
> I noticed that iterating thru stmtiterator (thru hasNext) seems take
> long time. Can you suggest better/more efficient way to get information
> in a stattments?
>
>
>
> Here is a code base where execution query is fast, iterating thru result
> is time consuming.
>
>
>
> Thanks,
>
>
>
> Ami
>
> ResultSet results = qexec.execSelect();
>
> System.out.println("got result");
>
> List<Entity> entities = new ArrayList();
>
> long time=System.currentTimeMillis();
>
> System.out.println("Start Iteator");
>
> for ( ; results.hasNext() ; ) {
>
>
>
> System.out.println("In
> iterator"+(time-System.currentTimeMillis()));
>
>