JSON-LD by Example

R. Alexander Miłowski

milowski@ischool.berkeley.edu

School of Information, UC Berkeley

An object

JSON

{
  "http://schema.org/name": "Alex Milowski",
  "http://schema.org/url": "http://www.milowski.com/"
}            
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/" .
         

Explicit Typing

JSON

{
  "@type" : "http://schema.org/Person",
  "http://schema.org/name": "Alex Milowski",
  "http://schema.org/url": "http://www.milowski.com/"
}            
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 a schema:Person ;
    schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/" .
         

Embedding Subjects

JSON

{
  "@type" : "http://schema.org/Person",
  "http://schema.org/name": "Alex Milowski",
  "http://schema.org/url": "http://www.milowski.com/",
   "http://schema.org/affiliation": {
    "@type" : "http://schema.org/Organization",
    "http://schema.org/name" : "School of Information"
  }
}            
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 a schema:Person ;
    schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/"
    schema:affiliation _:2 .
_:2 a schema:Organization
    schema:name "School of Information" .
         

Referencing Subjects

JSON

[
  
{
  "@type" : "http://schema.org/Person",
  "http://schema.org/name": "Alex Milowski",
  "http://schema.org/url": "http://www.milowski.com/",
  "http://schema.org/affiliation": {"@id": "_:ischool"}
},
  
{
    "@id" : "_:ischool",
    "@type" : "http://schema.org/Organization",
    "http://schema.org/name" : "School of Information"
}

]            
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 a schema:Person ;
    schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/" 
    schema:affiliation _:ischool .
_:ischool a schema:Organization
    schema:name "School of Information" .
         

Explicit Contexts (compact syntax)

JSON

{
  "@context" : {
    "Person" : "http://schema.org/Person",
    "name" : "http://schema.org/name",
    "url" : "http://schema.org/url",
    "affiliation" : "http://schema.org/affiliation"
  },
  "@type" : "Person",
  "name": "Alex Milowski",
  "url": "http://www.milowski.com/",
  "affiliation": {
    "@type" : "http://schema.org/Organization",
    "name" : "School of Information"
  }
}
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 a schema:Person ;
    schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/" 
    schema:affiliation _:2 .
_:2 a schema:Organization
    schema:name "School of Information" .
         

Referencing Contexts

JSON

{
  "@context": "http://schema.org/"
  "@type" : "Person",
  "name": "Alex Milowski",
  "url": "http://www.milowski.com/",
   "affiliation": {
    "@type" : "Organization",
    "/name" : "School of Information"
  }
}            
         

Turtle

@prefix schema: <http://schema.org/> .

_:1 a schema:Person ;
    schema:name "Alex Milowski" ;
    schema:url "http://www.milowski.com/" 
    schema:affiliation _:2 .
_:2 a schema:Organization
    schema:name "School of Information" .
         

More Information

Check out: