JSON-LD and the Strands of the Semantic Web

DZone 's Guide to

JSON-LD and the Strands of the Semantic Web

JSON-LD is an answer to the question of how to create a publishing method for data that machines may use to interpret and relate it among different websites.

· Web Dev Zone ·
Free Resource

This article is part of a series on the Semantic Web. Part One covers the basic notion of a semantic web, and by extension, its architecture. Here, I look at one of the core technologies that can be used to cleanly implement semantic relationships among datums on the web.

JSON and LD Defined

JSON is JavaScript Object Notation (said "Jason," like the name) while "LD" stands for "Linked Data." The principles behind JSON  (and its LD offspring), are simplicity and interchangeability.

JSON is used in the back-end to store and express a variety of data in a property:value format. JSON is likely the counterpart to what a user interprets on the front-end, e.g., "Allen." JSON's simple rendering of the same information would run: 

Property Value
name Allen

Notice the relative parsimony of plain English in comparison to JSON: in the former, simply the word and its case is enough to tell us that it's a proper noun and most likely a personal name. The simple string "Allen" cannot be interpreted or related natively by computers, which don't have a conceptual map or mechanism to traverse one that would contextualize those concepts.

For machines to accomplish some of the same processing that humans do easily, developers have spent a great amount of effort to unpack and re-package exactly that data. 

JSON-LD takes this context as its problem space and creates a method of publishing data to machines such that knowledge of its contents and relationships are first-class aspects of the specification.

LD makes it possible not just to record and modify data objects between the browser and server, but to also meaningfully link that data to data on other websites in a standard way.

The desire for better Web APIs motivated the creation of JSON-LD.
Manu Sporny, principal creator

The Graph Concept and Inter-site Traversal

Image titleWhen JSON is used in its simplest form, it creates an arrangement that can be rendered into a table. Moving the context beyond a singular browser-server conduit and into JSON-LD creates a graph, Figure 1, right →

The graph at right represents information about a social context, like facebook's OpenGraph protocol would produce.

Such a graph is made of nodes, properties, and edges: a node is an entity which has particular qualities called properties; nodes or properties are related to one another via edges.

In JSON-LD, the elements of the graph can be located in different locales; the edges can traverse different websites in order to constitute the graph. JSON-LD has distinctive features (↗) which help direct a processor toward the information it needs to create the proper graph:

1. Explicitly declared contexts to disambiguate interpretation, 

"@context": "http://dzone.com/eg/quovadis.jsonld",

In JSON-LD, contexts work the same way they do in the anecdotal sense: neither you nor I utter an unambiguous and lengthy identifier when invoking a known entity. Instead, we use short identifiers when within a specific "context." JSON-LD's use of contexts is the same; working within a set context means that programmers can use an arbitrary term so long as the context is a retrievable and explicit Linked Data document that describes that resource.

2. Globally unique identifiers, called Internationalized Resource Identifiers(IRI)

"@id": "http://dzone.com/cuibono",

JSON-LD's data model has capitalized on the already-popular JSON format to bring some order to how web data is organized and connected, and introduce a parsimonious but clean and complete way to incorporate RDF with a small footprint. More importantly, JSON-LD is an ideal format for programmers because of its light-weight and cross-platform availability:








Image credithttps://commons.wikimedia.org/wiki/File:GraphDatabase_PropertyGraph.png
semantic web

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}