Hi,
In the current implementation, then results will be in the same order.
Well, as far as I know. I can't think of anything that will disturb it.
I think you realise the responsibility is yours; it is not guaranteed
for all time.
Results are normally streaming and always truncate-able. What might
work for you is display the top page from the iterator but keep the
iterator around to read more (depends on the usage - hard to do in a
webapp where it is separate HTTP requests). It's better if you can
close the result set explicitly if truncating the results.
By the way "ORDER-BY/LIMIT N" is optimized to avoid a n log n sort. It
is still a traversal of the result set and isn't streaming.
Andy
On 21/11/15 00:52, François-Paul Servant wrote:
Hi,
I’m using TDB. No update.
and something like:
ResultSet getResultSet(String queryString) {
Query query = QueryFactory.create(queryString) ;
QueryExecution qexec = QueryExecutionFactory.create(query, model))
return qexec.execSelect() ;
}
Is there a way to be guaranteed that, if I call getResultSet twice with the
same string, the iterator over the results returns them in the same order?
I don’t want to use ORDER BY in the query because it implies to go through all
the results, and it is therefore slow if there are many results.
Andy, you wrote once here:
http://mail-archives.apache.org/mod_mbox/jena-users/201310.mbox/%[email protected]%3E
something that make me hopes that the order is generally stable, but I could be
misunderstanding what you said:
You then… have stabilized the results
against updates or against execution to give a different order (*rather
unlikely in Jena
did you mean that it is unlikely in Jena that the results be returned in a
different order when the query string is the same? If the order were stable 99%
of the times, I would happily avoid to go through all the results and sort
them: very often, people only look at the first page of results. If the query
returns 1000 solutions, it is really a waste of time to list them all.
TIA
fps