RE: Pagination (ISSUE-42)

On 16 Feb 2015 at 10:47, Dietrich Schulten wrote:
> I want to re-phrase my proposal because my previous attempt appears to
> cause misunderstandings.
> 
> This is not only a reply to Andrew, I'd like to ask everybody to
> consider my proposal.

Thanks for bringing this discussion back to the topic and making a concrete proposal.


 
> My proposal is:
> 
> 1. Use hydra:Collection not as a container but as a descriptor, i.e.
> keep the actual items outside of the hydra:Collection object and make
> them direct values of the property they belong to. Drop hydra:member.

So you have a collection without members?


[...]

> 5. In order to say things about the collection directly in the context
> of the collection response, we must use something else but the
> collection response body, because the body contains just items and there
> is nothing to attach additional properties to the collection.

Not sure I follow. In the body is what you put there. So why is there "nothing to attach additional properties"?


> Example responses illustrating my proposal:
> 
>> 
>>     // server embeds a collection of people Alice knows
>>     {
>>       "@id": "/alice",
>>       "foaf:name": "Alice",
>>       "foaf:knows": [
>>         {"@id":"/bob", "foaf:name": "Robert Rumbaugh"},
>>         {"@id":"/zelda", "foaf:name": "Zelda Zackney"}
>>       ],
>>       "collection": [
>>         {
>>         "@id": "/alice/friends",
>>         "@type": "Collection",
>>         "manages": {
>>           "property": "foaf:knows",
>>           "subject": "/alice"
>>         },
>>         "search" : ... an iritemplate,
>>         "operation" : ... supportedOperations on /alice/friends
>>       ]
>>     }

Apart from the missing hydra:member relationship this is exactly what we currently have.


>>     // server points to external resource with offset/limit
>>     {
>>       "@id" : "/alice"
>>       // plain link to friends:
>>       "foaf:knows" : { "@id": "/alice/friends" },
>>       // saying things about the management of /alice/friends:

So /alice/friends is intentionally a foaf:Person and a hydra:Collection at the same time? I say intentionally as you explicitly mentioned

  > 3. Let the list of items be a plain list without surrounding container
  > because such a container around the items causes problems in the RDF
  > model. ("/alice foaf:knows hydra:Collection" makes RDF tools think that
  > the hydra:Collection is a foaf:Person because foaf:knows defines that
  > its values are foaf:Person)


>>       "collection": [
>>         {
>>         "@id": "/alice/friends",
>>         "@type": "Collection",
>>         "manages": {
>>           "property": "foaf:knows",
>>           "subject": "/alice"
>>         },
>>         "partial": {
>>             "@type": "IriTemplate",
>>             "template": /alice/friends{?offset,limit}
>>             "mapping": [
>>               {
>>               "@type": "IriTemplateMapping",
>>               "variable": "offset",
>>               "property": "hydra:offset"

How is hydra:offset defined?


>>               },
>>               {
>>               "@type": "IriTemplateMapping",
>>               "variable": "limit",
>>               "property": "hydra:limit",

How is hydra:limit defined?


>>               }
>>             ]
>>         }
>>       }
>>     }
> 
>>     The target resource returned from /alice/friends is a json-ld set of
>>     foaf:Person, not a hydra:Collection.

What's the advantage of that?


>    The response has the following link header to point to the
>    next page.
>    
>    Header:
>    Link: <http://example.com/alice/friends?page=2>; rel="next"
>    Body:
>>     [
>>       {"@id":"/bob",
>>        "@type": "http://xmlns.com/foaf/0.1/Person",
>>        "http://xmlns.com/foaf/0.1/name": "Robert Rumbaugh"
>>       },
>>       {"@id":"/zelda",
>>        "@type": "http://xmlns.com/foaf/0.1/Person",
>>        "http://xmlns.com/foaf/0.1/name": "Zelda Zackney"
>>       }
>>     ]

How would a client know that /alice foaf:knows /zelda ? Should it infer that? Based on what information?



--
Markus Lanthaler
@markuslanthaler

Received on Sunday, 22 February 2015 19:43:59 UTC