W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2011

Pagination in SPARQL OFFSET and LIMIT needs ORDER BY

From: Jerven Bolleman <jerven.bolleman@isb-sib.ch>
Date: Thu, 12 May 2011 16:32:55 +0200
To: public-rdf-dawg-comments@w3.org
Message-Id: <3A5FE34B-A94D-4E6F-AFAC-56B5A3038384@isb-sib.ch>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 12 May 2011 14:33:33 GMT