https://www.w3.org/TR/json-ld/
- Terminology
- Basic Concepts
- Advanced Concepts
- Base IRI
- Default Vocabulary
- Compact IRIs
- Typed Values
- Type Coercion
- Embedding
- Advanced Context Usage
- String Internationalization
- IRI Expansion within a Context
- Sets and Lists
- Reverse Properties
- Named Graphs
- Identifying Blank Nodes
- Aliasing Keywords
- Expanded Document Form
- Compacted Document Form
- Flattened Document Form
- A
JSON-LD document
serializes a generalized RDF Dataset [RDF11-CONCEPTS], which is a collection of graphs that comprises exactly one default graph and zero or more named graphs. - The
default graph
does not have a name and may be empty. - Each
named graph
is a pair consisting of an IRI or blank node identifier (the graph name) and a graph. Whenever practical, the graph name should be an IRI. - A
graph
is a labeled directed graph, i.e., a set of nodes connected by edges. - Every
edge
has a direction associated with it and is labeled with an IRI or a blank node identifier. Within the JSON-LD syntax these edge labels are calledproperties
. Whenever practical, an edge should be labeled with an IRI. - Every
node
is an IRI, a blank node, a JSON-LD value, or a list. - A node having an outgoing edge must be an IRI or a blank node.
- A graph must not contain unconnected nodes, i.e., nodes which are not connected by an edge to any other node.
- An
IRI
(Internationalized Resource Identifier) is a string that conforms to the syntax defined in [RFC3987]. IRIs used within a graph should return a Linked Data document describing the resource denoted by that IRI when being dereferenced. - A
blank node
is a node which is neither an IRI, nor a JSON-LD value, nor a list. A blank node may be identified using a blank node identifier. - A
blank node identifier
is a string that can be used as an identifier for a blank node within the scope of a JSON-LD document. Blank node identifiers begin with _:. - A
JSON-LD value
is a typed value, a string (which is interpreted as typed value with type xsd:string), a number (numbers with a non-zero fractional part, i.e., the result of a modulo‑1 operation, are interpreted as typed values with type xsd:double, all other numbers are interpreted as typed values with type xsd:integer), true or false (which are interpreted as typed values with type xsd:boolean), or a language-tagged string. - A
typed value
consists of a value, which is a string, and a type, which is an IRI. - A
language-tagged string
consists of a string and a non-empty language tag as defined by [BCP47]. The language tag must be well-formed according to section 2.2.9 Classes of Conformance of [BCP47]. - A
list
is a sequence of zero or more IRIs, blank nodes, and JSON-LD values. Lists are interpreted as RDF list structures [RDF11-MT].
Figure 1: An illustration of the data model.
@context
: Used to define the short-hand names that are used throughout a JSON-LD document. These short-hand names are called terms and help developers to express specific identifiers in a compact manner.@id
: Used to uniquely identify things that are being described in the document with IRIs or blank node identifiers.@value
: Used to specify the data that is associated with a particular property in the graph.@language
: Used to specify the language for a particular string value or the default language of a JSON-LD document.@type
: Used to set the data type of a node or typed value.@container
: Used to set the default container type for a terms.@list
: Used to express an ordered set of data.@set
: Used to express an unordered set of data and to ensure that values are always represented as arrays.@reverse
: Used to express reverse properties.@index
: Used to specify that a container is used to index information and that processing should continue deeper into a JSON data structure.@base
: Used to set the base IRIs against which relative IRIs are resolved.@vocab
: Used to expand properties and values in@type
with a common prefix IRI.@graph
: Used to express a graph.:
: The separator for JSON keys and values that use compact IRIs.
EXAMPLE 1: Sample JSON document
{
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
EXAMPLE 2: Sample JSON-LD document using full IRIs instead of terms
{
"http://schema.org/name": "Manu Sporny",
"http://schema.org/url": { "@id": "http://manu.sporny.org/" }, ← The '@id' keyword means 'This value is an identifier that is an IRI'
"http://schema.org/image": { "@id": "http://manu.sporny.org/images/manu.png" }
}
Simply speaking, a context
is used to map terms to IRIs. Terms are case sensitive and any valid string that is not a reserved JSON-LD keyword can be used as a term.
EXAMPLE 3: Context for the sample document in the previous section
{
"@context":
{
"name": "http://schema.org/name", ← This means that 'name' is shorthand for 'http://schema.org/name'
"image": {
"@id": "http://schema.org/image", ← This means that 'image' is shorthand for 'http://schema.org/image'
"@type": "@id" ← This means that a string value associated with 'image' should be interpreted as an identifier that is an IRI
},
"homepage": {
"@id": "http://schema.org/url", ← This means that 'homepage' is shorthand for 'http://schema.org/url'
"@type": "@id" ← This means that a string value associated with 'homepage' should be interpreted as an identifier that is an IRI
}
}
}
EXAMPLE 4: Referencing a JSON-LD context
{
"@context": "http://json-ld.org/contexts/person.jsonld",
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
EXAMPLE 5: In-line context definition
{
"@context":
{
"name": "http://schema.org/name",
"image": {
"@id": "http://schema.org/image",
"@type": "@id"
},
"homepage": {
"@id": "http://schema.org/url",
"@type": "@id"
}
},
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
EXAMPLE 6: Values of @id are interpreted as IRI
{
...
"homepage": { "@id": "http://example.com/" }
...
}
EXAMPLE 7: IRIs can be relative
{
...
"homepage": { "@id": "../" }
...
}
EXAMPLE 8: IRI as a key
{
...
"http://schema.org/name": "Manu Sporny",
...
}
EXAMPLE 9: Term expansion from context definition
{
"@context":
{
"name": "http://schema.org/name"
},
"name": "Manu Sporny",
"status": "trollin'"
}
JSON keys that do not expand to an IRI, such as status in the example above, are not Linked Data and thus ignored when processed.
If type coercion rules are specified in the @context for a particular term or property IRI, an IRI is generated:
EXAMPLE 10: Type coercion
{
"@context":
{
...
"homepage":
{
"@id": "http://schema.org/url",
"@type": "@id"
}
...
}
...
"homepage": "http://manu.sporny.org/",
...
}
In JSON-LD, a node is identified using the @id keyword:
EXAMPLE 11: Identifying a node
{
"@context":
{
...
"name": "http://schema.org/name"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
...
}
The type of a particular node can be specified using the @type keyword.
EXAMPLE 12: Specifying the type for a node
{
...
"@id": "http://example.org/places#BrewEats",
"@type": "http://schema.org/Restaurant",
...
}
EXAMPLE 13: Specifying multiple types for a node
{
...
"@id": "http://example.org/places#BrewEats",
"@type": [ "http://schema.org/Restaurant", "http://schema.org/Brewery" ],
...
}
EXAMPLE 14: Using a term to specify the type
{
"@context": {
...
"Restaurant": "http://schema.org/Restaurant",
"Brewery": "http://schema.org/Brewery"
}
"@id": "http://example.org/places#BrewEats",
"@type": [ "Restaurant", "Brewery" ],
...
}
EXAMPLE 15: Use a relative IRI as node identifier
{
"@context": {
"label": "http://www.w3.org/2000/01/rdf-schema#label"
},
"@id": "",
"label": "Just a simple document"
}
This document uses an empty @id, which resolves to the document base. However, if the document is moved to a different location, the IRI would change. To prevent this without having to use an absolute IRI, a context may define an @base mapping, to overwrite the base IRI for the document.
EXAMPLE 16: Setting the document base in a document
{
"@context": {
"@base": "http://example.com/document.jsonld"
},
"@id": "",
"label": "Just a simple document"
}
EXAMPLE 17: Using a common vocabulary prefix
{
"@context": {
"@vocab": "http://schema.org/"
}
"@id": "http://example.org/places#BrewEats",
"@type": "Restaurant",
"name": "Brew Eats"
...
}
If @vocab is used but certain keys in an object should not be expanded using the vocabulary IRI, a term can be explicitly set to null in the context.
EXAMPLE 18: Using the null keyword to ignore data
{
"@context":
{
"@vocab": "http://schema.org/",
"databaseId": null
},
"@id": "http://example.org/places#BrewEats",
"@type": "Restaurant",
"name": "Brew Eats",
"databaseId": "23987520"
}
EXAMPLE 19: Prefix expansion
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/"
...
},
"@type": "foaf:Person"
"foaf:name": "Dave Longley",
...
}
In the example above, foaf:name expands to the IRI http://xmlns.com/foaf/0.1/name and foaf:Person expands to http://xmlns.com/foaf/0.1/Person.
EXAMPLE 20: Using vocabularies
{
"@context":
{
"xsd": "http://www.w3.org/2001/XMLSchema#",
"foaf": "http://xmlns.com/foaf/0.1/",
"foaf:homepage": { "@type": "@id" },
"picture": { "@id": "foaf:depiction", "@type": "@id" }
},
"@id": "http://me.markus-lanthaler.com/",
"@type": "foaf:Person",
"foaf:name": "Markus Lanthaler",
"foaf:homepage": "http://www.markus-lanthaler.com/",
"picture": "http://twitter.com/account/profile_image/markuslanthaler"
}
The first example uses the @type keyword to associate a type with a particular term in the @context:
EXAMPLE 21: Expanded term definition with type coercion
{
"@context":
{
"modified":
{
"@id": "http://purl.org/dc/terms/modified",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}
},
...
"@id": "http://example.com/docs/1",
"modified": "2010-05-29T14:17:39+02:00",
...
}
Subject | Property | Value | Value Type |
---|---|---|---|
http://example.com/docs/1 | http://purl.org/dc/terms/modified | 2010-05-29T14:17:39+02:00 | http://www.w3.org/2001/XMLSchema#dateTime |
The second example uses the expanded form of setting the type information in the body of a JSON-LD document:
EXAMPLE 22: Expanded value with type
{
"@context":
{
"modified":
{
"@id": "http://purl.org/dc/terms/modified"
}
},
...
"modified":
{
"@value": "2010-05-29T14:17:39+02:00",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
}
...
}
A node type
specifies the type of thing that is being described, like a person, place, event, or web page. A value type
specifies the data type of a particular value, such as an integer, a floating point number, or a date.
EXAMPLE 23: Example demonstrating the context-sensitivity for @type
{
...
"@id": "http://example.org/posts#TripToWestVirginia",
"@type": "http://schema.org/BlogPosting", ← This is a node type
"modified":
{
"@value": "2010-05-29T14:17:39+02:00",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime" ← This is a value type
}
...
}
Subject | Property | Value | Value Type |
---|---|---|---|
http://example.org/posts#TripToWestVirginia | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://schema.org/BlogPosting | - |
http://example.org/posts#TripToWestVirginia | http://purl.org/dc/terms/modified | 2010-05-29T14:17:39+02:00 | http://www.w3.org/2001/XMLSchema#dateTime |
Type coercion allows someone deploying JSON-LD to coerce the incoming or outgoing values to the proper data type based on a mapping of data type IRIs to terms.
EXAMPLE 24: Expanded term definition with types
{
"@context":
{
"xsd": "http://www.w3.org/2001/XMLSchema#",
"name": "http://xmlns.com/foaf/0.1/name",
"age":
{
"@id": "http://xmlns.com/foaf/0.1/age",
"@type": "xsd:integer"
},
"homepage":
{
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
}
},
"@id": "http://example.com/people#john",
"name": "John Smith",
"age": "41",
"homepage":
[
"http://personal.example.org/",
"http://work.example.com/jsmith/"
]
}
Terms may also be defined using absolute IRIs or compact IRIs.
EXAMPLE 25: Term definitions using compact and absolute IRIs
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/",
"foaf:age":
{
"@id": "http://xmlns.com/foaf/0.1/age",
"@type": "xsd:integer"
},
"http://xmlns.com/foaf/0.1/homepage":
{
"@type": "@id"
}
},
"foaf:name": "John Smith",
"foaf:age": "41",
"http://xmlns.com/foaf/0.1/homepage":
[
"http://personal.example.org/",
"http://work.example.com/jsmith/"
]
}
Embedding is a JSON-LD feature that allows an author to use node objects as property values. This is a commonly used mechanism for creating a parent-child relationship between two nodes.
EXAMPLE 26: Embedding a node object as property value of another node object
{
...
"name": "Manu Sporny",
"knows":
{
"@type": "Person",
"name": "Gregg Kellogg",
}
...
}
EXAMPLE 27: Using multiple contexts
[
{
"@context": "http://example.org/contexts/person.jsonld",
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"depiction": "http://twitter.com/account/profile_image/manusporny"
},
{
"@context": "http://example.org/contexts/place.jsonld",
"name": "The Empire State Building",
"description": "The Empire State Building is a 102-story landmark in New York City.",
"geo": {
"latitude": "40.75",
"longitude": "73.98"
}
}
]
Duplicate context terms are overridden using a most-recently-defined-wins mechanism.
EXAMPLE 28: Scoped contexts within node objects
{
"@context":
{
"name": "http://example.com/person#name,
"details": "http://example.com/person#details"
}",
"name": "Markus Lanthaler",
...
"details":
{
"@context":
{
"name": "http://example.com/organization#name"
},
"name": "Graz University of Technology"
}
}
EXAMPLE 29: Combining external and local contexts
{
"@context": [
"http://json-ld.org/contexts/person.jsonld",
{
"pic": "http://xmlns.com/foaf/0.1/depiction"
}
],
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"pic": "http://twitter.com/account/profile_image/manusporny"
}
First, it is possible to define a default language for a JSON-LD document by setting the @language key in the context:
EXAMPLE 31: Setting the default language of a JSON-LD document
{
"@context":
{
...
"@language": "ja"
},
"name": "花澄",
"occupation": "科学者"
}
The example above would associate the ja language code with the two strings 花澄 and 科学者. Languages codes are defined in [BCP47]. The default language applies to all string values that are not type coerced.
To clear the default language for a subtree, @language can be set to null in a local context as follows:
EXAMPLE 32: Clearing default language
{
"@context": {
...
"@language": "ja"
},
"name": "花澄",
"details": {
"@context": {
"@language": null
},
"occupation": "Ninja"
}
}
Second, it is possible to associate a language with a specific term using an expanded term definition:
EXAMPLE 33: Expanded term definition with language
{
"@context": {
...
"ex": "http://example.com/vocab/",
"@language": "ja",
"name": { "@id": "ex:name", "@language": null },
"occupation": { "@id": "ex:occupation" },
"occupation_en": { "@id": "ex:occupation", "@language": "en" },
"occupation_cs": { "@id": "ex:occupation", "@language": "cs" }
},
"name": "Yagyū Muneyoshi",
"occupation": "忍者",
"occupation_en": "Ninja",
"occupation_cs": "Nindža",
...
}
EXAMPLE 34: Language map expressing a property in three languages
{
"@context":
{
...
"occupation": { "@id": "ex:occupation", "@container": "@language" }
},
"name": "Yagyū Muneyoshi",
"occupation":
{
"ja": "忍者",
"en": "Ninja",
"cs": "Nindža"
}
...
}
Third, it is possible to override the default language by using a value object:
EXAMPLE 35: Overriding default language using an expanded value
{
"@context": {
...
"@language": "ja"
},
"name": "花澄",
"occupation": {
"@value": "Scientist",
"@language": "en"
}
}
This makes it possible to specify a plain string by omitting the @language tag or setting it to null when expressing it using a value object:
{
"@context": {
...
"@language": "ja"
},
"name": {
"@value": "Frank"
},
"occupation": {
"@value": "Ninja",
"@language": "en"
},
"speciality": "手裏剣"
}
It is common to use the xsd namespace when defining typed values:
EXAMPLE 37: IRI expansion within a context
{
"@context":
{
"xsd": "http://www.w3.org/2001/XMLSchema#",
"name": "http://xmlns.com/foaf/0.1/name",
"age":
{
"@id": "http://xmlns.com/foaf/0.1/age",
"@type": "xsd:integer"
},
"homepage":
{
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
}
},
...
}
Terms may also be used when defining the IRI of another term:
EXAMPLE 38: Using a term to define the IRI of another term within a context
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"name": "foaf:name",
"age":
{
"@id": "foaf:age",
"@type": "xsd:integer"
},
"homepage":
{
"@id": "foaf:homepage",
"@type": "@id"
}
},
...
}
Compact IRIs and IRIs may be used on the left-hand side of a term definition.
EXAMPLE 39: Using a compact IRI as a term
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"name": "foaf:name",
"foaf:age":
{
"@type": "xsd:integer"
},
"foaf:homepage":
{
"@type": "@id"
}
},
...
}
Absolute IRIs may also be used in the key position in a context:
EXAMPLE 40: Associating context definitions with absolute IRIs
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"name": "foaf:name",
"foaf:age":
{
"@id": "foaf:age",
"@type": "xsd:integer"
},
"http://xmlns.com/foaf/0.1/homepage":
{
"@type": "@id"
}
},
...
}
EXAMPLE 41: Illegal circular definition of terms within a context
{
"@context":
{
"term1": "term2:foo",
"term2": "term1:bar"
},
...
}
EXAMPLE 42: Multiple values with no inherent order
{
...
"@id": "http://example.org/people#joebob",
"nick": [ "joe", "bob", "JB" ],
...
}
EXAMPLE 43: Using an expanded form to set multiple values
{
"@id": "http://example.org/articles/8",
"dc:title":
[
{
"@value": "Das Kapital",
"@language": "de"
},
{
"@value": "Capital",
"@language": "en"
}
]
}
Subject | Property | Value | Language |
---|---|---|---|
http://example.org/articles/8 | http://purl.org/dc/terms/title | Das Kapital | de |
http://example.org/articles/8 | http://purl.org/dc/terms/title | Capital | en |
EXAMPLE 44: An ordered collection of values in JSON-LD
{
...
"@id": "http://example.org/people#joebob",
"foaf:nick":
{
"@list": [ "joe", "bob", "jaybee" ]
},
...
}
EXAMPLE 45: Specifying that a collection is ordered in the context
{
"@context":
{
...
"nick":
{
"@id": "http://xmlns.com/foaf/0.1/nick",
"@container": "@list"
}
},
...
"@id": "http://example.org/people#joebob",
"nick": [ "joe", "bob", "jaybee" ],
...
}
EXAMPLE 46: A document with children linking to their parent
[
{
"@id": "#homer",
"http://example.com/vocab#name": "Homer"
},
{
"@id": "#bart",
"http://example.com/vocab#name": "Bart",
"http://example.com/vocab#parent": { "@id": "#homer" }
},
{
"@id": "#lisa",
"http://example.com/vocab#name": "Lisa",
"http://example.com/vocab#parent": { "@id": "#homer" }
}
]
EXAMPLE 47: A person and its children using a reverse property
{
"@id": "#homer",
"http://example.com/vocab#name": "Homer",
"@reverse": {
"http://example.com/vocab#parent": [
{
"@id": "#bart",
"http://example.com/vocab#name": "Bart"
},
{
"@id": "#lisa",
"http://example.com/vocab#name": "Lisa"
}
]
}
}
EXAMPLE 48: Using @reverse to define reverse properties
{
"@context": {
"name": "http://example.com/vocab#name",
"children": { "@reverse": "http://example.com/vocab#parent" }
},
"@id": "#homer",
"name": "Homer",
"children": [
{
"@id": "#bart",
"name": "Bart"
},
{
"@id": "#lisa",
"name": "Lisa"
}
]
}
At times, it is necessary to make statements about a graph itself, rather than just a single node. This can be done by grouping a set of nodes using the @graph keyword. A developer may also name data expressed using the @graph keyword by pairing it with an @id keyword as shown in the following example:
EXAMPLE 49: Identifying and making statements about a graph
{
"@context": {
"generatedAt": {
"@id": "http://www.w3.org/ns/prov#generatedAtTime",
"@type": "http://www.w3.org/2001/XMLSchema#date"
},
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://example.org/graphs/73",
"generatedAt": "2012-04-09",
"@graph":
[
{
"@id": "http://manu.sporny.org/about#manu",
"@type": "Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/about#manu"
}
]
}
Graph | Subject | Property | Value | Value Type |
---|
- | http://example.org/graphs/73 | http://www.w3.org/ns/prov#generatedAtTime | 2012-04-09 | http://www.w3.org/2001/XMLSchema#date http://example.org/graphs/73 | http://manu.sporny.org/about#manu | http://www.w3.org/2001/XMLSchema#type | http://xmlns.com/foaf/0.1/Person | - http://example.org/graphs/73 | http://manu.sporny.org/about#manu | http://xmlns.com/foaf/0.1/name | Manu Sporny | - http://example.org/graphs/73 | http://manu.sporny.org/about#manu | http://xmlns.com/foaf/0.1/knows | http://greggkellogg.net/foaf#me | - http://example.org/graphs/73 | http://greggkellogg.net/foaf#me | http://www.w3.org/2001/XMLSchema#type | http://xmlns.com/foaf/0.1/Person | - http://example.org/graphs/73 | http://greggkellogg.net/foaf#me | http://xmlns.com/foaf/0.1/name | Gregg Kellogg | - http://example.org/graphs/73 | http://greggkellogg.net/foaf#me | http://xmlns.com/foaf/0.1/knows | http://manu.sporny.org/about#manu | -
EXAMPLE 50: Using @graph to explicitly express the default graph
{
"@context": ...,
"@graph":
[
{
"@id": "http://manu.sporny.org/about#manu",
"@type": "foaf:Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "foaf:Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/about#manu"
}
]
}
EXAMPLE 51: Context needs to be duplicated if @graph is not used
[
{
"@context": ...,
"@id": "http://manu.sporny.org/about#manu",
"@type": "foaf:Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@context": ...,
"@id": "http://greggkellogg.net/foaf#me",
"@type": "foaf:Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/about#manu"
}
]
EXAMPLE 52: Specifying a local blank node identifier
{
...
"@id": "_:n1",
"name": "Secret Agent 1",
"knows":
{
"name": "Secret Agent 2",
"knows": { "@id": "_:n1" }
}
}
EXAMPLE 53: Aliasing keywords
{
"@context":
{
"url": "@id",
"a": "@type",
"name": "http://xmlns.com/foaf/0.1/name"
},
"url": "http://example.com/about#gregg",
"a": "http://xmlns.com/foaf/0.1/Person",
"name": "Gregg Kellogg"
}
EXAMPLE 55: Sample JSON-LD document
{
"@context":
{
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
}
},
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/"
}
EXAMPLE 56: Expanded form for the previous example
[
{
"http://xmlns.com/foaf/0.1/name": [
{ "@value": "Manu Sporny" }
],
"http://xmlns.com/foaf/0.1/homepage": [
{ "@id": "http://manu.sporny.org/" }
]
}
]
EXAMPLE 57: Sample expanded JSON-LD document
[
{
"http://xmlns.com/foaf/0.1/name": [ "Manu Sporny" ],
"http://xmlns.com/foaf/0.1/homepage": [
{
"@id": "http://manu.sporny.org/"
}
]
}
]
EXAMPLE 58: Sample context
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
}
}
}
EXAMPLE 59: Compact form of the sample document once sample context has been applied
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
}
},
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/"
}
EXAMPLE 60: Sample JSON-LD document
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"knows": [
{
"@id": "http://manu.sporny.org/about#manu",
"name": "Manu Sporny"
},
{
"name": "Dave Longley"
}
]
}
EXAMPLE 61: Flattened and compacted form for the previous example
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows"
},
"@graph": [
{
"@id": "_:b0",
"name": "Dave Longley"
},
{
"@id": "http://manu.sporny.org/about#manu",
"name": "Manu Sporny"
},
{
"@id": "http://me.markus-lanthaler.com/",
"name": "Markus Lanthaler",
"knows": [
{ "@id": "http://manu.sporny.org/about#manu" },
{ "@id": "_:b0" }
]
}
]
}