Simple Linked Data Deployment Tutorial — using JSON-LD Notation

Kingsley Uyi Idehen
7 min readApr 17, 2020

--

Here is a simple tutorial that demonstrates the fact that Linked Data deployment is easier than is generally assumed.

In this variant of the tutorial I am using JSON-LD Notation rather than RDF-Turtle Notation.

Why?

I want observations that I document to be “webby”, or “web-like”, in nature; i.e., I want entity relationships that can be navigated by clicking on hyperlinks (HTTP URIs) using a follow-your-nose pattern.

Linked Data Semiotic Triangle

What?

Describe how several entities are related, leveraging the data connectivity and access prowess of Linked Data and the descriptive power of RDF sentences:

  1. a lady named “Alice”
  2. a man named “Bob”
  3. a car manufacturer named “Example Cars & Co”
  4. an unbranded red automobile (car)
Visualizing Entity Relationship Types [Live Link]

How?

To achieve my goal, I have to adhere to a few fundamental principles:

  1. Identify (name) entities using HTTP URIs so that anyone can look up their description documents — i.e., leverage the fact that HTTP URIs resolve to documents.
  2. Use RDF Language subject→predicate→object structured sentences/statements (using a variety of notations) to store entity descriptions in a document that’s also identified by an HTTP URI (more specifically in this case, a URL, since we are dealing with a document on an HTTP network).
  3. Repeat the process whenever I encounter something of interest — i.e., take notes about what I observe using simple RDF Language sentences.

Steps:

  1. Create a folder on my local drive.
  2. Create a document for each entity that I plan to describe — doc1.ttl for “Bob” [1], doc2.ttl for “Alice”[2], org.ttl for “Example Cars & Co” [3], product.ttl for the automobile [4].
  3. Add content in the form of RDF statements (triples) that represent how these entities are related to each document.
  4. Copy all of my files to an HTTP accessible folder that’s published to a public (e.g., World Wide Web) or private (e.g., Intranet) network.
  5. Done!

JSON-LD Statements (using Nanotation)

Example 1 — about Bob (friend of Alice who seeks a Car)

## Linked Data using Relative URIs Exercise 1
## JSON-LD Start ##

{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"dcterms": "http://purl.org/dc/terms/",
"gr": "http://purl.org/goodrelations/v1#",
"wdrs": "http://www.w3.org/2007/05/powder-s#"
},
"@graph": [
{
"@id": "#",
"@type": "foaf:Document",
"dcterms:description": "A collection of RDF sentences that describe a Person literally identified (or labeled) as 'Bob'",
"foaf:name": "A Document that describes a Person literally identified as 'Bob'",
"foaf:primaryTopic": {
"@id": "#bob"
}
},
{
"@id": "#bob",
"@type": "foaf:Person",
"gr:seeks": {
"@id": "#CoolRedCar"
},
"wdrs:describedby": {
"@id": "#"
},
"foaf:depiction": {
"@id": "http://www.silhouettegraphics.net/wp-content/uploads/2013/10/young-man-silhouettegraphics-.jpg"
},
"foaf:knows": {
"@id": "#alice"
},
"foaf:name": "Bob"
}
]
}

## JSON-LD End ##
OpenLink Structured Data Sniffer rendering of RDF Sentences that describe ‘Bob’

Example 2 — about Alice (friend of Bob who is employed by a Car Manufacturer)

## JSON-LD Start ##
{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"dcterms": "http://purl.org/dc/terms/",
"rel": "http://purl.org/vocab/relationship/",
"wdrs": "http://www.w3.org/2007/05/powder-s#"
},
"@graph": [
{
"@id": "#",
"@type": "foaf:Document",
"dcterms:description": "A collection of RDF sentences that describe a Person literally identified (or labeled) as 'Alice'",
"foaf:name": "A Document that describes a Person literally identified as 'Alice'",
"foaf:primaryTopic": {
"@id": "#alice"
}
},
{
"@id": "#alice",
"@type": "foaf:Person",
"rel:employedBy": {
"@id": "https://medium.com/openlink-software-blog/org.ttl#exampleCars"
},
"wdrs:describedby": {
"@id": "#"
},
"foaf:depiction": {
"@id": "http://clipart-library.com/images/kiMb8ggKT.jpg"
},
"foaf:knows": {
"@id": "#bob"
},
"foaf:name": "Alice"
}
]
}
## JSON-LD End ##
OpenLink Structured Data Sniffer rendering of RDF Sentences that describe ‘Alice’

Example 3 — about Car Maker (who manufactures Cars and employs Alice)

## JSON-LD Start ##

