dydra / support

4 stars 1 forks source link

Add pagination (limit/offset) support on stored views #24

Closed jaw111 closed 8 years ago

jaw111 commented 9 years ago

Would be great to be able to set the offset and limit for a query by adding these to the query part of the view URI e.g. http://dydra.com/jhacker/foaf/all.srj?limit=5&offset=5.

In the HTML view you could also add buttons to paginate to next/previous/first page and drop-down to select number of results per page.

tpluscode commented 8 years ago

I would go even farther as to allow parametrizing views with query parameters. Such that possibilities would not be limited to limit/offset :wink:

http://dydra.com/jhacker/foaf/all.srj?limit=5&offset=5&prop=dcterms:title

select * 
where
{
   ?thing @prop ?title .
}
limit @limit
offset @offset
lisp commented 8 years ago

dydra's sparql http api implements the sparql 1.1 protocol. in order to support views and facilitate cached query implementations, it adopts elements from the HTTP communication protocol for Sesame 2 to permit variable bindings. n order to facilitate programmatic and federated access to stored views, the api also extends the sparql standard further, with support for values clauses as request arguments.

these mechanism all involve introducing variable bindings into the dynamic query evaluation context. arbitrary interpolated language elements, on the other hand are not supported, as we do not perform text interpolation, but rather establish syntax-constrained variable bindings.

that means that limit and offset cannot be specified as if they were arbitrary query parameters. they are supported, but are treated as special constraints on the data-flow in the query processor and override any slice specified by the query text itself.

jaw111 commented 8 years ago

they are supported, but are treated as special constraints on the data-flow in the query processor and override any slice specified by the query text itself.

is there any documentation/examples about how to make such a request?