Re: Explicit description of paging in hydra:IriTemplate to enable random access to hydra:PagedCollection

On Wed, Jun 18, 2014 at 1:45 PM, Markus Lanthaler
<markus.lanthaler@gmx.net> wrote:
>> If paging properties are
>> explicitly described, then it may allow clients to do random access of
>> the hydra:PagedCollection.
>
> In some cases, perhaps. But it quickly becomes quite complex. IMO most use cases are better addressed by filtering the collection to get to the desired data. Do you have an example where that doesn't work? "Jump to third page" doesn't count :-P

I believe this isn't a requirement in most cases. I raised this only
to find out if there isn't any recommendation about making the paging
controls explicit. I can't think of any good use case for random
access to collections. I think that if random access is necessary,
then the order of collection members might be as well materialized in
data and queried directly.


>> Or instead, the paging properties may be directly factored into
>> hydra:IriTemplateMappings. However, in this case it's not clear what
>> properties should the paging be mapped to.
>
> In fact, in most cases it is not clear IMO. Also, I would generally recommend to use something more stable offsets than page=2 as otherwise you might miss several items if the collection changes while you traverse it.

I chosen to "page" to describe the paging parameter only to have the
simplest example possible. In my work with Hydra, I typically use
"offset" and "limit" to allow paging through a collection.


>> :simple-search-person-template a hydra:IriTemplate ;
>>   hydra:template "/person{?name,page}" ;
>>   hydra:mapping [
>>       a hydra:IriTemplateMapping ; hydra:variable "name" ;
>>       hydra:property schema:name ; hydra:required true ], [ a
>>       hydra:IriTemplateMapping ; hydra:variable "page" ; hydra:require
>>       false
>>     ] .
>>
>> Is this an anti-pattern? Is there a better way how to enable random
>> access of a hydra:PagedCollection?
>
> Let's see if we find a compelling use case where random access makes sense (in this case it doesn't IMHO) and discuss it then. In this case here, there's no indication of what subset of the data would be found on page 2 for example. So why would a client want to jump directly there then?

Ok, let's wrap up this thread unless someone has a convincing case for
making paging explicit.

- Jindřich

-- 
Jindřich Mynarz
http://mynarz.net/#jindrich

Received on Wednesday, 18 June 2014 12:15:13 UTC