RE: relate a Collection and a PagedCollection

On Friday, April 25, 2014 6:34 PM, Ruben Verborgh wrote:
> > To illustrate, we might return something like the following:
> >
> > </collection> a hydra:PagedCollection;
> >  hydra:member <1>, <2>, ...;
> >  hydra:nextPage </collection?page=2>;
> >  hydra:pageOf </collection#dataset> .
> > <collection#dataset> a hydra:Collection;
> >  hydra:totalItems 243;
> >  hydra:itemsPerPage 10;
> >  hydra:firstPage </collection>;
> >  hydra:lastPage </collection?page=24> .
> >
> > I think this is pretty close to what you originally proposed. This does
allow for a certain
> amount of semantic purity, but practically doesn't do more for me than
just collapsing the
> dataset properties down to the PagedCollection (or CollectionPage, if you
prefer).

Yeah. I agree. Let me convert this to JSON-LD because I think that will be
easier for a lot of people on this list to understand and evaluate. Here's
Gregg's Turtle converted 1:1, the first page is the "central" resource:

  {
    "@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"
  }
  
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"
  }

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


> >> So what would a PageCollection be to you?
> >> A Page, a Collection, both, or a hybrid?
> >
> > I think a Hybrid is okay, but I could go with having a
Collection/CollectionPage as I
> illustrated above.

I also still think that hybrid is OK, but the totalItems property is indeed
tricky. I see how it could be misinterpreted as the number of items of that
page. Would it help we would rename the totalItems property to make it more
explicit that it is *always* about the total items of the set of
interconnected PagedCollections/CollectionPages?


> 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.


--
Markus Lanthaler
@markuslanthaler

Received on Friday, 25 April 2014 17:29:57 UTC