JSON-LD is a set of W3C standards track specifications for representing Linked Data in JSON. It is fully compatible with the RDF data model, but allows developers to work with data entirely within JSON.
More information on JSON-LD can be found at http://json-ld.org/
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 }
15. • 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
16. • 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": "Mom's 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"]
}]
}
24. • 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-syntax
27. Schema.org
Using RDFa to JSON-LD bookmarklet*
http://linter.structured-data.org/examples/
schema.org/sdo_eg_rdfa_12.html
* bookmarklet courtesy of Niklas Lindström
28. Schema.org
{
"@context": {...},
Using RDFa to JSON-LD bookmarklet* "@graph": [{
"@id": "http://linter.structured-data.org/examples/schema.org/Recipe.rdfa",
"rdfa:usesVocabulary": "http://schema.org/"
}, {
"@type": ["Recipe"],
"name": ["Mom's World Famous Banana Bread"],
"author": ["John Smith"],
"publishDate": ["2009-05-08"],
"image": [{"@id": ".../bananabread.jpg"}],
http://linter.structured-data.org/examples/ "description": ["This classic banana bread recipe ..."],
schema.org/sdo_eg_rdfa_12.html "prepTime": ["PT15M"],
"cookTime": ["PT1H"],
"recipeYield": ["1 loaf"],
"nutrition": [{
"@type": ["NutritionInformation"],
"calories": ["240 calories"],
"fatContent": ["9 grams fat"]
}],
"ingredients": [
"3 or 4 ripe bananas, smashed",
"1 egg",
"3/4 cup of sugar"
],
"recipeInstructions": ["Preheat the oven to 350 degrees..."],
"interactionCount": ["UserComments:140"]
}]
* bookmarklet courtesy of Niklas Lindström
}
49. 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/toRDF
50. More Information
json-ld.org JavaScript
Ruby
w3c Python
PHP
Java
Gregg Kellogg C++
gregg@greggkellogg.net
http://greggkellogg.net/
http://www.slideshare.net/gkellogg1/json-for-linked-data
@gkellogg
Notes de l'éditeur
\n
\n
JSON is widely used for RESTful APIs, but there is no standard convention on representation, or the meaning of properties and values.\n
JSON is widely used for RESTful APIs, but there is no standard convention on representation, or the meaning of properties and values.\n
JSON is widely used for RESTful APIs, but there is no standard convention on representation, or the meaning of properties and values.\n
JSON-LD brings a standard representation for expressing entity-value relationships using a few standard keywords and a consistent organizational structure for JSON Objects.\nObjects represent entities, with keys acting as properties.\n Properties always expand to full IRIs.\nArrays express a set of values associated with a property, unordered by default.\n Order expressed in @context or as an expanded value representation.\nValues are Object, string or native, with standard XSD representations for native types.\n Expanded form allows for more datatype and language variations.\n
The @type key gives an object with one or more types, described with an IRI.\nThe @context provides a way to express IRIs as simple terms, and allows values to be typed.\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Subject reference identifies an object with @id in the same document, or references an external document (Linked Data).\n
\n
\n
\n
\n
DBPedia currently uses a slightly out-of-date representation JSON-LD. But, by changing “@id” to “@graph”, and providing a context to identify IRIs, it can be processed as JSON-LD.\n
RDFa to JSON-LD bookmarklet can turn RDFa directly into JSON-LD.\n
\n
Payswarm uses named graphs to be able to sign data. The signature in the default graph signs the content of the named graph, through a separate normalization step.\n
Expansion is a core JSON-LD algorithm, used to normalize input documents to aide in processing.\n
Compaction creates a more human-readable form, but is often used as the final step in framing.\n
Framing is like SPARQL for JSON-LD, allows documents to be restructured using @type and property definitions and object relationships.\n
Framing is like SPARQL for JSON-LD, allows documents to be restructured using @type and property definitions and object relationships.\n
Normal JSON can be made JSON-LD by adding an external context through an HTTP link relation.\n
JSON-LD macros can turn more ideomatic JSON into conforming JSON-LD with standardized transformation.\n
JSON-LD macros can turn more ideomatic JSON into conforming JSON-LD with standardized transformation.\n
JSON-LD macros can turn more ideomatic JSON into conforming JSON-LD with standardized transformation.\n
JSON-LD macros can turn more ideomatic JSON into conforming JSON-LD with standardized transformation.\n
\n
\n
Full transformation from and to the RDF data model as a normative part of the API.\n
Full transformation from and to the RDF data model as a normative part of the API.\n