3 ms·
It seems one immediate application is in Datomic's new REST API: Datomic gets a REST API http://news.ycombinator.com/item?id=4487467 http://news.ycombinator.c
by michaelsbradley 14y ago
It seems one immediate application is in Datomic's new REST API:
Datomic gets a REST API
http://news.ycombinator.com/item?id=4487467 http://news.ycombinator.com/item?id=4487467
I'm developing with Clojure on a daily basis at present, and it's cool to see such a slick data notation take on new life outside of my REPLs and .clj files.
Now, what would be really interesting is if edn (or an official superset of it) could be formalized with "hypermedia controls".
See: Hypermedia-Oriented Design
http://amundsen.com/articles/hypermedia-oriented-design/ http://amundsen.com/articles/hypermedia-oriented-design/
One of the shortcomings of JSON is that as a standardized hypermedia type, it doesn't offer any hypermedia controls. There are efforts to standardize JSON-derived types which do provide such controls:
HAL
http://tools.ietf.org/html/draft-kelly-json-hal-03 http://tools.ietf.org/html/draft-kelly-json-hal-03
JSON-LD
http://json-ld.org/ http://json-ld.org/
Collection+JSON
http://www.amundsen.com/media-types/collection/ http://www.amundsen.com/media-types/collection/
It would be great to see edn take on that challenge in its early days as an extra-clojure, general purpose data notation. I'm convinced that Fielding is right about REST implying HATEOAS (others argue for "practical REST"), but you can't robustly implement REST/HATEOAS APIs with a media type that outright lacks hypermedia controls.
- jacobolus 14y agoWould you mind suggesting some possible formats for this, and explaining a bit what’s necessary for “hypermedia controls”? Or is there a link somewhere that defines this more clearly? The hypermedia-oriented design link was kind of abstract.
- michaelsbradley 14y agoI'm not sure about a format just yet, but I'm fairly certain it would be a superset of edn (as opposed to imposing it on "plain old edn"). The Document Format spec for Collection+JSON is probably not a bad starting point: http://amundsen.com/media-types/collection/format/ http://amundsen.com/media-types/collection/format/ Seems like it could readily be adapted to edn syntax. But I find myself drawn to the RDF concepts underlying JSON-LD, and wonder if the C+J and LD ideas could be melded together. A solid exploration of the larger concepts involved in hypermedia controls can be found in Mike Amundsen's recent book: Building Hypermedia APIs with HTML5 and Node http://shop.oreilly.com/product/0636920020530.do http://shop.oreilly.com/product/0636920020530.do The basic idea is that, per Fielding, HATEOAS is an aspect of REST that shouldn't be ignored. Standardized media types with well-defined hypermedia controls allow clients that understand those standards to make state transitions without having to "know other rules" that aren't contained in the representations themselves. Our web browsers do this all the time when we click on links and submit forms that we find in web pages. Based on the X/HTML standard, ours browsers (hypermedia clients) know what to do with links and forms, i.e. how to initiate the appropriate state transitions (build and run GET/POST requests) based on the markup semantics. Now, if a client is driven programmatically (i.e. not by a human reasoning about the appearance and purpose of a form-button labeled "login", etc.) then you need a bit more besides links and forms. This is where attributes like "rel" (for `a` and `link`) become important. There's been a lot of work in that area, e.g. Microformats and RDFa, among others.
- icebraining 14y agoMichael can correct me if I'm wrong, but from what I read from Fielding it's essentially having links and information about the relationship between "this" and the linked resource as first-class types in the data format. A concrete example would be the <link> tag in HTML, which with the 'rel' and 'href' attributes can make explicit a relationship between that HTML page and e.g. the page of its author.
- michaelsbradley 14y agoYes, that's the basic idea.