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

Reply via email to