- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Thu, 22 Aug 2013 23:05:26 +0200
- To: <public-hydra@w3.org>
I forgot to mention another way to achieve almost the same as Schema.org's action proposal with Hydra, see below On Friday, August 16, 2013 4:25 PM, Markus Lanthaler wrote: > For example, look at how GMail describes a RSVP > action > [7]: > > { > "@context": "http://schema.org", > "@type": "Event", > "name": "John's Birthday Party", > ... information about the event ... > "action": { > "@type": "RsvpAction", > "actionHandler": { > "@type": "HttpActionHandler", > "url": "https://events-organizer.com/rsvp?eventId=123", > "method": "POST", > "requiredProperty": "rsvpStatus", > } > } > } > > In Hydra, at the moment you would have to do something like > > { > "@context": ... for Hydra and schema.org ..., > "@type": "Event", > "name": "John's Birthday Party", > ... information about the event ... > "rsvp": { > "@id": "https://events-organizer.com/rsvp?eventId=123" > "operations": { > "@type": "RsvpAction", > "method": "POST", > "expects": { > "supportedProperties": { > "property": "rsvpStatus", > "required": true > } > } > } > } > } Another way to serialize that is to use a reverse property (@reverse in JSON-LD) for "operations". This basically allows you to swap the positions of the outer object and the inner object (the RsvpAction). So you would end up with the following markup (I also replaced the "rsvp" property with "action"): { "@context": { ... "targetUrl": { "@reverse": "operations", "@type": "@id" } }, "@type": "Event", "action": { "@type": "RsvpAction", "targetUrl": "https://events-organizer.com/rsvp?eventId=123", "method": "POST", "expects": { "supportedProperties": { "property": "rsvpStatus", "required": true } } } } Which then, from a serialization point of view, really almost the same (modulo the ActionHandler concept). -- Markus Lanthaler @markuslanthaler
Received on Thursday, 22 August 2013 21:05:59 UTC