W3C The

JSON-LD API 1.0

An Application Programming Interface for the JSON-LD Syntax

Unofficial Draft 24 May

Final Community Group Specification 26 June 2012

Latest editor's draft:
http://json-ld.org/spec/latest/json-ld-api/
Editors:
Manu Sporny , Digital Bazaar
Gregg Kellogg , Kellogg Associates
Dave Longley , Digital Bazaar
Markus Lanthaler , Graz University of Technology
Authors:
Dave Longley , Digital Bazaar
Manu Sporny , Digital Bazaar
Gregg Kellogg , Kellogg Associates
Markus Lanthaler , Graz University of Technology

This document is also available in this non-normative format: diff to previous version .


Abstract

JSON [ RFC4627 ] has proven to be a highly useful object serialization and messaging format. JSON-LD [ JSON-LD ] harmonizes the representation of Linked Data in JSON by outlining a common JSON representation format for expressing directed graphs; mixing both Linked Data and non-Linked Data in a single document. This document outlines an Application Programming Interface and a set of algorithms for programmatically transforming JSON-LD documents. documents in order to make them easier to work with in programming environments like JavaScript, Python, and Ruby.

Status of This Document

This document specification was published by the JSON for Linking Data Community Group . It is merely not a public working draft W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Final Specification Agreement (FSA) other conditions apply. Learn more about W3C Community and Business Groups .

This document has been under development for over 18 months in the JSON for Linking Data Community Group. The document has recently been approved for transfer into the RDF Working Group for review with the intent to publish the document along the W3C Recommendation track. This specification has undergone significant development, review, and changes during the course of the last 18 months and is being published as a potential Final Community Group Specification so that it may gain wider review and feedback.

There are currently five interoperable implementations of this specification. There is a fairly complete test suite and a live JSON-LD editor that is capable of demonstrating the features described in this document. While development on implementations, the test suite and the live editor will continue, they are believed to be mature enough to be integrated into a non-production system at this point in time with the expectation that they could be used in a production system within the next year.

Issue 1

It has no official standing is important for readers to understand that the scope of any kind this document is currently under debate and does not represent new features may be added to the support specification. Existing features may be modified heavily or consensus of any standards organisation. removed entirely from the specification upon further review and feedback from the broader community. This document is an experimental a work in progress. progress and publication as a First Public Working Draft does not require that all Working Group members agree on the content of the document.

Table of Contents

1. Introduction Preface

JSON, as specified in [ RFC4627 ], is a simple language for representing data on the Web. Linked Data is a technique for creating a graph of interlinked data across different documents or Web sites. Data entities are described using IRI s, which are typically dereferencable and thus may be used to find more information about an entity, creating a "Web of Knowledge". JSON-LD is intended to be a simple publishing method for expressing not only Linked Data in JSON, but also for adding semantics to existing JSON. JSON-LD is designed as a light-weight syntax that can be used to express Linked Data. It is primarily intended to be a way to use Linked Data in Javascript and other Web-based programming environments. It is also useful when building interoperable Web services and when storing Linked Data in JSON-based document storage engines. It is practical and designed to be as simple as possible, utilizing the large number of JSON parsers and libraries available today. It is designed to be able to express key-value pairs, RDF data, RDFa [ RDFA-CORE ] data, Microformats [ MICROFORMATS ] data, and Microdata [ MICRODATA ]. That is, it supports every major Web-based structured data model in use today. The syntax does not necessarily require applications to change their JSON, but allows to easily add meaning by adding context in a way that is either in-band or out-of-band. The syntax is designed to not disturb already deployed systems running on JSON, but provide a smooth upgrade path from JSON to JSON with added semantics. Finally, the format is intended to be easy to parse, efficient to generate, convertible to RDF in one pass, and require a very small memory footprint in order to operate. 1.1 How to Read this Document This document is a detailed specification for a serialization of Linked Data in JSON. an Application Programming Interface for the JSON-LD Syntax. The document is primarily intended for the following audiences:

To understand the basics in this specification you must first be familiar with JSON, which is detailed in [ RFC4627 ]. You must also understand the JSON-LD Syntax [ JSON-LD ], which is the base syntax used by all of the algorithms in this document. To understand the API and how it is intended to operate in a programming environment, it is useful to have working knowledge of the JavaScript programming language [ ECMA-262 ] and WebIDL [ WEBIDL ]. To understand how JSON-LD maps to RDF, it is helpful to be familiar with the basic RDF concepts [ RDF-CONCEPTS ].

1.1 Contributing

Examples There are a number of ways that one may contain references participate in the development of this specification:

2. Introduction

The JSON-LD Syntax specification [ JSON-LD ] outlines a list language that may be used to express Linked Data in JSON. Often, it is useful to be able to transform JSON-LD documents so that they may be easily processed in a programming environment like JavaScript, Python or Ruby.

There are three major types of all vocabularies transformation that are discussed in this document; compaction, expansion, and RDF conversion.

2.1 Expansion

Software algorithms are easiest to write when the data that they are processing have a regular form. Since information can be represented by JSON-LD in a variety of different ways, transforming all of these methods into a uniform structure allows the developer to simplify their prefix processing code. For example, note that the following input uses only term abbreviations, s and is fairly compact:

Example 1
var input1 = {
  "@context": "http://json-ld.org/contexts/person.jsonld"
  "name": "Manu Sporny",
  "homepage": "http://manu.sporny.org/"
}

The next input example uses one IRI to express a property, but leaves the rest of the information untouched.

Example 2
var input2 = {
  "@context": "http://json-ld.org/contexts/person.jsonld"
  "http://xmlns.com/foaf/0.1/name": "Manu Sporny",
  "homepage": "http://manu.sporny.org/"
}

While both inputs are valid JSON-LD, writing a program to handle every permutation of possible inputs can be difficult, especially when the incoming context could change as used well. To ensure that the data can be given a more uniform structure, JSON-LD introduces the notion of expansion. Expansion performs two important operations. The first is to expand all values that are IRI s to their fully expanded form. The second is to express all values in this document: expanded form . To transform both inputs above to the same representation, the developer could do the following:

Example 3
function expansionCallback(output) {
   console.log(output);
}
// the second parameter is 'null' because the developer does not wish to
// inject another context value
jsonld.expand(input1, null, expansionCallback);
jsonld.expand(input2,
null,
expansionCallback);

The Dublin Core output for both calls above will be:

Example 4
[{
  "http://xmlns.com/foaf/0.1/name": [{
    "@value": "Manu Sporny"
  }],
  "http://xmlns.com/foaf/0.1/homepage": [{
    "@id": "http://manu.sporny.org/"
  }]
}]

Note that in the example above; all context vocabulary (abbreviation: dc , e.g., dc:title ) The Friend definitions have been removed, all term and prefixes have been expanded to full IRIs, and all literal s are expressed in expanded form . While the output is more difficult for a human to read, it is easier for a software program to process because of its very regular structure.

2.2 Compaction

While expansion expands a Friend given input as much as possible, compaction performs the opposite operation - expressing a given input as succinctly as possible. While expansion is meant to produce something that is easy to process by software programs, compaction is meant to produce something that is easy to ready by software developers. Compaction uses a developer-supplied context vocabulary (abbreviation: foaf , e.g., foaf:knows ) The RDF to compresses all IRI vocabulary (abbreviation: rdf , e.g., rdf:type ) s to term s or prefix es, and compacts all literal s expressed in expanded form as much as possible.

The XSD following example expresses input that has already been fully expanded:

Example 5
var expandedInput = [{
  "http://xmlns.com/foaf/0.1/name": [{
    "@value": "Manu Sporny"
  }],
  "http://xmlns.com/foaf/0.1/homepage": [{
    "@id": "http://manu.sporny.org/"
  }]
}]

A developer that wants to transform the data above into a more human-readable form, could do the following using the JSON-LD API:

Example 6
function compactionCallback(output) {
   console.log(output);
}
jsonld.compact(expandedInput,
"http://json-ld.org/contexts/person.jsonld",
compactionCallback);

The following would be the result of the call above:

Example 7
{
  "@context": "http://json-ld.org/contexts/person.jsonld"
  "name": "Manu Sporny",
  "homepage": "http://manu.sporny.org/"
}

Note that all of the term vocabulary (abbreviation: xsd , e.g., xsd:integer ) s have been compressed and the context has been injected into the output. While compacted output is most useful to humans, it can also be carefully used to generate structures that are easy to use for developers to program against as well.

2.3 Conversion to and from RDF

JSON JSON-LD can be used to losslessly express the RDF data model as described in the RDF Concepts document [ RFC4627 RDF-CONCEPTS ] defines several terms which ]. This ensures that data can be round-tripped from any RDF syntax, like N-Triples or TURTLE, without any loss in the fidelity of the data. Assume the following RDF input in N-Triples format:

Example 8
var data = "
<http://manu.sporny.org/about/#manu> <http://xmlns.com/foaf/0.1/name> \"Manu Sporny\" .\n
<http://manu.sporny.org/about/#manu>
<http://xmlns.com/foaf/0.1/homepage>
<http://manu.sporny.org/>
.";

A developer can use the JSON-LD API to transform the markup above into a JSON-LD document:

Example 9
function conversionCallback(result)
{
  console.log("JSON-LD Document: ", result);
};
jsonld.fromRDF(data,
conversionCallback,
{"format":
"ntriples"});

The following expanded output would be the result of the call above:

Example 10
[{
  "@id": "http://manu.sporny.org/about/#manu",
  "http://xmlns.com/foaf/0.1/name": [{
    "@value": "Manu Sporny"
  }],
  "http://xmlns.com/foaf/0.1/homepage": [{
    "@id": "http://manu.sporny.org/"
  }]
}]

Note that the output above, could easily be compacted to produce the following using the technique outlined in the previous section:

