- From: Ryan J. McDonough <ryan@damnhandy.com>
- Date: Thu, 26 Sep 2013 12:21:23 -0400
- To: Linked JSON <public-linked-json@w3.org>
In looking at a number lot of JSON-based hypermedia formats such as HAL [1], Collection+JSON [2], and JSON Schema [3], it seems there's a greater focus on describing link relationships and not as much effort on describing the data. There is a lot of activity and usage around these formats. It also seemed that all of these formats could be expressed through JSON-LD as well. I tried to take a stab some at a context that borrows some ideas from all three formats for a URI Template validation service I'm working on. I started with JSON Schema, but now looking at JSON-LD more and more. My first pass at a "Linking" context is here: http://mashinator.io/2013/Linking And here's a rough example: { "@context": "http://mashinator.io/2013/Linking", "@id": "http://uri-templates.herokuapp.com/uriTemplate", "links": [ { "href": "http://uri-templates.herokuapp.com/schema/uriTemplateStructure", "rel": "describedBy", "method": "GET", "type": "application/schema+json" }, { "template": "http://uri-templates.herokuapp.com/uri-template{?template}", "method": "GET", "rel": "self", "enctype": "application/www-form-urlencoded", "type": "application/json" } ], "error": { "title": "An error happened", "code": "1234", "message": "it was kinda bad. " } } It's wicked half baked at the moment and probably has other issues I haven't thought of yet. A few things came to mind while hacking this together: * In JSON-LD, the @id should be a dereferencable IRI. In that case, would one need a property like "href" on a Link, when you could just use @id? I think probably not, but I'm not entirely sure. * HAL uses the "_embedded" property and Collection+JSON uses terms like "collection" and "items". Obviously both of these values can be modeled in JSON-LD, but it seems more efficient to use some type of @container * When I look at HAL through RDF glasses, I see two named graphs: once containing the data and the other containing the control information. I'm planning on taking these further as I think there's been a lot of great ideas presented in all three of these formats, but I'd like to see them all play nicely within JSON-LD. I'd appreciate any feedback on this as I'm still new to JSON-LD, but have a good deal of time with RDF. Ryan- http://damnhandy.com [1] http://stateless.co/hal_specification.html [2] http://amundsen.com/media-types/collection/format/ [3] http://json-schema.org
Received on Thursday, 26 September 2013 16:21:52 UTC