RE: relate a Collection and a PagedCollection

On Friday, April 18, 2014 8:39 AM, Ruben Verborgh wrote:
> > The reason why it is called PagedCollection and not CollectionPage is
that I
> > see a PagedCollection as the sum of all the pages it consists of.
> 
> That would be cool indeed, but this is contradicted by the example:
> 
> {
>   "@context": "http://www.w3.org/ns/hydra/context.jsonld",
>   "@id": "http://api.example.com/an-issue/comments?page=3",
>   "@type": "PagedCollection",
>   "totalItems": "4980",
>   "itemsPerPage": "10",
>   "firstPage": "/an-issue/comments?page=1",
>   "nextPage": "/an-issue/comments?page=4",
>   "previousPage": "/an-issue/comments?page=2",
>   "lastPage": "/an-issue/comments?page=498",
>   "member": [
>     ... the members of this PagedCollection ...
>   ]
> }
> 
> Note how "?page=3" is called a PagedCollection (but is a single page)
> or how "?page=4" is the "next page" of the PagedCollection (only pages
have a next page).
> or how "?page=1" is the "firstPage" of "?page=3".

Yeah, I know. A PagedCollection is more like an "abstract" concept. The
"problem" with renaming it to CollectionPage is that then we would indeed
have to relate each page to a Collection to be able to express things like
totalItems, firstPage, and lastPage. Especially the separation of
firstPage/lastPage from nextPage/previousPage is something I do not like.


> > Well... this certainly looks tidy but do you really need an "entry
point"
> > which just links to the first and last page but doesn't give you any
> > members?
> 
> No, not an entry point, but it should be possible to refer to the
collection as a whole.
> So think identifier (URI), not URL per se.

This is closely related to rdf:List. Also there you just refer to the first
node (of type rdf:List) which then points to the next node (which, again, is
of type rdf:List). So I would say if you want to refer to the collection,
just point to its first page (actually it doesn't really matter to which
page you link as long as the client is able to find all pages).

Since we are consistent with how both rdf:List Paged Atom Feeds work
(RFC5005) I'm leaning towards keeping PagedCollections as they are. Do you
strongly disagree or could you live with that? We can certainly add a
paragraph to the spec summarizing this discussion.


--
Markus Lanthaler
@markuslanthaler

Received on Wednesday, 23 April 2014 14:44:42 UTC