Pagination in SPARQL OFFSET and LIMIT needs ORDER BY

Dear workgroup,

I was recently made aware that there is no easy way to get a guaranteed working pagination.
 
i.e. QUERY OFFSET 0 LIMIT 5 page 1
      QUERY OFFSET 5 LIMIT 5 page 2
      QUERY OFFSET 10 LIMIT 5 page 3

Without adding an ORDER BY clause. Adding any kind of ORDER BY clause would be enough to ensure pagination worked. I would therefore like to see an  ORDER BY * or ORDER BY ANY option. To ensure that the results come in some implementation specific order and that this can be used to show all possible results.

Trying a few public current SPARQL implementations. With ORDER BY * showed that this is currently not implemented. Although pagination with OFFSET and LIMIT without an ORDER BY clause  seems to work as a naive user (e.g. me) would expect. Meaning that for current SPARQL implementers it is no work at all other than dealing with a slightly different SPARQL grammar.

Pagination guaranteed to succeed would then be 

i.e. QUERY OFFSET 0 LIMIT 5 ORDER BY ANY page 1
      QUERY OFFSET 5 LIMIT 5 ORDER BY ANY page 2
      QUERY OFFSET 10 LIMIT 5 ORDER BY ANY page 3

The other option is to expand the description of the OFFSET clause. For example the use of the OFFSET clause should guarantee that query results come back in a consistent order.

I hope this concern makes sense.

Regards,
Jerven

Received on Thursday, 12 May 2011 14:33:32 UTC