Re: Filters as views (ISSUE-45)

Hi Hydranians, Markus

I had a chance to review your examples and more and more I'm into dropping 
separate paging approach in favour of a more general solution.

>I'm thinking about a more general term instead of PartialCollectionView on 
>the grounds that views don't necessarily apply only to collections.
I fully support Tomasz' statement. We had these arguments with Ruben and by 
seeing an example of how a mix of these two (three?) "views" looks like 
makes the unified approach more solid.

Logically, the collection has many views which can overlap. Ultimately, 
union of all views builds a collection. In the examples my feeling is that 
paging and filtered views are disjoined, which obviously is untrue. 
Something in form of the one below seems more elegant and natural:

GET /markus/friends?first=Ruben
{
  "@id": "/markus/friends",
  "@type": "Collection",
  "totalItems": 578
  "member": [...],
  "view": [{
      "@id": "/markus/friends?first=Ruben&page=1",
      "totalItems": 10,
      "first": "/markus/friends?first=Ruben&page=1",
      "next": "/markus/friends?first=Ruben&page=2",
      "last": "/markus/friends?first=Ruben&page=2"
      "template": "/markus/friends{?first,last,page}",
      "mapping": [
        { "variable": "first", "property": "schema:givenName" },
        { "variable": "last", "property": "schema:familyName" },
        { "variable": "page", "property": "hydra:page" }
      ],
      "filterSpecification": {
        "operator": "AND",
        "operands": [
          { "variable": "first" },
          { "variable": "last" }
        ]
      }}}

I dropped typing on purpose. I also dropped the "totalItems": 15 collection 
as I'm not quite sure how should I "acknowledge" it.

Best

Karol 

Received on Monday, 8 February 2016 19:21:46 UTC