A Deep Dive into JSON-LD and Hydra

5,724 views
5,602 views

Published on

Presented at the APIcon 2014 conference in San Francisco, CA, USA.

1 Comment
25 Likes
Statistics
Notes
No Downloads
Views
Total views
5,724
On SlideShare
0
From Embeds
0
Number of Embeds
1,097
Actions
Shares
0
Downloads
0
Comments
1
Likes
25
Embeds 0
No embeds

No notes for slide

A Deep Dive into JSON-LD and Hydra

  1. 1. { "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } } http://example.com/events/cake-apicon14
  2. 2. http://example.com/events/cake-apicon14 { 69 64: 63 61 6B 65 2D 61 70 69 63 6F 6E 31 34, 6E 61 6D 65: 43 41 4B 45 20 6C 69 76 65 20 69 6E 20 63 … 73 74 61 72 74 44 61 74 65: 32 30 31 34 2D 30 35 2D 32 … 65 6E 64 44 61 74 65: 32 30 31 34 2D 30 35 2D 32 38 54 … 6C 6F 63 61 74 69 6F 6E: { 6E 61 6D 65: 48 69 6C 74 6F 6E 20 53 61 6E 20 46 72 6… 61 64 64 72 65 73 73: 33 33 33 20 4F 27 46 61 72 72 6… } }
  3. 3. http://example.com/events/cake-apicon14 { "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  4. 4. http://example.com/events/cake-apicon14 { "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  5. 5. http://example.com/events/cake-apicon14 { "@context": { "name": "http://schema.org/name", "startDate": "http://schema.org/startDate", "endDate": "http://schema.org/endDate", ... }, "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  6. 6. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/" }, "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  7. 7. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/" }, "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  8. 8. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/" }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" } }
  9. 9. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/" }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": { "@id": "/bands/cake" } }
  10. 10. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/", "performer": { "@type": "@id" } }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  11. 11. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/", "performer": { "@type": "@id" }, "startDate": { "@type": "http://schema.org/DateTime" } }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  12. 12. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/", "performer": { "@type": "@id" }, "startDate": { "@type": "DateTime" } }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  13. 13. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/", "performer": { "@type": "@id" }, "startDate": { "@type": "DateTime" } }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "@type": "Place", "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  14. 14. http://example.com/events/cake-apicon14 { "@context": { "@vocab": "http://schema.org/", "performer": { "@type": "@id" }, "startDate": { "@type": "DateTime" }, "type": "@type" }, "@id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "type": "Place", "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  15. 15. http://example.com/events/cake-apicon14 { "@context": "/contexts/event.jsonld", "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "type": "Place", "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  16. 16. http://example.com/events/cake-apicon14 { "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "type": "Place", "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  17. 17. http://example.com/events/cake-apicon14 HTTP/1.1 200 OK Content-Type: application/json Link: </contexts/event.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" { "id": "cake-apicon14", "name": "CAKE live in concert at APIcon 2014", "startDate": "2014-05-28T20:00-07", "endDate": "2014-05-28T23:00-07", "location": { "type": "Place", "name": "Hilton San Francisco Union Square", "address": "333 O'Farrell St, San Francisco, CA 94102" }, "performer": "/bands/cake" }
  18. 18. <script type="application/ld+json"> ... </script>
  19. 19. http://example.com/events/ { "@id": "/events/", "@type": "Collection", "member": [ ... ], ... "operation": { "@type": "http://schema.org/AddAction", } }
  20. 20. { "@id": "Event", "@type": "Class", "supportedProperty": { "property": "name", "required": true } } http://example.com/events/ { "@id": "/events/", "@type": "Collection", "member": [ ... ], ... "operation": { "@type": "AddAction", "method": "POST", "expects": "Event" } }
  21. 21. { "@id": "Event", "@type": "Class", "supportedProperty": { "property": "name", "required": true } } http://example.com/events/california/ { "@id": "/events/california/", "@type": "Collection", "member": [ ... ], ... "operation": { "@type": "AddAction", "method": "POST", "expects": "Event" } }
  22. 22. http://example.com/events/california/ { "@id": "/events/california/", "@type": "Collection", "member": [ ... ], ... } { "@type": "AddAction", "method": "POST", "expects": "Event" }
  23. 23. { "@id": "EventCollection", "@type": "Class", "subClassOf": "Collection", "supportedOperation": { "@type": "AddAction", "method": "POST", "expects": "Event" } } http://example.com/events/california/ { "@id": "/events/california/", "@type": "EventCollection", "member": [ ... ], ... } { "@type": "AddAction", "method": "POST", "expects": "Event" }

×