W3C home > Mailing lists > Public > public-hydra@w3.org > July 2014

Express "go to specific page" for a collection

From: Philipp Zins <pipo@senaeh.de>
Date: Mon, 7 Jul 2014 14:07:30 +0200
Message-ID: <CACkJGAsnL42sOVNHM9bGO5+T4-sPMPzX4AGLy8gCn7htvcQ8og@mail.gmail.com>
To: public-hydra@w3.org
Hi everyone,

I'm evaluating some specifications for a real world Hypermedia API and
really like JSON-LD with Hydra so far. Anyway I'll probably encounter some
problems here and there as it seems Hydra is still relatively unknown as it
seems (?). So... without further ado here is my first usage question:

"Example 14" in the docs shows a more complex example for a collection. It
looks like this:

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


I wonder how one would express a "go to specific page" relation? Would this
be appropriate?

{
  "@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",
  "goToPage:" {

  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
  "@type": "IriTemplate",
  "template": "/an-issue/comments{?page}",
  "mapping": [
    {
      "@type": "IriTemplateMapping",
      "variable": "page",
      "property": "hydra:freetextQuery",  // Can in express something
like "integerQuery" here?
      "required": true
    }
  ]
}

"member": [ ... the members of this PagedCollection ... ] }


Thank you,
Pipo
Received on Monday, 7 July 2014 12:07:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:42 UTC