1.
JSON-LD Linked Data for Web Apps Gregg Kellogg gregg@greggkellogg.net @gkelloggTuesday, July 10, 12
2.
Introducing JSON-LD @graph @context @id JSON-based syntax to express linked data @language @value @list @type @setTuesday, July 10, 12JSON-LD brings a standard representation for expressing entity-value relationships using afew standard keywords and a consistent organizational structure for JSON Objects.•Objects represent entities, with keys acting as properties. •Properties always expand to full IRIs.•Arrays express a set of values associated with a property, unordered by default. •Order expressed in @context or as an expanded value representation.•Values are Object, string or native, with standard XSD representations for native types. •Expanded form allows for more datatype and language variations.
3.
Self-describing Messages • Give objects types { "@context": { (@type) "schema": "http://schema.org/", "Person": "schema:Person", "knows": {"@id": "schema:knows", "@type": "@id"}, "name": "schema:name", "image": {"@id": "schema:image", "@type": "@id"}, "url": {"@id": "schema:url", "@type": "@id"} } } { "@context": "http://example.com/context.jsonld", "@type": "Person", "image": "http://localhost:9393/examples/schema.org/janedoe.jpg", "knows": [ "http://www.xyz.edu/students/alicejones.html", "http://www.xyz.edu/students/bobsmith.html" ], "name": "Jane Doe", "url": "http://www.janedoe.com" }Tuesday, July 10, 12The @type key gives an object with one or more types, described with an IRI.The @context provides a way to express IRIs as simple terms, and allows values to be typed.
8.
History • 2010 – Started as a way to project from the RDFa API • Developers want solutions to work within HTML applications • Desire for JSON-idiomatic way of representing RDF (Linked Data) • Adapt existing JSON APIs to Linked DataTuesday, July 10, 12
9.
History • 2011 – W3C Community Group launched • Broad Participation • Separation of Syntax from API • Proposed to W3C RDF 1.1 Working GroupTuesday, July 10, 12
10.
History • 2012 – RDF WG abandons other JSON serialization efforts (RDF/JSON) • JSON-LD accepted as official work item • Community Group drafts final report • RDF WG to publish JSON-LD (Syntax and API) as FPWDTuesday, July 10, 12
12.
• Make full use of JSON syntactic { "@context": "http://json-ld.org/contexts/person", representations "@id": "http://greggkellogg.net/foaf#me", "@type": "Person", • Object defines a subject "name": "Gregg Kellogg", "knows": "http://www.markus-lanthaler.com/" definition }Tuesday, July 10, 12
13.
• Make full use of JSON syntactic { "@context": "http://json-ld.org/contexts/person", representations "@id": "http://greggkellogg.net/foaf#me", "@type": "Person", • Object defines a subject "name": "Gregg Kellogg", "knows": "http://www.markus-lanthaler.com/" definition } • Also used for subject reference and value { "@id": "http://greggkellogg.net/foaf#me" } representationsTuesday, July 10, 12
14.
• Make full use of JSON syntactic { "@context": "http://json-ld.org/contexts/person", representations "@id": "http://greggkellogg.net/foaf#me", "@type": "Person", • Object defines a subject "name": "Gregg Kellogg", "knows": "http://www.markus-lanthaler.com/" definition } • Also used for subject reference and value { "@id": "http://greggkellogg.net/foaf#me" } representations { "@type": "Recipe", "name": "Moms World Famous Banana Bread", "ingredients": [ • Arrays describe sets of unordered values "3 or 4 ripe bananas, smashed", "1 egg", "3/4 cup of sugar" ], • Single values can skip array "nutrition": [{ "@type": ["NutritionInformation"], "calories": ["240 calories"], "fatContent": ["9 grams fat"] }] }Tuesday, July 10, 12
22.
• More features defined in the syntax specification*: • @set, @list, Compact IRIs, Unlabeled Nodes • Embedded @context definitions • Named Graphs * http://json-ld.org/spec/latest/json-ld-syntaxTuesday, July 10, 12
23.
Retrofit existing APIs GET /foaf.json HTTP/1.1 Host: greggkellogg.net Accept: application/json,*/*;q=0.1 ==================================== HTTP/1.0 200 OK ... Content-Type: application/json Link: <http://json-ld.org/contexts/person>; rel="describedby"; type="application/ld+json" { "name": "Gregg Kellogg", "homepage": "http://greggkellogg.net/", "depiction": "http://twitter.com/account/profile_image/gkellogg" }Tuesday, July 10, 12Normal JSON can be made JSON-LD by adding an external context through an HTTP linkrelation.
26.
JSON-LD API • compact – use minimal representation using a supplied @context • expand – expand to full form, removing embedded @context definitions • frame – query for JSON-LD • fromRDF/toRDFTuesday, July 10, 12
27.
More Information json-ld.org JavaScript Ruby w3c Python PHP Java Gregg Kellogg C++ gregg@greggkellogg.net http://greggkellogg.net/ @gkelloggTuesday, July 10, 12
Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.
Be the first to comment