Example 11
{
  "@context": "http://json-ld.org/contexts/person.jsonld",
  "@id": "http://manu.sporny.org/about/#manu",
  "name": "Manu Sporny",
  "homepage": "http://manu.sporny.org/"
}

Transforming the object above back to RDF is as simple as calling the toRDF() method:

Example 12
var jsonldDocument = ...; // assign the JSON-LD document here
function rdfCallback(quads)
{
  console.log("RDF Data: ", quads);
};
jsonld.toRDF(jsonldDocument,
rdfCallback);

2.4 Framing and Normalization

Issue 2

There are currently two other API methods that are in active development and were not ready for publication at the time this document was published. Framing allows a developer to force a different layout for the data and effectively perform query-by-example on JSON-LD documents - this is most useful when a JSON-LD-based REST API does not know the exact form of the data it is getting in, but still wants to operate upon it if some bare essentials are found in the data. JSON-LD normalization allows JSON-LD documents to be deterministically serialized such that they can be digitally signed or be used throughout to find the differences between two linked data graph s. It is expected that framing will be a part of the final API. It is expected that normalization will be an optional feature that JSON-LD processors may implement.

3. The Application Programming Interface

This API provides a clean mechanism that enables developers to convert JSON-LD data into a a variety of output formats that are easier to work with in various programming languages. If a JSON-LD API is provided in a programming environment, the entirety of the following API must be implemented.

3.1 General Terminology

Issue 3

The intent of the Working Group and the Editors of this document: specification is to eventually align terminology used in this document with the terminology used in the RDF Concepts document to the extent to which it makes sense to do so. In general, if there is an analogue to terminology used in this document in the RDF Concepts document, the preference is to use the terminology in the RDF Concepts document.

The following is an explanation of the general terminology used in this document:

JSON object
An object structure is represented as a pair of curly brackets surrounding zero or more name/value name-value pairs. A name is a string . A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object should be unique.
array
An array is an ordered collection of values. An array structure is represented as square brackets surrounding zero or more values (or elements). Elements that are separated by commas. Within JSON-LD, array order is not preserved by default, unless specific markup is provided. This is because the basic data model of JSON-LD is a linked data graph , which is inherently unordered.
string
A string is a sequence of zero or more Unicode (UTF-8) characters, wrapped in double quotes, using backslash escapes. escapes (if necessary). A character is represented as a single character string.
number
A number is is similar to that used in most programming languages, except that the octal and hexadecimal formats are not used and that leading zeros are not allowed.
true and false
Boolean values. Values that are used to express one of two possible boolean states.
null
The use Unless otherwise specified, a JSON-LD processor must act as if a key-value pair in the body of a JSON-LD document was never declared when the null value within JSON-LD equals null . If @value , @list , or @set is used set to ignore or null in expanded form, then the entire JSON object is ignored. If @context is set to null , the active context is reset values. and when used within a context , it removes any definition associated with the key, unless otherwise specified.
subject definition
A JSON object used to represent a subject and one or more properties of that subject. A JSON object is a subject definition if it does not contain the they keys @value , @list or @set and it has one or more keys other than @id .
subject reference
A JSON object used to reference a subject having only the @id key.
1.2 Linked Data The following definition for Linked Data is the one that will be used for this specification.
Linked Data is a
A set of documents, each containing a representation of a linked data graph. A graph .
linked data graph is an or dataset
An unordered labeled directed graph, where nodes node s are subject s or object s, and edges are properties.
node
A piece of information that is represented in a linked data graph .
named graph
A linked data graph that has one or more IRI that are used to refer to it.
graph name
An IRI that is a reference to a named graph .
default graph
When executing an algorithm, the graph where data should be placed if a named graph is not specified.
subject is any
Any node in a linked data graph with at least one outgoing edge. A subject should be labeled with an
IRI (an
An Internationalized Resource Identifier as described in [ RFC3987 ]). An
object is a
A node in a linked data graph with at least one incoming edge. An object may be labeled with an IRI
. An object may be a subject and object at the same time. A property is an
An edge of the linked data graph . A property
literal
An object should be labeled with a label that is not an IRI . An
IRI quad
A piece of information that is a label in a linked data graph should be dereferencable to contains four items; a Linked Data document describing the labeled subject , object or a property . A literal is an , a object with , and a label that is not an graph name .
IRI context
A JSON object Note that the definition for Linked Data above is silent on the topic of unlabeled nodes. Unlabeled nodes are not considered Linked Data . However, this specification allows contains rules for the expression of unlabled nodes, as most graph-based data sets on the Web contain interpreting a number of associated nodes that are not named and thus are not directly de-referenceable. JSON-LD document.
1.3 Contributing There are a number of ways keyword
A JSON key that one may participate is specific to JSON-LD, specified in the development of this specification: Technical discussion typically occurs on the public mailing list: public-linked-json@w3.org JSON-LD Syntax specification [ Public teleconferences JSON-LD are held on Tuesdays at 1500UTC on the second and fourth week of each month. Specification bugs and issues should be reported ] in the issue tracker section titled Syntax Tokens and Keywords . Source code for the specification can be found on Github. The #json-ld IRC channel is available for real-time discussion on irc.freenode.net.

2. 3.2 The Application Programming Interface JsonLdProcessor

This API provides a clean mechanism that enables developers to convert JSON-LD data into a a variety of output formats that are easier to work with in various programming languages. If a The JSON-LD API Processor interface is provided in a programming environment, the entirety of high-level programming structure that developers use to access the following API must be implemented. JSON-LD transformation methods.

2.1 JsonLdProcessor
[NoInterfaceObject]
interface JsonLdProcessor {
    void expand (object or object[] or URL input, object or URL? context, JsonLdCallback callback, optional JsonLdOptions options);
    void compact (object or object[] or URL input, object or URL context, JsonLdCallback callback, optional JsonLdOptions options);
    void fromRDF (Quad[] input, JsonLdCallback callback, optional JsonLdOptions options);
    void toRDF (object or object[] or URL input, QuadCallback callback, optional JsonLdOptions options);
};

2.1.1 3.2.1 Methods

compact
Compacts the given input using the context according to the steps in the Compaction Algorithm . The input must be copied, compacted and returned if there are no errors. If the compaction fails, an appropirate appropriate exception must be thrown.
Parameter Type Nullable Optional Description
input object or object[] or URL The JSON-LD object or array of JSON-LD objects to perform the compaction upon or an IRI referencing the JSON-LD document to compact.
context object or URL The context to use when compacting the input ; either in the form of an JSON object or as IRI .
callback JsonLdCallback A callback that is called when processing is complete on the given input .
options JsonLdOptions A set of options that may affect the expansion algorithm such as, e.g., the input document's base IRI . This also includes optimize , which if set will cause processor-specific optimization.
Return type: void
expand
Expands the given input according to the steps in the Expansion Algorithm . The input must be copied, expanded and returned if there are no errors. If the expansion fails, an appropriate exception must be thrown. ✘ ✘ The JSON-LD object or array of JSON-LD objects to flatten or an IRI referencing the JSON-LD document to flatten. graph string or URL ✘ ✘ The graph in the document that should be flattened. To return the default graph @default has to be passed, for the merged graph @merged and for any other graph the IRI identifying the graph has to be passed. The default value is @merged . context ObjectOrURL
Parameter Type Nullable Optional Description
input object or object[] or URL The JSON-LD object or array of JSON-LD objects to perform the expansion upon or an IRI referencing the JSON-LD document to expand.
context ObjectOrURL ✔ ✘ An optional external context to use additionally to the context embedded in input when expanding the input . callback JsonLdCallback ✘ ✘ A callback that is called when processing is complete on the given input . options JsonLdOptions ✘ ✔ A set of options that may affect the expansion algorithm such as, e.g., the input document's base IRI . Return type: void flatten Flattens the given input according to the steps in the Flattening Algorithm . The input must be flattened and returned if there are no errors. If the flattening fails, an appropriate exception must be thrown. It is still being discussed if the flatten() method should be added or not. See ISSUE-109 . Parameter Type Nullable Optional Description input object or object[] or URL An optional external context to use additionally to the context embedded in input when expanding the input .
callback JsonLdCallback A callback that is called when processing is complete on the given input .
options JsonLdOptions A set of options that may affect the expansion algorithm such as, e.g., the input document's base IRI .
Return type: void
frame Frames the given input using the frame according to the steps in the Framing Algorithm . The input is used to build the framed output and is returned if there are no errors. If there are no matches for the frame, null must be returned. Exceptions must be thrown if there are errors. Parameter Type Nullable Optional Description input object or object[] or URL ✘ ✘ The JSON-LD object or array of JSON-LD objects to perform the framing upon or an IRI referencing the JSON-LD document to frame. frame object or URL ✘ ✘ The frame to use when re-arranging the data of input ; either in the form of an JSON object or as IRI . callback JsonLdCallback ✘ ✘ A callback that is called when processing is complete on the given input . options JsonLdOptions ✘ ✔ A set of options that may affect the framing algorithm such as, e.g., the input document's base IRI . Return type: void
fromRDF
Creates a JSON-LD document given an set of Quads .
Parameter Type Nullable Optional Description
input Quad [] An A dataset represented as an array of RDF quads. Quads .
callback JsonLdCallback A callback that is called when processing is complete on the given input .
options JsonLdOptions A set of options that will affect the algorithm. This includes notType , which if set to true causes the resulting document to use rdf:type as a property, instead of @type .
Return type: void
toRDF
Processes the input according to the Convert to RDF Algorithm , calling the provided callback for each Quad generated.
Parameter Type Nullable Optional Description
input object or object[] or URL The JSON-LD object or array of JSON-LD objects to convert to RDF or an a IRI URL referencing the JSON-LD document to convert to RDF.
callback QuadCallback A callback that is called when a Quad is created from processing the given input .
options JsonLdOptions A set of options that may affect the conversion to RDF such as, e.g., the input document's base IRI .
Return type: void

