- From: Jindřich Mynarz <mynarzjindrich@gmail.com>
- Date: Mon, 7 Jul 2014 13:38:20 +0200
- To: public-hydra@w3.org
Hi Pipo, this is somewhat similar to my question to the Hydra mailing list about enabling random access to hydra:PagedCollections (see here: http://lists.w3.org/Archives/Public/public-hydra/2014Jun/0083.html). This discussion concluded with an agreement that random access to paged collections isn't a common use case, so it isn't a top priority for Hydra to provide solution for it. However, if you wanted to enable random access to hydra:PagedCollection, then I think your approach with :goToPage hydra:TemplatedLink may work find. Instead of using hydra:freetextQuery for hydra:property mapping in the hydra:IriTemplateMapping, I think you can use an anonymous property with rdfs:range defined to be xsd:positiveInteger: "property" : { "rdfs:range" : "xsd:positiveInteger" } Although I'm not sure if using anonymous properties in such case is an accepted practice in Hydra. Also note that in JSON-LD you don't need to repeat @context for nested objects, unless you want to override the parent object's @context. Best, Jindřich -- Jindřich Mynarz http://mynarz.net/#jindrich On Mon, Jul 7, 2014 at 1:18 PM, Philipp Zins <pipo@senaeh.de> wrote: > Hi everyone, > > "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 11:39:07 UTC