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

Using an IriTemplate with a class or property

From: John Walker <john.walker@semaku.com>
Date: Wed, 31 Dec 2014 17:34:13 +0100 (CET)
To: public-hydra@w3.org
Message-ID: <212895231.2773524.1420043653600.open-xchange@oxweb01.eigbox.net>
Hi All,

After having played about the past days making a JSON-LD wrapper for an existing
API, it seems that alot of what I'm doing is related to IRI templates.

Is there any way that a hydra:IriTemplate can be linked to a class or property
to allow the client to figure out what is the next request to make?

As an example here is the JSON-LD for a thing:

Which was built from this original JSON:

So for example I would define a template like this for the beer:

This would be linked to the Beer class and a client would know how to build the
URI by populating the template with the data at hand, in this case the value of
the id key.

Similarly I might define a template like this for a style:

This template can be linked to the styleId property and that the client would
know how to build the URI based on the property value.

Putting this logic in the Hydra client would help having to implement similar
logic on server side in many APIs.


John Walker
Principal Consultant & co-founder
Semaku B.V.
SFJ 4.009, Torenallee 20, 5617 BC Eindhoven
Mobile: +31 6 475 22030
Email: john.walker@semaku.com
Skype: jaw111

KvK: 58031405
BTW: NL852842156B01
IBAN: NL94 INGB 0008 3219 95
Received on Wednesday, 31 December 2014 16:34:48 UTC

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