2.2 3.3 Callbacks

2.2.1 3.3.1 JsonLdCallback

The JsonLdCallback is used to return a processed JSON-LD representation as the result of processing an API method.

[NoInterfaceObject Callback]
interface JsonLdCallback {
    void jsonLd (object or object[] jsonld);
};

2.2.1.1 3.3.1.1 Methods

jsonLd
This callback is invoked when processing is complete.
Parameter Type Nullable Optional Description
jsonld ObjectOrObjectArray object or object [] The processed JSON-LD document.
Return type: void

2.2.2 3.3.2 QuadCallback

The QuadCallback is called whenever the processor generates a quad during the quad() call.

[NoInterfaceObject Callback]
interface QuadCallback {
    void quad (Quad quad);
};

2.2.2.1 3.3.2.1 Methods

quad
This callback is invoked whenever a quad is generated by the processor.
Parameter Type Nullable Optional Description
quad Quad The quad.
Return type: void

2.3 3.4 Data Structures

This section describes datatype definitions used within the JSON-LD API.

2.3.1 3.4.1 URL

The URL datatype is a string representation of an IRI .


typedef


DOMString



URL

;

This datatype indicates that the IRI is interpreted as a Universal Resource Locator identifying a document, which when parsed as JSON yields either a JSON object or array .

2.3.2 3.4.2 JsonLdOptions

The JsonLdOptions type is used to convery convert a set of options to an interface method.


typedef


object



JsonLdOptions

;

URL base
The Base IRI to use when expanding the document. This overrides the value of input if it is a URL or if it is a object or object[] .
boolean optimize
If set to true , the JSON-LD processor is allowed to optimize the output of the Compaction Algorithm to produce even compacter representations. The algorithm for compaction optimization is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different optimization algorithms.
boolean noType
If set to true , the JSON-LD processor will not use the @type property when generating the output, and will use the expanded rdf:type IRI as the property instead of @type .

The following data structures are used for representing data about RDF quads. They are used for normalization, fromRDF , and from toRDF interfaces.

2.3.3 3.4.3 Quad

The Quad interface represents an RDF Quad. See [ RDF-CONCEPTS ] definition for RDF triple , which most closely aligns to Quad .

[NoInterfaceObject]
interface Quad {
    readonly attribute Node  subject;
    readonly attribute Node  predicate;
    readonly attribute Node  object;
    readonly attribute Node? graphName;
};

2.3.3.1 3.4.3.1 Attributes

name graphName of type Node , readonly, nullable
The If present, the name associated with the Quad identifying it as a member of a named graph. If the attribute is present, it indicates that this quad is a member of a named graph associated with name . . If it is missing, the quad is a member of the default graph . .
Issue 4
This element is at risk, and may be removed.
object of type Node , readonly
The object associated with the Quad .
property predicate of type Node , readonly
The property predicate associated with the Quad . Within JSON-LD, an RDF predicate is refered to as a property
subject of type Node , readonly
The subject associated with the Quad .

2.3.4 3.4.4 Node

Node is the base class of IRI , BlankNode , and Literal . ] interface { }; 2.3.4.1 Attributes interfaceName of type DOMString , readonly Provides access to the string name of It is the current interface, normally one of " IRI " , "BlankNode" or "Literal" . This method serves to disambiguate instances of Node which are otherwise identical, such as IRI and BlankNode . nominalValue of type DOMString , readonly The nominalValue IDL representation of an Node a linked data graph is refined by each interface which extends Node node .

[NoInterfaceObject]
interface Node {
};

2.3.5 3.4.5 IRI

A node identified by that is an IRI . IRIs are defined by International Resource Identifier [ IRI ]. See [ RDF-CONCEPTS ] definition for IRI .

[NoInterfaceObject]
interface IRI : Node {
    readonly attribute DOMString value;
};

2.3.5.1 3.4.5.1 Attributes

nominalValue value of type DOMString , readonly
The IRI identifier of the node. node as a [ UNICODE ] string.

2.3.6 3.4.6 Blank Node

A BlankNode node is in the linked data graph that does not contain a reference to an unnamed resource (one for which an IRI may de-reference-able identifier because it is either ephemeral in nature or does not contain information that needs to be known), and may be used in a linked to from outside of the linked data graph . A blank node is assigned an identifier starting with the prefix Quad _: as a and an implementation dependent, auto-generated suffix that is unique reference to that unnamed node. See [ RDF-CONCEPTS ] definition for all information associated with the particular blank node . node.

[NoInterfaceObject]
interface BlankNode : Node {
    readonly attribute DOMString identifier;
};

2.3.6.1 3.4.6.1 Attributes

nominalValue identifier of type DOMString , readonly
The temporary identifier of the BlankNode blank node . The nominalValue identifier must not be relied upon in any way between two separate processing runs of the same document or with a different document.
Note

Developers and authors must not assume that the nominalValue value of a BlankNode blank node will remain the same between two processing runs. BlankNode nominalValues values are only valid for the most recent processing run on the document. BlankNodes BlankNode nominalValues values will often be generated differently by different processors.

Note

Implementers must ensure that BlankNode nominalValues values are unique within the current environment, two BlankNodes are considered equal if, and only if, their nominalValues values are strictly equal.

2.3.7 3.4.7 Literal

Literals represent values such as numbers, dates and strings in RDF data. A Literal is comprised of three attributes:

  • a lexical representation form of the nominalValue value
  • an optional language represented by a string token tag
  • an optional a datatype specified by an IRI

Literals representing plain text in a natural language may have a language attribute tag specified by a text string token, as specified in [ BCP47 ], normalized to lowercase (e.g., 'en' , 'fr' , 'en-gb' ). They may also have a datatype attribute such as xsd:string . If unspecified, the datatype defaults to xsd:string .

