Re: relate a Collection and a PagedCollection

Hi all,

Getting there :-)

>  {
>    "@id": "/collection",
>    "@type": "Page(dCollection)",
>    "member": [ "1", "2", "..." ],
>    "nextPage": /collection?page=2",
>    "pageOf": {
>      "@id": "/collection#dataset",
>      "@type": "Collection",
>      "totalItems": 243,
>      "itemsPerPage": 10,
>      "firstPage": "/collection",
>      "lastPage": "/collection?page=24"
>    }
>  }
> 
> This has the advantage that the representations of all pages would look more
> or less the same. The downside is, that you would have to link to
> /collection#dataset instead of just /collection. So it would be
> 
>  {
>    "@id": "markus",
>    "knows": "/friend-collection#dataset"
>  }

The good thing is… people who feel that
    /collection#dataset == /collection
can just write that. Which is great.

So if you want, you can treat a collection and a page as the same thing.
If you don't want that (like me), you don't have to. Good!

> An alternative serialization could put the collection itself at the center
> (please note that I changed the resource identifiers):
> 
>  {
>    "@id": "/collection",
>    "@type": "Collection",
>    "totalItems": 243,
>    "itemsPerPage": 10,
>    "firstPage": {
>      "@id": "/collection#page",
>      "@type": "Page(dCollection)",
>      "member": [ "1", "2", "..." ],
>      "nextPage": /collection?page=2",
>      "pageOf": "/collection"
>    },
>    "lastPage": "/collection?page=24"
>  }

I like that serialization too, good to have a choice!

> The disadvantage here is that while it looks nice for the first page, it
> kind of breaks down for all other pages.

It could still be "hasPage" though.

> I also still think that hybrid is OK, but the totalItems property is indeed tricky.

The good thing is, with the above,
the user can choose whether (s)he wants hybrid or not.

>> The only consideration I would suggest is whether
>> renaming PagedCollection to Page makes sense,
>> because in your example, it looks like that's what it is
>> (as indicated by the pageOf property).
>> 
>> Page could then still be a Collection though,
>> that would be perfectly fine.
> 
> I'm a bit on the fence exactly due to that. Each page *is* a collection,
> additionally, each PagedCollection/Page is part of a logical collection.

Yes. Awesome. I'm getting really happy!

Cheers,

Ruben

Received on Friday, 25 April 2014 17:43:03 UTC