Skip to content

Instantly share code, notes, and snippets.

@lanthaler
lanthaler / apibunny-middleware
Last active August 29, 2015 14:00
APItools middleware to convert apibunny.com responses to JSON-LD
return function(request, next_middleware)
local response = next_middleware()
if (response.headers['content-type'] == 'application/json') then
local data = json.decode(response.body)
if (data.mazes) then
data['@context'] = 'http://www.hydra-cg.com/examples/maze'
data['id'] = data.mazes[1].id
data['@type'] = 'Maze'
<script type="application/ld+json">
{
"@context": [
"http://schema.org",
{ "@language": "en-ca" }
],
"@type": "Library",
"address": {
"@id": "_:address",
"@type": "PostalAddress",
@lanthaler
lanthaler / rdfa11.jsonld
Created February 28, 2013 11:34
A JSON-LD context defining the same IRI mappings as RDFa's initial context
{
"@context": {
"grddl": "http://www.w3.org/2003/g/data-view#",
"ma": "http://www.w3.org/ns/ma-ont#",
"owl": "http://www.w3.org/2002/07/owl#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfa": "http://www.w3.org/ns/rdfa#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"rif": "http://www.w3.org/2007/rif#",
"rr": "http://www.w3.org/ns/r2rml#",
Verifying that +lanthaler is my blockchain ID. https://onename.com/lanthaler
A comparison of Collection+JSON, HAL, JSON-LD and SIREN media types.