{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"dcterms": "http://purl.org/dc/terms/",
"gr": "http://purl.org/goodrelations/v1#",
"wdrs": "http://www.w3.org/2007/05/powder-s#"
},
"@graph": [
{
"@id": "#",
"@type": "foaf:Document",
"dcterms:description": "A collection of RDF sentences that describe an Organization literally identified (or labeled) as 'Example Cars & Co.'",
"foaf:name": "A Document that describes an Organization literally identified as 'Example Cars & Co.'",
"foaf:primaryTopic": {
"@id": "#exampleCars"
}
},
{
"@id": "#exampleCars",
"@type": [
"gr:BusinessEntity",
"foaf:Organization"
],
"wdrs:describedby": {
"@id": ""
},
"foaf:depiction": {
"@id": "https://thumb1.shutterstock.com/display_pic_with_logo/3648824/532862638/stock-vector-silhouette-automated-production-line-robotic-factory-banner-532862638.jpg"
},
"foaf:made": {
"@id": "https://medium.com/openlink-software-blog/product.ttl#CoolRedCar"
},
"foaf:name": "Example Cars & Co."
}
]
}

## JSON-LD End ##
OpenLink Structured Data Sniffer rendering of RDF Sentences that describe ‘Examples Car & Co.’ the Car Manufacturer

Example 4 — about Car (Product made by Car Maker that employs Alice)

## JSON-LD Start ##

{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"dcterms": "http://purl.org/dc/terms/",
"gr": "http://purl.org/goodrelations/v1#",
"wdrs": "http://www.w3.org/2007/05/powder-s#"
},
"@graph": [
{
"@id": "#",
"@type": "foaf:Document",
"dcterms:description": "A collection of RDF sentences that describe a Product literally identified (or labeled) as 'Gift Wrapped Cool Red Car -- Brand Unknown'",
"foaf:name": "A Document that describes a Product literally identified as 'Gift Wrapped Cool Red Car -- Brand Unknown'",
"foaf:primaryTopic": {
"@id": "#CoolRedCar"
}
},
{
"@id": "#CoolRedCar",
"@type": "gr:ProductOrService",
"wdrs:describedby": {
"@id": "#"
},
"foaf:depiction": {
"@id": "http://highroaddigital.com/wp-content/uploads/2015/01/wonanewcar.jpg"
},
"foaf:maker": {
"@id": "#exampleCars"
},
"foaf:name": "Gift Wrapped Cool Red Car -- Brand Unknown"
}
]
}
## JSON-LD End ##
OpenLink Structured Data Sniffer rendering of RDF Sentences that describe ‘Gift Wrapped — Cool Red Car’

Example 5 — an additional document functioning as an index of all the entity description documents

## JSON-LD Start ##

{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"dcterms": "http://purl.org/dc/terms/"
},
"@id": "#",
"@type": "foaf:Document",
"dcterms:description": "A collection of RDF sentences that describe a Linked Data Deployment exercise",
"foaf:depiction": {
"@id": "http://kingsley.idehen.net/DAV/home/kidehen/Public/Linked%20Data%20Documents/Tutorials/slide38_linked_data_network_v2_SPO%20_latest_relative_uris.png"
},
"foaf:name": "A Document about illustrating a simple Linked Data Deployment exercise",
"foaf:topic": [
{
"@id": "#"
},
{
"@id": "/doc1.ttl"
},
{
"@id": "/doc2.ttl"
},
{
"@id": "/product.ttl"
},
{
"@id": "/org.ttl"
}
]
}

## JSON-LD End ##
OpenLink Structured Data Sniffer rendering of RDF Sentences that describe ‘Illustration of Entity Relationships and the RDF documents from which they originate’

Additional Notes

JSON-LD and/or Nanotation

I used JSON-LD — based on its Web Programmer friendliness — as the notation for inscribing RDF statements to my documents.

By using nanotation, I am able to use this document (this Medium post) as a 5-Star Linked Data Source and Knowledge Graph in its own right, as you will observe if you install our Structured Data Sniffer extension .

Using Relative URIs is the key to simple Linked Data Deployment. The HTTP Fragment Identifier is a powerful feature that enables HTTP URIs (Hyperlinks) to identify anything. More importantly, it enables their use when identifying the subject, predicate, and object of an RDF sentence; i.e., this is what makes the notion of a Knowledge Graph that manifests as a Semantic Web viable.

Due to what’s outlined above, I am able to deploy this Linked Data Deployment tutorial using the age-old File Create, Save, Copy, and Share pattern across the proprietary storage services provided by Dropbox, Google Drive, Microsoft OneDrive, Amazon S3, etc, starting from my local file system.

RDF Sentences using JSON-LD Notation in a Local File en route to Web Publication to an Address (URL)

Conclusion

By following the steps outlined above, you would have successfully described how four entities (two people, a company, and a product) are related. Even better, you would have achieved the goal of making your effort native to the Web; i.e., your document viewers (human or bots) can simply follow links presented in your documents to better understand the information encoded in the entity relationships you’ve represented in RDF sentences.

At this juncture, I strongly encourage you to watch this video excerpt from a recent documentary about Tim Berners-Lee that sheds light on the inspiration and insights that lead to the creation of the platform known as the World Wide Web.

Segment from Documentary that sheds light on the importance of sentences to the notion of global information sharing

Related

Here are some tools that enable viewing and exploration of Linked Data using existing browsers:

--

--

Kingsley Uyi Idehen

CEO, OpenLink Software —High-Performance Data Centric Technology Providers.