Literals representing values with a specific datatype, such as the integer 72, may have a datatype attribute specified in the form of a IRI (e.g., <http://www.w3.org/2001/XMLSchema#integer> xsd:integer ).

See[ RDF-CONCEPTS ] definition for literal .

[NoInterfaceObject]
interface Literal : Node {
    readonly attribute DOMString  value;
    readonly attribute DOMString? language;
    readonly attribute IRI?       datatype;
};

2.3.7.1 3.4.7.1 Attributes

datatype of type IRI , readonly, nullable
An optional datatype identified by a IRI .
language of type DOMString , readonly, nullable
An optional language string tag as defined in [ BCP47 ], normalized to lowercase.
nominalValue value of type DOMString , readonly
The lexical representation form of the Literals Literal's value.

3. 4. Algorithms

All algorithms described in this section are intended to operate on language-native data structures. That is, the serialization to a text-based JSON document isn't required as input or output to any of these algorithms and language-native data structures must be used where applicable.

3.1 Syntax Tokens and Keywords JSON-LD specifies a number of syntax tokens and keyword s that are using in all algorithms described in this section: @context Used to set the local context . @id Sets the active subject. @language Used to specify the language for a literal. @type Used to set the type of the active subject or the datatype of a literal. @value Used to specify the value of a literal. @container Used to set the container of a particular value. @list Used to express an ordered set of data. @set Used to express an unordered set of data. @graph Used to explicitly express a linked data graph . : The separator for JSON keys and values that use compact IRIs . @default Used in Framing to set the default value for an output property when the framed subject definition does not include such a property. @explicit Used in Framing to override the value of explicit inclusion flag within a specific frame. @omitDefault Used in Framing to override the value of omit default flag within a specific frame. @embed Used in Framing to override the value of object embed flag within a specific frame. @null Used in Framing when a value of null should be returned, which would otherwise be removed when Compacting . All JSON-LD tokens and keywords are case-sensitive.

3.2 4.1 Algorithm Terms

initial context
a context that is specified to the algorithm before processing begins. The contents of the initial context is defined in Appendix B A .
active subject
the currently active subject that the processor should use when processing.
active property
the currently active property that the processor should use when processing. The active property is represented in the original lexical form, which is used for finding coercion mappings in the active context .
active object
the currently active object that the processor should use when processing.
active context
a context that is used to resolve term s while the processing algorithm is running. The active context is the context contained within the processor state .
blank node a blank node is a resource which is neither an IRI nor a literal . Blank nodes may be named or unnamed and often take on the role of a variable that may represent either an IRI or a literal . compact IRI
a compact IRI is has the form of prefix and suffix and is used as a way of expressing an IRI without needing to define separate term definitions for each IRI contained within a common vocabulary identified by prefix .
local context
a context that is specified within a JSON object , specified via the @context keyword .
processor state
the processor state , which includes the active context , active subject , and active property . The processor state is managed as a stack with elements from the previous processor state copied into a new processor state when entering a new JSON object .
JSON-LD input
The JSON-LD data structure that is provided as input to the algorithm.
JSON-LD output
The JSON-LD data structure that is produced as output by the algorithm.
term
A term is a short word defined in a context that may be expanded to an IRI
prefix
A prefix is a term that expands to a vocabulary base IRI . It is typically used along with a suffix to form a compact IRI to create an IRI within a vocabulary.
plain language-tagged literal
A plain language-tagged literal is a literal without a datatype, possibly including a language. See languaged-tagged literal in [ RDF-CONCEPTS ].
typed literal
A typed literal is a literal with an associated IRI which indicates the literal's datatype. See languaged-tagged literal in [ RDF-CONCEPTS ].

3.3 4.2 Context Processing

Processing of JSON-LD data structure is managed recursively. During processing, each rule is applied using information provided by the active context . Processing begins by pushing a new processor state onto the processor state stack and initializing the active context with the initial context . If a local context is encountered, information from the local context is merged into the active context .

The active context is used for expanding properties and values of a JSON object (or elements of an array) using a term mapping . It is also used to maintain coercion mapping s from terms to datatypes, language mapping s from terms to language codes, and list mapping s and set mapping s for terms. Processors must use the lexical form of the property when creating a mapping, as lookup is performed on lexical representations, forms, not expanded IRI representations.

A local context is identified within a JSON object having a @context property with a string , array or a JSON object value. When processing a local context , special processing rules apply:

  1. Create a new, empty local context .
  2. Let context be the value of @context
    1. If context equals null , reset the active context to the initial context .
    2. If context is an array , process each element as context in order by starting at Step 2.1 .
    3. If context is a string , it must have a lexical form of absolute IRI .
      1. Dereference context .
      2. If the resulting document is a JSON document, extract the top-level @context element using the JSON Pointer "/@context" as described in [ JSON-POINTER ]. Set context to the extracted content and process it by starting at Step 2.1 .
    4. If context is a JSON object , perform the following steps:
      1. If context has a @language property, it must have a value of a simple string or null . Add the language to the local context .
      2. Otherwise, for each property in context perform the following steps:
        1. If the property's value is a simple string , determine the IRI mapping value by performing IRI Expansion on the associated value. If the result of the IRI mapping is an absolute IRI , merge the property into the local context term mapping , unless the property is a JSON-LD keyword , in which case throw an exception.
        2. Otherwise, if the property's value is null remove mapping, coercion, container and language information associated with property from the local context .
        3. Otherwise, the property 's value must be a JSON object .
          1. If the property is a JSON-LD keyword and the value has @id , @language or @type properties, throw an exception.
            Issue 5
            Undecided if @type or @graph can take a @container with @set .
          2. If the property has the form of term , its value must have an @id property with a string value which must have the form of a term , compact IRI , or absolute IRI . Determine the IRI mapping by performing IRI Expansion on the associated value. If the result of the IRI mapping is an absolute IRI , merge the property into the local context term mapping .
          3. If the property has the form of of a compact IRI or absolute IRI , the value may have a @id property with a string value which must have the form of a term , compact IRI , or absolute IRI . Determine the IRI mapping by performing IRI Expansion on the associated value. If the result of the IRI mapping is an absolute IRI , merge the property into the local context term mapping .
          4. If the value has a @type property, its value must have the form of a term , compact IRI , absolute IRI , or the keyword @id . Determine the IRI by performing IRI Expansion on the associated value. If the result of the IRI mapping is an absolute IRI or @id , merge into the local context coercion mapping using the lexical value of the property .
          5. If the value has a @container property, its value must be @list or @set . Merge the list mapping or set mapping into the local context using the lexical value of the property .
          6. If the value has a @language property but no @type property, the value of the @language property must be a string or null . Merge the language mapping into the local context using the lexical value of the property .
        4. Merge the local context into the active context .
        5. Repeat Step 2.4.2 until no entries are added to the local context .
Note

It can be difficult to distinguish between a compact IRI and an absolute IRI , as a compact IRI may seem to be a valid IRI scheme . When performing repeated IRI expansion, a term used as a prefix may not have a valid mapping due to dependencies in resolving term definitions. By continuing Step 2.3.2 until no changes are made, mappings to IRIs created using an undefined term prefix will eventually resolve to absolute IRI s.

Issue 6

Issue 43 concerns performing IRI expansion in the key position of a context definition.

3.4 4.3 IRI Expansion

Keys and some values are evaluated to produce an IRI . This section defines an algorithm for transforming a value representing an IRI into an actual IRI .

IRI s may be represented as an absolute IRI , a term or a compact IRI .

An absolute IRI is defined in [ RFC3987 ] containing a scheme along with path and optional query and fragment segments. A relative IRI is an IRI that is relative some other absolute IRI ; in the case of JSON-LD this is the base location of the document.

The algorithm for generating an IRI is:

  1. If the active context contains a term mapping for the value using a case-sensitive comparison, use the mapped value as an IRI .
  2. Otherwise, split the value into a prefix and suffix from the first occurrence of ':'.
  3. If the prefix is a '_' (underscore), the value represents a named blank node .
  4. If the active context contains a term mapping for prefix using a case-sensitive comparison, and suffix does not does not begin with '//' (i.e., it does not match a hier-part including authority (as defined in [ RFC3986 ]), generate an IRI by prepending the mapped prefix to the (possibly empty) suffix using textual concatenation. Note that an empty suffix and no suffix (meaning the value contains no ':' string at all) are treated equivalently.
  5. Otherwise, use the value directly as an IRI .

Note

Previous versions of this specification used @base and @vocab to define IRI prefixes used to resolve relative IRIs . It was determined that this added too much complexity, but the issue can be re-examined in the future based on community input.

3.5 4.4 IRI Compaction

Some keys and values are expressed using IRI s. This section defines an algorithm for transforming an IRI ( iri ) to a term or compact IRI using the term s specified in the active context using an optional value .

3.5.1 4.4.1 IRI Compaction Algorithm

The algorithm for generating a compact IRI is:

  1. Create an empty list of terms terms that will be populated with term s that are ranked according to how closely they match value . Initialize highest rank to 0 , and set a flag list container to false .
  2. For each term in the active context :
    1. If the term 's IRI is not a complete match against iri , continue to the next term .
    2. If value is a JSON object containing only the property @list :
      1. If term has a @container set to @set , continue to the next term .
      2. If list container is true and term does not have a container set to @list , continue to the next term .
    3. Otherwise, if term has a container set to @list , continue to the next term .
    4. Set rank to the term rank of value by passing passing term , value , and active context to the Term Rank Algorithm .
    5. If rank is greater than 0 :
      1. If term has a container set to @set , then add 1 to rank .
      2. If value is a JSON object containing only the property @list and list container is false and term has a container set to @list , then set list container to true , clear terms , set highest rank to rank , and add term to terms .
      3. Otherwise, if rank is greater than or equal to highest rank :
        1. If rank is greater than highest rank , clear terms and set highest rank to rank .
        2. Add term to terms .
  3. If terms is empty, add a compact IRI representation of iri for each term in the active context which maps to an IRI which is a prefix for iri where the resulting compact IRI is not a term in the active context . The resulting compact IRI is the term associated with the partially matched IRI in the active context concatenated with a colon (:) character and the unmatched part of iri .
  4. If terms is empty, return iri .
  5. Otherwise, return the shortest and lexicographically least value in terms .

3.5.2 4.4.2 Term Rank Algorithm

When selecting among multiple possible terms for a given property, it may be that multiple terms are defined with the same IRI , but differ in @type , @container or @language . The purpose of this algorithm is to take a term and a value and give it a term rank . The selection can then be based, partly, on the term having the highest term rank .

Given a term term , value , and active context determine the term rank using the following steps:

  1. If value is null , term rank is 3 .
  2. Otherwise, if value is a JSON object containing only the property @list :
    1. If the @list property is an empty array, if term has @container set to @list , term rank is 1 , otherwise 0 .
    2. Otherwise, return the sum of the term rank s for every entry in the list.
  3. Otherwise, value must be a subject definition , subject reference , or a JSON object having a @value .
    1. If value has a @value property:
      1. If value has a @type property matching a @type coercion for term , term rank is 3 , otherwise if term has no @type coercion and no @language , term rank is 1 , otherwise 0 .
      2. Otherwise, if @value is not a string , if term has no @type or @language it is 2 , otherwise 1 .
      3. Otherwise, if value has no @language property, if term has @language null , or term has no @type or @language and the active context has no @language , term rank is 3 , otherwise 0 .
      4. Otherwise, if value has a @language property matching a @language definition for term (or term has no @type or @language definition and @language in the active context matches the value @language ), term rank is 3 , otherwise if term has no @type coercion and no @language , term rank is 1 , otherwise 0 .
    2. Otherwise, if term has @type coerced to @id , term rank is 3 , otherwise if term has no @type coercion and no @language , term rank is 1 , otherwise 0 .
  4. Return term rank .

3.6 4.5 Value Expansion

Some values in JSON-LD can be expressed in a compact form. These values are required to be expanded at times when processing JSON-LD documents.

The algorithm for expanding a value takes an active property and active context . It is implemented as follows:

  1. If value is null , the value is already expanded.
  2. If active property is @graph or the target of an @id coercion, expand the value into an object with a key-value pair where the key is @id and the value is the expanded IRI according to the IRI Expansion rules.
  3. Otherwise, if active property is not a keyword , then expand value into an object:
    1. Set the first key-value pair to @value and the unexpanded value .
    2. If the active property is the target of typed literal coercion, set the second key-value pair to @type and the associated coercion datatype expanded according to the IRI Expansion rules.
    3. Otherwise, if the active property is the target of language tagging, set the second key-value pair to @language and value of the language tagging from the active context .
  4. Otherwise, value is already expanded.

3.7 4.6 Value Compaction

Some values, such as IRIs and typed literals , may be expressed in an expanded form in JSON-LD. These values are required to be compacted at times when processing JSON-LD documents.

The algorithm for compacting an expanded value value takes an active property and active context . It is implemented as follows:

  1. If value only has one property, property and the active context has no default language, then the compacted value is the value of @value .
  2. Otherwise, if active property is @graph , the compacted value is the value associated with the @id key, processed according to the IRI Compaction steps.
  3. Otherwise, if the active context contains a coercion target for the key that matches the expression of the value, compact the value using the following steps:
    1. If the coercion target is an @id , the compacted value is the value associated with the @id key, processed according to the IRI Compaction steps.
    2. If the coercion target is a typed literal , the compacted value is the value associated with the @value key.
  4. Otherwise, if value contains an @id key, the compacted value is value with the value of @id processed according to the IRI Compaction steps.
  5. Otherwise, if the active context contains a @language , which matches the @language of the value, or the value has only a @value key, the compacted value is the value associated with the @value key.
  6. Otherwise, if the value contains a @type key, the compacted value is value with the @type value processed according to the IRI Compaction steps.
  7. Otherwise, the value is not modified.
3.8 Generate Blank Node Identifier This algorithm is used by the Framing Algorithm and Convert From RDF Algorithm to deterministicly name blank node identifiers. It uses a identifier map and prefix and takes a possibly null identifier and returns a new identifier based on prefix . The variable next identifier is initialized to prefix appended with 0 . If the old identifier is not null and is in identifier map return the mapped identifier. Otherwise, if old identifier is not null, create a new entry in identifier map initialized to the current value of next identifier . Increment next identifier by adding one to the integer suffix. Return the mapped identifier. Otherwise, increment next identifier by adding one to the integer suffix and return its original value.

3.9 4.7 Expansion

Expansion is the process of taking a JSON-LD document and applying a context such that all IRI , datatypes, and literal values are expanded so that the context is no longer necessary. JSON-LD document expansion is typically used as a part of Framing . other JSON-LD API methods.

For example, assume the following JSON-LD input document:

{
Example 13
{
   "@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/"
}

Running the JSON-LD Expansion algorithm against the JSON-LD input document provided above would result in the following output:

{
Example 14
{
   "http://xmlns.com/foaf/0.1/name": "Manu Sporny",
   "http://xmlns.com/foaf/0.1/homepage": {
      "@id": "http://manu.sporny.org/"
   }
}

3.9.1 4.7.1 Expansion Algorithm

The algorithm takes three input variables: an active context , an active property , and an element to be expanded. To begin, the active context is set to the result of performing, Context Processing on the passed context , or to the initial context if context is null , active property is set to null , and element is set to the JSON-LD input .

  1. If element is an array , process each entry in element recursively using this algorithm, passing copies of the active context and active property . If has a @container set to @list and any entry in element is an array , or is a JSON object containing a @list property, throw an exception, as lists of lists are not allowed. If the expanded entry is null, drop it. If it's an array, merge its entries with element 's entries.
  2. Otherwise, if element is an object
    1. If element has a @context property, update the active context according to the steps outlined in Context Processing and remove the @context property.
    2. Then, proceed and process each property and value in element as follows:
      1. Remove property from element , expand property according to the steps outlined in IRI Expansion . Set the active property to the original un-expanded property if property is not a keyword .
      2. If property does not expand to a keyword or an absolute IRI (i.e., it doesn't contain a colon), continue with the next property from element .
      3. If value is null and property is not @value , continue with the next property from element .
      4. If the property is @id the value must be a string . Expand the value according to IRI Expansion .
      5. Otherwise, if the property is @type :
        1. If value is a string , expand according to IRI Expansion .
        2. Otherwise, if value is a subject reference , the expanded value is the result of performing IRI Expansion on the value of @id .
        3. Otherwise, if value is a JSON Object , it must be empty (used for Framing ).
        4. Otherwise, if value is an array , all elements must be either a string or subject reference . Expand value for each of its entries using the previous three steps.
      6. Otherwise, if the property is @value or @language the value must not be a JSON object or an array .
      7. Otherwise, if the property is @list or @set expand value recursively using this algorithm, passing copies of the active context and active property . If the expanded value is not an array , convert it to an array . If property is @list and any entry in value is a JSON object containing an @list property, throw an exception, as lists of lists are not supported.
      8. Otherwise, expand value recursively using this algorithm, passing copies of the active context and active property .
      9. If property is not a keyword and active property has a @container @list and the expanded value is not null , convert value to an object with an @list property whose value is set to value (unless value is already in that form).
      10. Convert value to array form unless value is null or property is @id , @type , @value , or @language .
      11. If value is not null , either merge value into an existing property property of element or create a new property property with value as value.
    3. If the processed element has an @value property
      1. element must not have more than one other property, which can either be @language or @type with a string value.
      2. if the value of @value equals null , replace element with the value of @value .
    4. Otherwise, if element has an @type property and its value is not in the form of an array , convert it to an array .
    5. If element has an @set or @list property, it must be the only property. Set element to the value of @set ; leave @list untouched.
    6. If element has just a @language property, set element to null .
  3. Otherwise, expand element according to the Value Expansion rules, passing copies of the active context and active property .

If, after the algorithm outlined above is run, the resulting element is an JSON object with just a @graph property, element is set to the value of @graph 's value. Finally, if element is a JSON object , it is wrapped into an array .

3.10 4.8 Compaction

Compaction is the process of taking a JSON-LD document and applying a context such that the most compact form of the document is generated. JSON is typically expressed in a very compact, key-value format. That is, full IRIs are rarely used as keys. At times, a JSON-LD document may be received that is not in its most compact form. JSON-LD, via the API, provides a way to compact a JSON-LD document.

For example, assume the following JSON-LD input document:

{
Example 15
{
  "http://xmlns.com/foaf/0.1/name": "Manu Sporny",
  "http://xmlns.com/foaf/0.1/homepage": {
    "@id": "http://manu.sporny.org/"
  }
}

Additionally, assume the following developer-supplied JSON-LD context:

{
Example 16
{
  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  }
}

Running the JSON-LD Compaction algorithm given the context supplied above against the JSON-LD input document provided above would result in the following output:

{
Example 17
{
  "@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/"
}

The compaction algorithm also enables the developer to map any expanded format into an application-specific compacted format. While the context provided above mapped http://xmlns.com/foaf/0.1/name to name , it could have also mapped it to any arbitrary string provided by the developer.

3.10.1 4.8.1 Compaction Algorithm

The algorithm takes three input variables: an active context , an active property , and an element to be compacted. To begin, the active context is set to the result of performing Context Processing on the passed context , active property is set to null , and element is set to the result of performing the Expansion Algorithm on the JSON-LD input . This removes any existing context to allow the given active context to be cleanly applied.

  1. If element is an array , process each entry in element recursively using this algorithm, passing a copy of the active context and the active property . If element has a single item, the compacted value is that item; otherwise the compacted value is element .
  2. Otherwise, if element is an object:
    1. If element has an @value property or element is a subject reference , return the result of performing Value Compaction on element using active property .
    2. Otherwise, if the active property has a @container mapping to @list and element has a corresponding @list property, recursively compact that property's value passing a copy of the active context and the active property ensuring that the result is an array and removing null values. Return either the result as an array, as an object with a key of @list (or appropriate alias from active context ).
    3. Otherwise, construct output as a new JSON object used for returning the result of compacting element . For each property and value in element:
      1. If property is @id or @type
        1. Set active property to the result of performing IRI Compaction on property .
        2. If value is a string , the compacted value is the result of performing IRI Compaction on value .
        3. Otherwise, value must be an array . Perform IRI Compaction on every entry of value . If value contains just one entry, value is set to that entry.
        4. Add active property and the expanded value to output .
      2. Otherwise, value must be an array .
      3. If value is empty:
        1. Set active property to the result of performing IRI Compaction on property .
        2. Create an entry in output for active property and value .
      4. For each item in value :
        1. Set active property to the result of performing IRI Compaction for property and item using the active context .
        2. Compact item by recursively performing this algorithm passing a copy of the active context and the active property .
        3. If an entry already exists in output for active property , convert it to an array if necessary, and append the compacted value .
        4. Otherwise, if the compacted value is not an array and active property has a @container mapping to @set , create an entry in output for active property and value as an array .
        5. Otherwise, create an entry in output for active property and value .
  3. Otherwise, return element as the compacted element .
    Issue 7
    Perhaps this should also call Value Compaction on native types and strings, which could consolodate consolidate potential transformation in one place.

If, after the algorithm outlined above is run, the resulting element is an array , put element into the @graph property of a new JSON object and then set element to that JSON object . Finally, add a @context property to element and set it to the initially passed context .

3.11 Framing JSON-LD Framing allows developers to query by example and force a specific tree layout to a JSON-LD document. A JSON-LD document is a representation of a directed graph. A single directed graph can have many different serializations, each expressing exactly the same information. Developers typically work with trees, represented as JSON object s. While mapping a graph to a tree can be done, the layout of the end result must be specified in advance. A Frame can be used by a developer on a JSON-LD document to specify a deterministic layout for a graph. Framing is the process of taking a JSON-LD document, which expresses a graph of information, and applying a specific graph layout (called a Frame ). Framing makes use of the Subject Map Generation algorithm to place each object defined in the JSON-LD document into a flat list of objects, allowing them to be operated upon by the framing algorithm. 3.11.1 Framing Algorithm Terms input frame the initial frame provided to the framing algorithm. framing context a context containing a map of embeds , the object embed flag , the explicit inclusion flag and the omit default flag . map of embeds a map that tracks if a subject is to be embedded in the output of the Framing Algorithm ; it maps a subject @id to a parent JSON object and property or parent array. object embed flag a flag specifying that objects should be directly embedded in the output, instead of being referred to by their IRI . explicit inclusion flag a flag specifying that for properties to be included in the output, they must be explicitly declared in the framing context . omit default flag a flag specifying that properties that are missing from the JSON-LD input , but present in the input frame should be omitted from the output. map of flattened subjects a map of subjects that is the result of the Subject Map Generation algorithm . 3.11.2 Framing Algorithm This algorithm is a work in progress. Presently, it only works for documents without named graphs. The framing algorithm takes an JSON-LD input ( expanded input ) and an input frame ( expanded frame ) that have been expanded according to the Expansion Algorithm , and a number of options and produces JSON-LD output . Create framing context using null for the map of embeds , the object embed flag set to true , the explicit inclusion flag set to false , and the omit default flag set to false along with map of flattened subjects set to the @merged property of the result of performing the Subject Map Generation algorithm on expanded input . Also create results as an empty array . Invoke the recursive algorithm using framing context ( state ), the map of flattened subjects ( subjects ), expanded frame ( frame ), result as parent , and null as active property . The following series of steps is the recursive portion of the framing algorithm: Validate frame . Create a set of matched subjects by filtering subjects checking the map of flattened subjects against frame : If frame has a @type property containing one or more IRIs match any subject definition with a @type property including any of those IRIs . Otherwise, if frame has a @type property only a empty JSON object , matches any subject definition with a @type property, regardless of the actual values. Otherwise, match if the subject definition contains all of the non- keyword properties in frame . Get values for embedOn and explicitOn by looking in frame for the keys @embed and @explicit using the current values for object embed flag and explicit inclusion flag from state if not found. For each id and subject from the set of matched subjects, ordered by id : If the active property is null , set the map of embeds in state to an empty map. Initialize output with @id and id . Initialize embed with parent and active property to property . If embedOn is true , and id is in map of embeds from state : Set existing to the value of id in map of embeds and set embedOn to false . If existing has a parent which is an array containing a JSON object with @id equal to id , element has already been embedded and can be overwritten, so set embedOn to true . Otherwise, existing has a parent which is a subject definition . Set embedOn to true if any of the items in parent property is a subject definition or subject reference for id because the embed can be overwritten. If embedOn is true , existing is already embedded but can be overwritten, so Remove Embedded Definition for id . If embedOn is false , add output to parent by either appending to parent if it is an array , or appending to active property in parent otherwise. Otherwise: Add embed to map of embeds for id . Process each property and value in the matched subject , ordered by property : If property is a keyword , add property and a copy of value to output and continue with the next property from subject . If property is not in frame : If explicitOn is false , Embed values from subject in output using subject as element and property as active property . Continue to next property. Process each item from value as follows: If item is a JSON object with the key @list , then create a JSON object named list with the key @list and the value of an empty array. Append list to property in output . Process each listitem in the @list array as follows: If listitem is a subject reference process listitem recursively using this algorithm passing a new map of subjects that contains the @id of listitem as the key and the subject definition from the original map of flattened subjects as the value. Pass the first value from frame for property as frame , list as parent , and @list as active property . Otherwise, append a copy of listitem to @list in list . If item is a subject reference process item recursively using this algorithm passing a new map as subjects that contains the @id of item as the key and the subject definition from the original map of flattened subjects as the value. Pass the first value from frame for property as frame , output as parent , and property as active property . Passing a subject reference doesn't work if this map is used recursively. Presently pass subject definition from original map of flattened subjects . Otherwise, append a copy of item to active property in output . Process each property and value in frame , where property is not a keyword , ordered by property : Set property frame to the first item in value or a newly created JSON object if value is empty. Skip to the next property in frame if property is in output or if property frame contains @omitDefault which is true or if it does not contain @omitDefault but the value of omit default flag true . Set the value of property in output to a new JSON object with a property @preserve and a value that is a copy of the value of @default in frame if it exists, or the string @null otherwise. Add output to parent . If parent is an array , append output , otherwise append output to active property in parent . At the completion of the recursive algorithm, results will contain the top-level subject definition s. The final two steps of the framing algorithm require results to be compacted according to the Compaction Algorithm by using the context provided in the input frame . If the frame has no context, compaction is performed with an empty context (not a null context). The compaction result must use the @graph keyword at the top-level, even if the context is empty or if there is only one element to put in the @graph array. Subsequently, replace all key-value pairs where the key is @preserve with the value from the key-pair. If the value from the key-pair is @null , replace the value with null . If, after replacement, an array contains only the value null remove the value, leaving an empty array. The resulting value is the final JSON-LD output . The algorithm needs to be updated to consider @graph . See ISSUE-118 for details. 3.11.3 Subject Map Generation The Subject Map Generation algorithm takes as input an expanded JSON-LD document and results in a JSON object subjectMap holding a flat representation of the graphs and nodes represented in the document. All nodes that are not uniquely identified by an IRI get assigned a (new) blank node identifier. The resulting subjectMap document will have a property for every graph in the document whose value is another object with a property for every node represented in the document. While the default graph is stored under the @default property and the merged graph under the @merged property, all other graphs are stored under their respective IRIs . The algorithm takes as input the expanded JSON-LD document as element , the initially empty subjectMap , @default as graph , and null as list . If element is an array, process each entry in element recursively, using this algorithm and return. If element is not a JSON object or if it has a @value property, then if list is not null , append element to list and return. If the @id property exists and is an IRI , set id to its value, otherwise set it to a blank node identifer created by the Generate Blank Node Identifier algorithm. If list is not null , append a new subject reference to list using id at the value for @id . Let subjects be the value in subjectMap where the key is graph ; if no such value exists, insert a new JSON object for the key graph . If id is not in subjects , create a new JSON object subject with id as the value for @id . Let subject be the value of id in subjects . For each property that is not @id and each value in element ordered by property : If property is @graph , recursively call this algorithm passing value for element , subjectMap , null for list and if graph is merged use graph , otherwise use id for graph and then continue. If property is not @type and is a keyword, merge property and value into subject and then continue. For each value v in the array value : If v is a subject definition or subject reference : If the property @id is not an IRI or it does not exist, map v to a new blank node identifier to avoid collisions. If one does not already exist, add a subject reference for v into subject for property . Recursively call this algorithm passing v for value , subjectMap , graph , and null for list . Otherwise if v has the property @list then recursively call this algorithm with the value of @list as element , subjectMap , graph , and a new array flattenedList as list . Create a new JSON object with the property @list set to flattenedList and add it to subject for property . Otherwise, if property is @type and v is not an IRI , generate a new blank node identifier and add it to subject for property . Otherwise, add v to subject for property . After the above outlined algorithm has been executed, the subject map for all graphs including the default graph are contained in subjectMap . To also create the subject map for the merged graph, execute the algorithm again, but pass merged for graph . 3.11.4 Remove Embedded Definition This algorithm replaces an already embedded subject definition with a subject reference . It then recursively removes any entries in the map of embeds that had the removed subject definition in their parent chain. About as clear as mud The algorithm is invoked with a framing context and subject id id . Find embed from map of embeds for id . Let parent and property be from embed . If parent is an array, replace the subject definition that matches id with a subject reference . If parent is a JSON object , replace the subject definition for property that matches id with a subject reference . Remove dependents for id in map of embeds by scanning the map for entries with parent that have an @id of id , removing that definition from the map, and then removing the dependents for the parent id recursively by repeating this step. This step will terminate when there are no more embed entries containing the removed subject definition 's @id in their parent chain. 3.11.5 Embed Values This algorithm recursively embeds property values in subject definition output , given a framing context , input subject definition element , active property , and output . For each item in active property of element : If item is a JSON object with the key @list , then create a new JSON object with a key @list and a value of an empty array and add it to output , appending if output is an array, and appending to active property otherwise. Recursively call this algorithm passing item as element , @list as active property , and the new array as output . Continue to the next item . If item is a subject reference : If map of embeds does not contain an entry for the @id of item : Initialize embed with output as parent and active property as property and add to map of embeds . Initialize a new subject definition o to act as the embedded subject definition . For each property and value in the expanded definition for item in subjects : Add property and a copy of value to o if property is a keyword . Otherwise, recursively call this algorithm passing value as element , property as active property and o as output . Set item to o . If output is an array , append a copy of item , otherwise append a copy of item to active property in output . 3.12 Flattening Flattening is the process of taking a JSON-LD document, expanding it, labeling all unlabeled nodes with a blank node identifier, and returning an array of the nodes defined in the document. It is still being discussed if the flatten() method should be added or not. See ISSUE-109 . For example, assume the following JSON-LD input document: { "@context": { "name": "http://xmlns.com/foaf/0.1/name", "knows": "foaf:knows" }, "@id": "http://example.com/markus", "name": "Markus Lanthaler", "knows": { "name": "Manu Sporny" } } Running the JSON-LD Flattening algorithm for the merged graph ( @merged ) against the JSON-LD input document provided above would result in the following output: [ { "@id": "http://example.com/markus", "foaf:knows": [ { "@id": "_:t0" } ], "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ] }, { "@id": "_:t0", "http://xmlns.com/foaf/0.1/name": [ { "@value": "Manu Sporny" } ] } ] 3.12.1 Flattening Algorithm The algorithm takes two input variables, an element to flatten and the graph for which the node definitions should be returned. If graph is not set, it will default to @merged which represents the result of merging all graphs including the default graph ( @default ). Expand element according the Expansion Algorithm . Generate a subjectMap according the Subject Map Generation Algorithm . Initialize an empty array result . If subjectMap has no property graph , return result , otherwise set definitions to its value. Foreach property and value of of definitions : Add value to result . Return result .

3.13 4.9 RDF Conversion

A JSON-LD document may be converted between other RDF-compatible document formats using the algorithms specified in this section.

The JSON-LD Processing Model describes processing rules for extracting RDF from a JSON-LD document, and for transforming an array of Quad retrieved by processing another serialization format into JSON-LD. Note that many uses of JSON-LD may not require generation of RDF.

The processing algorithms described in this section are provided in order to demonstrate how one might implement a JSON-LD to RDF processor. Conformant implementations are only required to produce the same type and number of quads during the output process and are not required to implement the algorithm exactly as described.

3.13.1 4.9.1 Overview

This section is non-normative.

JSON-LD is intended to have an easy to parse grammar that closely models existing practice in using JSON for describing object representations. This allows the use of existing libraries for parsing JSON.

As with other grammars used for describing Linked Data , a key concept is that of a resource . Resources node in a linked data graph . Nodes may be of three basic types: types. The first is the IRI , representing IRIs which is used to refer to node for describing externally named entities, BlankNode s in other linked data graph s. The second is the blank node , resources which are nodes for which an external name does not exist, or is not known, and known. The third is a Literal , which describe terminal entities express values such as strings, dates and other representations information having a lexical representation form, possibly including an explicit language or datatype.

Data described with JSON-LD may be considered to be the representation of a graph made up of subject and object resource nodes s related via a property resource node . However, specific Specific implementations may also choose to operate on the document as a normal JSON description of objects having attributes. Both approaches are valid ways to interact with JSON-LD documents.

3.13.2 4.9.2 RDF Conversion Algorithm Terms Parsing Examples

graph name

A This section is non-normative.

The following examples show simple transformations of JSON-LD documents to Turtle [ IRI TURTLE-TR ].

The first example uses a simple document containing a simple FOAF profile:

Example 18
{
  "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
  "@id": "http://greggkellogg.net/foaf#me",
  "@type": "foaf:Person",
  "foaf:name": "Gregg Kellogg",
  "foaf:knows": {
    "@type": "foaf:Person",
    "foaf:name": "Manu Sporny"
  }
}
or

This translates fairly directly to a similar Turtle document:

Example 19
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
<http://greggkellogg.net/foaf#me> a foaf:Person;
  foaf:name "Gregg Kellogg";
foaf:knows
[
a
foaf:Person;
foaf:name
"Manu
Sporny"].

The actual parsing steps first require that the JSON-LD document be expanded, to eliminate the BlankNode @context :

Example 20
[{
  "@id": "http://greggkellogg.net/foaf#me",
  "@type": ["http://xmlns.com/foaf/0.1/Person"],
  "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
  "http://xmlns.com/foaf/0.1/knows": [{
    "@type": ["http://xmlns.com/foaf/0.1/Person"],
    "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
  }]
}]
used

The process of translating this to identify quads belonging RDF then operates over each subject definition to find a subject, each property to find an RDF named graph . predicate , and each value of that property to find an object . In this case, each property has just a single object: foaf:name identifies a literal , and foaf:knows identifies a second subject definition similar to Turtle's blankNodePropertyList .

After expansion, JSON-LD numbers , booleans , typed- and language-tagged- literals , and IRIs become explicit, and can be directly transformed into their RDF representations.

Example 21
[{
  "@id": "http://greggkellogg.net/foaf#me",
  "@type": ["http://xmlns.com/foaf/0.1/Person"],
  "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
  "http://xmlns.com/foaf/0.1/currentProject": [{"@id": "http://json-ld.org/"}],
  "http://xmlns.com/foaf/0.1/birthday": [{
    "@value": "1957-02-27",
    "@type": "http://www.w3.org/2001/XMLSchema#date"
  }],
  "http://xmlns.com/foaf/0.1/knows": [{
    "@type": ["http://xmlns.com/foaf/0.1/Person"],
    "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
  }]
}]

Translates to:

Example 22
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
<http://greggkellogg.net/foaf#me> a foaf:Person;
  foaf:name "Gregg Kellogg";
  foaf:currentProject <http://json-ld.org/>;
  foaf:birthday "1957-02-27"^^xsd:date;
foaf:knows
[
a
foaf:Person;
foaf:name
"Manu
Sporny"].

3.13.3 4.9.3 Convert to RDF Algorithm

The algorithm below is designed for in-memory implementations with random access to JSON object elements.

A conforming JSON-LD processor implementing RDF conversion must implement a processing algorithm that results in the same set of RDF Quads that the following algorithm generates:

The algorithm takes five input variables: a element to be converted, an active subject , active property and graph name . To begin, the active subject , active property and graph name are set to null , and element is set to the result of performing the Expansion Algorithm on the JSON-LD input . This removes any existing context to allow the given context to be cleanly applied.

  1. If element is a JSON object , perform the following steps:
    1. Set active object to null .
    2. If element has a @value property:
      1. If the value of @value is a number , set the active object to a typed literal using a string representation of the value as defined in the section Data Round Tripping . Set datatype to the value of the @type property if it exists, otherwise either xsd:integer or xsd:double , depending on if the value contains a fractional and/or an exponential component.
      2. Otherwise, if the value of @value is true or false , set the active object to a typed literal created from the string representation of the value. Set datatype to the value of the @type property if it exists, otherwise xsd:boolean .
      3. Otherwise, if element contains a @type property, set the active object to a typed literal .
      4. Otherwise, if element contains a @language property, set the active object to a plain language-tagged literal . If element contains
      5. Otherwise, set the active object to a typed literal using @language xsd:string property, use its value to set the language of as the plain literal. datatype.
    3. If element has a @list property the value must be an array . Process its value as a list as described in List Conversion using the return value as the active object
    4. If active object is not null :
      1. If neither active subject nor active property are null , generate a Quad representing active subject , active property , active object , and graph name .
      2. Return active object .
    5. If element has a @id property, the value must be a string , set the active subject to the previously expanded value (either a BlankNode blank node or an IRI ).
    6. Otherwise, if element does not have a @id property, set the active subject to newly generated blank node .
    7. Process each property and value in element , ordered by property , as follows:
      1. If property is @type , set the active property to rdf:type .
      2. Otherwise, if property is @graph , process value algorithm recursively, using active subject as graph name and null values for active subject and active property and then proceed to next property.
      3. Otherwise, if property is a keyword , skip this step.
      4. Otherwise, set active property to the IRI value of property .
      5. Process value recursively using this algorithm, passing copies of active subject , active property and graph name .
    8. Set active object to active subject .
  2. Otherwise, if element is an array , process each value in the array as follows, process element recursively using this algorithm, using copies of active subject , active property , and graph name .
  3. Otherwise, if element is a string , then the active property must be rdf:type so set the active object to an IRI .
  4. If any of these steps created an active object and neither active subject nor active property are null , generate a Quad using active subject , active property , active object and graph name .
  5. Return active object .

3.13.4 4.9.4 List Conversion

List Conversion is the process of taking an array of values and adding them to a newly created RDF Collection (see [ RDF-SCHEMA ]) by linking each element of the list using rdf:first and rdf:next , terminating the list with rdf:nil using the following sequence:

The algorithm is invoked with an array array , the active property and returns a value to be used as an active object in the calling location.

Note
This algorithm does not support lists containing lists.
  1. If array is empty return rdf:nil .
  2. Otherwise, generate a Quad using using the active subject , active property and a newly generated BlankNode blank node identified as first blank node .
  3. For each element in array other than the last element:
    1. Create a processor state using first blank node as the active subject , and rdf:first as the active property .
      1. Process the value starting at Step 1 .
      2. Proceed using the previous processor state .
    2. Unless this is the last element in array , generate a new BlankNode blank node identified as rest blank node , otherwise use rdf:nil .
    3. Generate a new Quad using first blank node , rdf:rest and rest blank node .
    4. Set first blank node to rest blank node .
    5. Return first blank node .

3.13.5 4.9.5 Convert from RDF Algorithm

In some cases, data exists natively in Triples or Quads form; for example, if the data was originally represented in an RDF graph or triple/quad store. This algorithm is designed to simply translate an array of Quads into a JSON-LD document.

When expanding typed literal values having a datatype of xsd:string , the @type must not be set to xsd:string and the resulting value must have only a @value property.

The conversion algorithm takes a single parameter input in the form of an array of Quad representations.

  1. Construct defaultGraph as a JSON object containing subjects and listMap ,each , each an empty JSON object .
  2. Construct graphs as a JSON object containing defaultGraph identified by an empty string .
  3. For each quad in input :
    1. Set graph to the entry in graphs identified by name , initializing it to a new entry using the mechanism described in Step 1 .
    2. If property is rdf:first , use the entry in graph.listMap indexed by subject , initializing it to a new JSON object if nesessary. Represent object in expanded form, as described in Value Expansion . Add the resulting object representation to the entry indexed by first , and skip to the next quad.
    3. If property is rdf:rest :
      1. If object is a BlankNode blank node , use the entry in graph.listMap indexed by subject , initializing it to a new JSON object if necessary. Add the nominalValue of object to the entry indexed by rest .
      2. Skip to the next quad.
    4. If name is not null , and defaultGraph.subjects does not contain an entry for name , create a new entry for name from a new JSON object with key/value pair of @id and a string representation of name .
    5. Set value as the entry from graph.subjects for subject , initializing it to a new JSON object with key/value pair of @id and a string representation of subject if necessary.
    6. If property is rdf:type and the notType option is present and not true :
      1. Append the string representation of object to the array value for the key @type , creating an entry in value if necessary.
    7. Otherwise, if object is rdf:nil :
      1. Let key be the string representation of property .
      2. Append an empty @list representation to the array value for key , creating an entry in value if necessary.
    8. Otherwise,
      1. Let key be the string representation of property and let object representation be object represented in expanded form as described in Value Expansion .
      2. If object is a BlankNode blank node , use the entry in graph.listMap indexed by object , initializing it to a new JSON object if nesessary. Add an entry for head with object representation .
      3. Append object representation to the array value for key , creating an entry in value if necessary.
  4. For each name and graph in graphs :
    1. For each subject and entry in graph where entry has both head and first keys:
      1. Set value to the value of head in entry .
      2. Remove the entry for @id in value .
      3. Add an entry to value for @list initialized to a new array containing the value of first from entry .
      4. While entry has a key for rest :
        1. Set entry to the value of graph.listMap for entry.rest .
        2. Add the value for entry.first to the list array.
  5. Create array as an empty array .
  6. For each subject and entry in defaultGraph.subjects ordered by subject :
    1. Add entry to array .
    2. If graphs has an entry for subject , add a property @graph in entry containing the ordered entries from graphs[subject].subjects .
  7. Return array as the result.

4. 5. Data Round Tripping

When coercing numbers to xsd:integer or xsd:double as it, e.g., happens during RDF Conversion , implementers must ensure that the result is a canonical lexical representation form in the form of a string . A canonical lexical representation form is a set of literals from among the valid set of literals for a datatype such that there is a one-to-one mapping between the canonical lexical representation form and a value in the value space as defined in [ XMLSCHEMA-2 XMLSCHEMA11-2 ]. ]]. In other words, every value must be converted to a deterministic string representation.

The canonical lexical representation form of an integer , i.e., a number without fractions or a number coerced to xsd:integer , is a finite-length sequence of decimal digits ( 0-9 ) with an optional leading minus sign; leading zeroes are prohibited. To convert the number in JavaScript, implementers can use the following snippet of code:

Example 23
(value).toFixed(0).toString()

The canonical lexical representation form of a double , i.e., a number with fractions or a number coerced to xsd:double , consists of a mantissa followed by the character "E", followed by an exponent. The mantissa must be a decimal number. The exponent must be an integer. Leading zeroes and a preceding plus sign ( + ) are prohibited in the exponent. If the exponent is zero, it must be indicated by E0 . For the mantissa, the preceding optional plus sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is non-zero to the left of the decimal point and at least a single digit to the right of the decimal point unless the value being represented is zero. The canonical representation for zero is 0.0E0 . To convert the number in JavaScript, implementers can use the following snippet of code:

Example 24
(value).toExponential().replace(/e\+?/,'E')

xsd:double 's value space is defined by the IEEE double-precision 64-bit floating point type [ IEEE-754-1985 ].

Note

When data such as decimals need to be normalized, JSON-LD authors should not use values that are going to undergo automatic conversion. This is due to the lossy nature of xsd:double values. Authors should instead use the expanded object form to set the canonical lexical representation form directly.

Note

When JSON-native datatypes, like number s, are type coerced, lossless data round-tripping can not be guaranted. Consider the following code example:

var myObj1 = {
Example 25
var myObj1 = {
               "@context": {
                 "number": {
                   "@id": "http://example.com/vocab#number",
                   "@type": "xsd:nonNegativeInteger"
                 }
               },
               "number" : 42
             };
// Convert the JSON-LD document to RDF; this converts 42 to a string
var jsonldText = jsonld.toRDF(myObj1, myRdfTripleCollector);
// Convert the RDF triples back to a JavaScript object
var
myObj2
=
jsonld.fromRDF(myRdfTripleCollector.getTriples());

At this point, myObj1 and myObj2 will have different values for the "number" property. myObj1 will have the number 42 , while myObj2 have an object consisting of @value set to the string "42" and @type set to the expanded value of xsd:nonNegativeInteger .

Note

Some JSON serializers, such as PHP's native implementation in some versions, backslash-escape the forward slash character. For example, the value http://example.com/ would be serialized as http:\/\/example.com\/ . This is problematic as other JSON parsers might not understand those escaping characters. There is no need to backslash-escape forward slashes in JSON-LD. To aid interoperability between JSON-LD processors, a JSON-LD serializer must not backslash-escape forward slashes.

A. IANA Considerations Initial Context

This section is non-normative. Issue 8 This section is included merely for standards community review and will be submitted to the Internet Engineering Steering Group if this specification becomes a W3C Recommendation. application/ld-frame+json Type name: application Subtype name: ld-frame+json Required parameters: None Optional parameters: None Encoding considerations: The same as the application/json MIME media type. Security considerations: Since a JSON-LD frame is intended to specify a deterministic layout for a JSON-LD graph, the serialization should not be passed through a code execution mechanism such as JavaScript's eval() function.

It is recommended that a conforming parser does not attempt to directly evaluate the JSON-LD frame and instead purely parse the input into a language-native data structure. Interoperability considerations: Not Applicable Published specification: The JSON-LD still being discussed specification. Applications that use this media type: Any programming environment that requires whether JSON-LD has the exchange of directed graphs. Implementations notion of JSON-LD have been created for JavaScript, Python, Ruby, PHP and C++. Additional information: Magic number(s): Not Applicable File extension(s): .jsonldf Macintosh file type code(s): TEXT Person & email address to contact for further information: Manu Sporny <msporny@digitalbazaar.com> Intended usage: Common Restrictions on usage: None Author(s): Manu Sporny, Gregg Kellogg, Markus Lanthaler, Dave Longley Change controller: W3C Fragment identifiers have no meaning with application/frame-ld+json resources. B. Initial Context The an initial context is defined with the following default entries: { "@context": { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": { "@type": "@id"} } } Processors or not. If JSON-LD has an initial context, it must act as if the initial context is defined in be specified external to the outer-most level when processing JSON-LD documents. Should we define other default prefixes? Syntax specification at a well-known location.

C. B. Acknowledgements

The editors would like to thank Mark Birbeck, who provided a great deal of the initial push behind the JSON-LD work via his work on RDFj, Dave Lehn and Mike Johnson who reviewed, provided feedback, and performed several implementations of the specification, and Ian Davis, who created RDF/JSON. Thanks also to Nathan Rixham, Bradley P. Allen, Kingsley Idehen, Glenn McDonald, Alexandre Passant, Danny Ayers, Ted Thibodeau Jr., Olivier Grisel, Niklas Lindström, Markus Lanthaler, Josh Mandel, Eric Prud'hommeaux, David Wood, Guus Schreiber, Pat Hayes, Sandro Hawke, and Richard Cyganiak for their input on the specification.

D. C. References

D.1 C.1 Normative references

[BCP47]
A. Phillips, Phillips; M. Davis. Tags for Identifying Languages September 2009. IETF Best Current Practice. URL: http://tools.ietf.org/rfc/bcp/bcp47.txt http://tools.ietf.org/html/bcp47
[IEEE-754-1985]
IEEE. IEEE Standard for Binary Floating-Point Arithmetic. See http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html
[IRI]
[JSON-LD]
M. Duerst, M. Suignard.
Internationalized Resource Identifiers (IRI). The JSON-LD Syntax January 2005. Internet RFC 3987. URL: http://www.ietf.org/rfc/rfc3987.txt [JSON-LD] Manu Sporny, Gregg Kellogg, Markus Lanthaler. Lanthaler Editors. World Wide Web Consortium (work in progress). 22 May 2012. Editor's Draft. This edition of the JSON-LD Syntax specification is http://json-ld.org/spec/ED/json-ld-syntax/20120522/. The latest edition of the JSON-LD Syntax Latest. W3C Editor's Draft. URL: is available at http://json-ld.org/spec/latest/json-ld-syntax/
[JSON-POINTER]
P. Bryan, Ed.
JSON Pointer Latest. P. Bryan, Ed. IETF Draft. URL: http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-01 http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-02
[RDF-CONCEPTS]
Graham Klyne; Jeremy J. Carroll.
Resource Description Framework (RDF): RDF 1.1 Concepts and Abstract Syntax. Syntax 10 February 2004. W3C Recommendation. URL: http://www.w3.org/TR/2004/REC-rdf-concepts-20040210 Richard Cyganiak, David Wood, Editors. World Wide Web Consortium (work in progress). 30 May 2012. Editor's Draft. This edition of the JSON-LD Syntax specification is http://www.w3.org/TR/2011/WD-rdf11-concepts-20110830/. The latest edition of the JSON-LD Syntax is available at http://www.w3.org/TR/rdf11-concepts/
[RDF-SCHEMA]
Dan Brickley; Ramanathan V. Guha. RDF Vocabulary Description Language 1.0: RDF Schema. 10 February 2004. W3C Recommendation. URL: http://www.w3.org/TR/2004/REC-rdf-schema-20040210
[RFC3986]
T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet RFC 3986. URL: http://www.ietf.org/rfc/rfc3986.txt
[RFC3987]
M. Dürst; M. Suignard. Internationalized Resource Identifiers (IRIs). January 2005. Internet RFC 3987. URL: http://www.ietf.org/rfc/rfc3987.txt
[RFC4627]
D. Crockford. The application/json Media Type for JavaScript Object Notation (JSON) July 2006. Internet RFC 4627. URL: http://www.ietf.org/rfc/rfc4627.txt
[WEBIDL]
Cameron McCormack.
Web IDL. Web IDL 27 September 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2011/WD-WebIDL-20110927/ Cameron McCormack, Editor. World Wide Web Consortium. 19 April 2012. Candidate Recommendataion. This edition of Web IDL is http://www.w3.org/TR/2012/CR-WebIDL-20120419/. The latest edition of Web IDL is available at http://dev.w3.org/2006/webapi/WebIDL/
[XMLSCHEMA-2]
[XMLSCHEMA11-2]
Paul V. Biron; Ashok Malhotra.
Henry S. Thompson; et al. W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes Second Edition. Datatypes. 28 October 2004. 5 April 2012. W3C Recommendation. Recommendation URL: http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/ http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/

D.2 C.2 Informative references

[ECMA-262]
ECMAScript Language Specification. December 1999. URL: http://www.ecma-international.org/publications/standards/Ecma-262.htm
[MICRODATA]
[TURTLE-TR]
Ian Hickson; et al.
Eric Prud'hommeaux, Gavin Carothers. Microdata Turtle: Terse RDF Triple Language. 04 March 2010. 09 August 2011. W3C Working Draft. URL: http://www.w3.org/TR/microdata/ [MICROFORMATS] Microformats . URL: http://microformats.org http://www.w3.org/TR/2011/WD-turtle-20110809/
[RDFA-CORE]
[UNICODE]
Shane McCarron; et al.
The Unicode Consortium. RDFa Core 1.1: Syntax and processing rules for embedding RDF through attributes. The Unicode Standard. 8 May 2012. W3C Proposed Recommendation. 2003. Defined by: The Unicode Standard, Version 4.0 (Boston, MA, Addison-Wesley, ISBN 0-321-18578-1), as updated from time to time by the publication of new versions URL: http://www.w3.org/TR/2012/PR-rdfa-core-20120508/ http://www.unicode.org/unicode/standard/versions/enumeratedversions.html