The Semantic Web and its related technologies provide an incredibly powerful model for driving the cost of data integration down to nearly zero. So, how do we help developers who are overwhelmed, frightened or annoyed by its data models and formats?
Everyone can have semantically rich, interoperable data and modern application tools, frameworks and user interfaces. There is a surprisingly simple mechanism by which “normal” developers can benefit from the power of the Semantic Web and the latter's developers can integrate with the panoply of tools and toys under constant development by the former.
The trick is JSON-LD. A simple, but deliberately designed extension to JSON that bridges both worlds and is finding its way into many other uses by the likes of Google and GitHub. You will learn about:
the JSON-LD format
how to frame, sign and validate it
how to convert it to/from RDF
how to describe Hypermedia systems with Hydra and JSON-LD
how to embed and consume JSON-LD in HTML documents
how JSON-LD is being used in a variety of mass market ways
3. Speaker Qualifications
Specialize in next-generation technologies
Author of O'Reilly Videos on Hypermedia and Linking Data
Author of 'Resource-Oriented Architecture Patterns for Webs of Data'
Teaches and speaks internationally about REST, Semantic Web, Data Science,
Security, Visualization, Architecture
Worked in Defense, Finance, Retail, Hospitality, Video Game, Health Care,
Telecommunications and Publishing Industries
International Pop Recording Artist
·
·
·
·
·
·
3/71
15. JSON-LD Goals
100% Compatible with JSON
Zero Edits Where Possible
Bring Linked Data to Web Development
No knowledge of RDF required
Interoperable with RDF
Can be stored in JSON database engines
·
·
·
·
·
·
15/71
28. JSON-LD Features
Internationalized Resource Identifiers (IRIs) for JSON objects
Key disambiguation
Make distributed JSON object references
Support I18N
Typed literals
Ability to express directed graphs
·
·
·
·
·
·
28/71
29. Terms
Short-hand string identifier
Can be expanded to an IRI or a blank node identifier
Minimal naming restrictions
·
·
·
Don't start with '@'
Cannot be a keyword
·
·
29/71
30. Node Objects
JSON object
Zero or more properties of a node
Not part of a @context
Does not contain @value, @list or @set keywords
·
·
·
·
30/71
56. JSON-LD (Javascript)
var jsonld = require('jsonld');
var doc = {
"http://schema.org/name": "Manu Sporny",
"http://schema.org/url": {"@id": "http://manu.sporny.org/"},
"http://schema.org/image": {"@id": "http://manu.sporny.org/images/manu.pn
};
var context = {
"name": "http://schema.org/name",
"homepage": {"@id": "http://schema.org/url", "@type": "@id"},
"image": {"@id": "http://schema.org/image", "@type": "@id"}
};
// compact a document according to a particular context
jsonld.compact(doc, context, function(err, compacted) {
console.log(JSON.stringify(compacted, null, 2));
});
56/71
57. JSON-LD (Java)
// Open a valid json(-ld) input file
InputStream inputStream = new FileInputStream("input.json");
// Read the file into an Object (The type of this object will be a List, Ma
// Number or null depending on the root object in the file).
Object jsonObject = JsonUtils.fromInputStream(inputStream);
// Create a context JSON map containing prefixes and definitions
Map context = new HashMap();
// Customise context...
// Create an instance of JsonLdOptions with the standard JSON-
LD options
JsonLdOptions options = new JsonLdOptions();
// Customise options...
// Call whichever JSONLD function you want! (e.g. compact)
Object compact = JsonLdProcessor.compact(jsonObject, context, options);
// Print out the result (or don't, it's your call!)
System.out.println(JsonUtils.toPrettyString(compact));
57/71