The JSON-LD API 1.0

An Application Programming Interface for the JSON-LD Syntax

Unofficial Draft 26 April 2012

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.

Status of This Document

This document is merely a public working draft of a potential specification. It has no official standing of any kind and does not represent the support or consensus of any standards organisation.

This document is an experimental work in progress.

Table of Contents

1. Introduction

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. 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 ].

Examples may contain references to existing vocabularies and use prefix es to refer to Web Vocabularies. vocabularies. The following is a list of all vocabularies and their prefix abbreviations, as used in this document:

JSON [ RFC4627 ] defines several terms which are used throughout this document:

JSON Object object
An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). 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 are separated by commas. Within JSON-LD, array order is not preserved by default, unless specific markup is provided (see Lists ). 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 characters, wrapped in double quotes, using backslash escapes. 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.
null
The use of the null value is undefined within JSON-LD. Supporting null in JSON-LD might have is used to ignore or reset values.
subject definition
A JSON object used to represent a number of advantages subject and should be evaluated. This one or more properties of that subject. A JSON object is currently an open issue . a subject definition if it does not contain 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.

  1. Linked Data is a set of documents, each containing a representation of a linked data graph.
  2. A linked data graph is an unordered labeled directed graph, where nodes are subject s or object s, and edges are properties.
  3. A subject is any node in a linked data graph with at least one outgoing edge.
  4. A subject should be labeled with an IRI (an Internationalized Resource Identifier as described in [ RFC3987 ]).
  5. An object is a node in a linked data graph with at least one incoming edge.
  6. An object may be labeled with an IRI .
  7. An object may be a subject and object at the same time.
  8. A property is an edge of the linked data graph .
  9. A property should be labeled with an IRI .
  10. An IRI that is a label in a linked data graph should be dereferencable to a Linked Data document describing the labeled subject , object or property .
  11. A literal is an object with a label that is not an IRI

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 for the expression of unlabled nodes, as most graph-based data sets on the Web contain a number of associated nodes that are not named and thus are not directly de-referenceable.

1.3 Contributing

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

2. 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.

2.1 JsonLdProcessor

]
[NoInterfaceObject]
interface JsonLdProcessor {
    void expand (object or object[] or URL input, JsonLdCallback callback, optional JsonLdOptions options);
    void compact (object or object[] or URL input, object or URL context, JsonLdCallback callback, optional JsonLdOptions options);
    void frame (object or object[] or URL input, object or URL frame, JsonLdCallback callback, optional JsonLdOptions options);
    void fromRDF (Statement[] input, JsonLdCallback callback, optional JsonLdOptions options);
    void toRDF (object or object[] or URL input, ObjectOrURL? context, StatementCallback callback, optional JsonLdOptions options);
};

2.1.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 exception must be thrown. InvalidContext There was a problem encountered loading a remote context. ProcessingError CONFLICTING_DATATYPES The target datatype specified in the coercion rule and
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 on. upon or an IRI referencing the JSON-LD document to compact.
context object or URL The base context to use when compacting the input . ; either in the form of an JSON object or as Exception IRI Description .
callback INVALID_SYNTAX A general syntax error was detected in the @context . For example, if a @type key maps to anything other than @id JsonLdCallback or an absolute IRI , this exception would be raised. LOAD_ERROR A callback that is called when processing is complete on the given input .
options LOSSY_COMPACTION The compaction would lead to a loss of information, such as a @language JsonLdOptions value. A set of options that may affect the datatype for expansion algorithm such as, e.g., the typed literal do not match. input document's base IRI . This also includes optimize , which if set will cause processor-specific optimization.
Return type: object 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. Exception Description InvalidContext There was a problem encountered loading a remote context.
Parameter Type Nullable Optional Description
input object or object[] or URL The JSON-LD object or array of JSON-LD objects to copy and perform the expansion upon. upon or an IRI referencing the JSON-LD document to expand.
context callback object JsonLdCallback An external context to use additionally to the context embedded in input A callback that is called when expanding processing is complete on the given input .
options INVALID_SYNTAX A general syntax error was detected in the @context . For example, if a @type key maps to anything other than @id JsonLdOptions or an absolute IRI , this exception would be raised. LOAD_ERROR A set of options that may affect the expansion algorithm such as, e.g., the input document's base IRI .
Return type: object 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. Exception Description A frame must be either an object or an array of objects, if the frame is neither of these types, this exception is thrown. MULTIPLE_EMBEDS
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 on. upon or an IRI referencing the JSON-LD document to frame.
frame object or URL The frame to use when re-arranging the data. data of input ; either in the form of an JSON object or as IRI .
options callback object JsonLdCallback A set of options callback that will affect is called when processing is complete on the framing algorithm. given input .
options JsonLdOptions InvalidFrame INVALID_SYNTAX A subject IRI was specified in more than one place in set of options that may affect the framing algorithm such as, e.g., the input frame. More than one embed of a given subject document's base IRI is not allowed, and if requested, must result in this exception. .
Return type: object void
normalize fromRDF
Normalizes the Creates a JSON-LD document given an set of input according to the steps in the Normalization Algorithm . The input must be copied, normalized and returned if there are no errors. If the compaction fails, null Statement must be returned. The output is the serialized representation returned from the Normalization Algorithm . It's still an open question if the result is a DOMString representing the serialized graph in JSON-LD, or an array representation which is in normalized form. s. Exception Description INVALID_SYNTAX
Parameter Type Nullable Optional Description
input object Statement [] The JSON-LD object to perform normalization upon. An array of RDF statements.
context callback object JsonLdCallback An external context to use additionally to the context embedded in input A callback that is called when expanding processing is complete on the given input .
options JsonLdOptions InvalidContext A general syntax error was detected in set of options that will affect the algorithm. This includes @context . For example, notType , which if a @type key maps set to anything other than @id or an absolute IRI , this exception would be raised. true causes the resulting document to use LOAD_ERROR rdf:type There was a problem encountered loading as a remote context. property, instead of @type .
Return type: DOMString void
triples toRDF
Processes the input according to the Convert to RDF Conversion Algorithm , calling the provided tripleCallback callback for each triple Statement generated.
Parameter Type Nullable Optional Description
input object or object[] or URL The JSON-LD object or array of JSON-LD objects to process convert to RDF or an IRI referencing the JSON-LD document to convert to RDF.
context ObjectOrURL An external context to use additionally to the context embedded in input when outputting triples. expanding the input .
tripleCallback callback JsonLdTripleCallback StatementCallback A callback that is called whenever when a Statement is created from processing error occurs on the given input . This callback should be aligned with the RDF API.
context options object JsonLdOptions An external context to use additionally to A set of options that may affect the context embedded in input when expanding conversion to RDF such as, e.g., the input . document's base IRI .
Exception Description

INVALID_SYNTAX 2.2 Callbacks

2.2.1 JsonLdCallback

The A general syntax error was detected in the @context . For example, if a @type JsonLdCallback key maps is used to anything other than return a processed JSON-LD representation as the result of processing an API method.

[NoInterfaceObject Callback]
interface JsonLdCallback {
    void jsonLd (ObjectOrObjectArray jsonld);
};
2.2.1.1 Methods
@id jsonLd or an absolute IRI , this exception would be raised.
This callback is invoked when processing is complete. There was a problem encountered loading a remote context.
Parameter Type Nullable Optional Description
jsonld LOAD_ERROR ObjectOrObjectArray The processed JSON-LD document.
Return type: void

2.2 2.2.2 JsonLdTripleCallback StatementCallback

The JsonLdTripleCallback StatementCallback is called whenever the processor generates a triple statement during the triple() statement() call.

] interface {
[NoInterfaceObject Callback]
interface StatementCallback {
    void statement (Statement statement);
};
2.2.1 2.2.2.1 Methods
triple statement
This callback is invoked whenever a triple statement is generated by the processor.
Parameter Type Nullable Optional Description
subject statement DOMString Statement The subject IRI that is associated with the triple. statement.
property
Return type: DOMString void

2.3 Data Structures

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

2.3.1 URL

The property URL datatype is a string representation of an IRI .


typedef

DOMString

URL

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

objectType 2.3.2 JsonLdOptions

The JsonLdOptiones type is used to convery 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 statements (triples or quads). They are used for normalization, DOMString fromRDF , and from toRDF interfaces.

2.3.3 Statement

The Statement interface represents an RDF Statement.

[NoInterfaceObject]
interface Statement {
    readonly attribute Node  subject;    readonly attribute Node  property;    readonly attribute Node  object;    readonly attribute Node? name;
};
The 2.3.3.1 Attributes
name of type Node , readonly, nullable
The name associated with the Statement identifying it as a member of object a named graph. If the attribute is present, it indicates that this statement is a member of a named graph associated with name . If it is missing, the triple. Valid values are statement is a member of the default graph .
IRI
object and of type literal . Node , readonly
The object associated with the Statement .
property of type Node DOMString , readonly
The property associated with the Statement .
subject of type Node , readonly
The object value subject associated with the subject Statement .

2.3.4 Node

Node is the base class of NamedNode , BlankNode , and LiteralNode .

[NoInterfaceObject]
interface Node {
    readonly attribute DOMString nominalValue;    readonly attribute DOMString interfaceName;
};
2.3.4.1 Attributes
interfaceName of type DOMString , readonly

Provides access to the property. string name of the current interface, normally one of " IRI " , "BlankNode" or "LiteralNode" .

This method serves to disambiguate instances of Node which are otherwise identical, such as datatype NamedNode and BlankNode .

nominalValue of type DOMString , readonly

The nominalValue of an Node is refined by each interface which extends Node .

2.3.5 NamedNode

A node identified by an IRI . NamedNodes are defined by International Resource Identifier [ IRI ].

[NoInterfaceObject]
interface NamedNode : Node {
    readonly attribute DOMString nominalValue;
};
2.3.5.1 Attributes
nominalValue of type DOMString , readonly
The datatype associated with IRI identifier of the object. node.

language 2.3.6 Blank Node

A BlankNode is a reference to an unnamed resource (one for which an IRI is not known), and may be used in a Statement as a unique reference to that unnamed resource.

[NoInterfaceObject]
interface BlankNode : Node {
    readonly attribute DOMString nominalValue;
};
2.3.6.1 Attributes
nominalValue of type DOMString , readonly
The temporary identifier of the BlankNode . The nominalValue must not be relied upon in any way between two separate processing runs of the same document.

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

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

2.3.7 LiteralNode

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

  • a lexical representation of the nominalValue
  • an optional language associated represented by a string token
  • an optional datatype specified by a NamedNode

LiteralNodes representing plain text in a natural language may have a language attribute 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 .

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

[NoInterfaceObject]
interface LiteralNode : Node {
    readonly attribute DOMString  nominalValue;    readonly attribute DOMString? language;    readonly attribute NamedNode? datatype;
};
No exceptions.
2.3.7.1 Attributes
Return type:
datatype of type NamedNode , readonly, nullable
An optional datatype identified by a NamedNode.
language of type void DOMString , readonly, nullable
An optional language string as defined in [ BCP47 ], normalized to lowercase.
nominalValue of type DOMString , readonly
The lexical representation of the LiteralNodes value.

3. 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 prefix defeault value for an output property when the framed subject definition mechanism. 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 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 .
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 with in a context that may be expanded to an IRI
prefix
A prefix is a term that expands to a Web Vocabulary vocabulary base IRI . It is typically used along with a suffix to form a compact IRI to create an IRI within a Web Vocabulary. vocabulary.
plain literal
A plain literal is a literal without a datatype, possibly including a language.
typed literal
A typed literal is a literal with an associated IRI which indicates the literal's datatype.

3.3 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 keys properties and values of a JSON object (or elements of a list (see List Processing )) using a term mapping . It is also used to maintain coercion mapping s from IRIs associated with terms to datatypes, language mapping s from terms to language codes, and list mapping s and set mapping s for IRIs associated with terms. Processors must use the lexical form of the property when creating a mapping, as lookup is performed on lexical representations, not expanded IRI representations.

A local context is identified within a JSON object having a key of @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 value context be the value of @context
    1. If context equals null , reset the active context to the initial context .
    2. If value context is an array , process each element as value , context in order using by starting at Step 2 2.1 .
    3. If value context is a simple string , it must have a lexical form of absolute IRI . .
      1. Dereference value 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 value context to the extracted content, or an empty JSON Object if no value exists. Merge the of local context into the active context content and process it by starting at Step 2.1 .
    4. If value context is a JSON object , perform the following steps:
      1. If value context has a @language key, property, it must have a value of a simple string or null . . Add the language to the local context .
      2. Otherwise, for each key property in value context having perform the lexical form of following steps:
        1. If the property's value is a simple string , determine the IRI mapping value by performing NCName IRI Expansion on the associated value. If the result of the IRI mapping is an absolute IRI (see [ XML-NAMES , merge the property into the local context ]), or term mapping , unless the property is a JSON-LD keyword , in which case throw an empty string, 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 key's value property is a simple string , JSON-LD keyword and the value has @id , @language or @type properties, throw an exception.
            Undecided if @type or @graph can take a @container with @set .
          2. If the property has the form of term , it's value must have an @id property with a string value which must have the form of a term , prefix :suffix, compact IRI , or absolute IRI . . 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 key-value pair property into the local context term mapping .
          3. Otherwise,
          4. If the key's value must property be has the form of of a JSON object . The compact IRI or absolute IRI , the value must may have a @id key property with a string value, the value which must have the form of a term , prefix :suffix, compact IRI , or absolute IRI . . 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 key-value pair property into the local context term mapping .
          5. If the value has a @type key, the property, it's value must have the form of a term , prefix :suffix, 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 .
          6. If the value has a @list @container key, the property, it's value must be true @list or false @set . Merge the list mapping or set mapping into the local context list mapping using the lexical value of the property .
          7. 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 3.2 2.4.2 until no entries are added to the local context .

It can be difficult to distinguish between a prefix:suffix compact IRI and an absolute IRI , , as a prefix 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 3.2 2.3.2 until no changes are made, mappings to IRIs created using an undefined term prefix will eventually resolve to absolute IRIs. IRI s.

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

3.4 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 .

IRIs IRI s may be represented as an absolute IRI , , a term or a prefix :suffix construct. 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. Split 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 .

Previous versions of this specification used @base and @vocab to define IRI prefixes used to resolve relative IRIs. 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 IRI Compaction

Some keys and values are expressed using IRIs. 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 local active context . using an optional value .

3.5.1 IRI Compaction Algorithm

The algorithm for generating a compacted compact IRI is:

  1. Search every key-value pair 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 for a :
    1. If the term 's IRI that is not a complete match against iri , continue to the IRI . next term .
    2. If a complete match value is found, a JSON object containing only the resulting compacted IRI 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 associated with .
    3. Otherwise, if term has a container set to @list , continue to the IRI in 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 complete match container set to @set , then add 1 to rank .
      2. If value is not found, search for a partial match from JSON object containing only the beginning 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 . For all matches that are found, which is a prefix for iri where the resulting compacted 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 the string. iri .
  4. If there is more than one compacted IRI produced, the final value terms is empty, return iri .
  5. Return the shortest and lexicographically least value in terms .

3.5.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 an term and a value and give it a term rank . The selection can then be based, partly, on the entire 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 compacted IRIs. the term rank s for every entry in the list.
  3. Otherwise, if value is true , false , or a number , if term has a @type coercion to xsd:boolean , xsd:integer , or xsd:double respectively, term rank is 3 , otherwise if term has no @type or @language it is 2 , otherwise 1 .
  4. Otherwise, if value is a string , it represents a string value with no @language . 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 .
  5. Otherwise, value must be a subject definition , subject reference , or a JSON object having a @value .
    1. If value has an @value property, it must have either a @type or a @language :
      1. If value has a @type property matching a @type coercion for term , term rank is 3 , otherwise if term has no @type coersion and no @language , term rank is 1 , otherwise 0 .
      2. 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 coersion 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 coersion and no @language , term rank is 1 , otherwise 0 .
  6. Return term rank .

3.6 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 true , false or a number , and the active property is the target of typed literal coercion to xsd:integer or xsd:double , expand the value by adding a into an object with two new key-value pairs. The first key-value pair will be @value and the string representation of value . as defined in the section Data Round Tripping . The second key-value pair will be @type> , @type and the associated coercion datatype expanded version of xsd:boolean , xsd:integer , or xsd:double , depending on value . according to the IRI Expansion rules.
  2. Otherwise, if active property is @graph , or the target of an @id coercion, expand the value by adding into an object with a new 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 the target of typed literal coercion, expand value by adding two new into an object with key-value pairs. The first key-value pair will be @value and the unexpanded value. value . The second key-value pair will be @type and the associated coercion datatype expanded according to the IRI Expansion rules.
  4. Otherwise, if value is a string and the active context property has a @language , is not the target of typed literal coercion but target of language tagging, expand value by adding into an object with two new key-value pairs. The first key-value pair will be @value and the unexpanded value. value . The second key-value pair will be @language and value of @language the language tagging from the active context .
  5. Otherwise, value is already expanded.

3.7 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 the value may be expressed as true , false or number , the value is the native representation of the @value value.
  2. 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 .

  1. If the old identifier is not null and is in identifier map return the mapped identifier.
  2. 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.
  3. Otherwise, increment next identifier by adding one to the integer suffix and return its original value.

3.9 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 or Normalization .

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

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

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

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

3.8.1 3.9.1 Expansion Algorithm

The algorithm takes three input variables: an active context , an active property , and a an value element to be expanded. To begin, the active context is set to the initial context , active property is set to nil, null , and value element is set to the JSON-LD input .

  1. If value element is an array , process each item entry in value 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 it's entries with element 's entries.
  2. Otherwise, if value element is an object
    1. Update If element has a @context property, update the active context according to the steps outlined in the context Context Processing section and remove it from the expanded result. @context property.
    2. For Then, proceed and process each key property and value in value : 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 key next property from element .
      3. If value is null and property is not @id or @value , continue with the next property from element .
      4. If the property is @type @id and the value is must be a string , expand . Expand the value according to IRI Expansion .
      5. Otherwise, if the key property is @value , the @type :
        1. If value must be is a string and is not subject , expand according to further expansion. IRI Expansion .
        2. Otherwise, if the key value is not a keyword subject reference , expand the key according to expanded value is the result of performing IRI Expansion rules and set as active property . on the value of @id .
        3. If the Otherwise, if value is a JSON Object , it must be empty (used for Framing ).
        4. Otherwise, if value is an array , and active property all elements must be either a string is or subject to @list expansion, replace the reference . Expand value with a new key-value key where for each of it's entries using the key previous three steps.
      6. Otherwise, if the property is @list @value or @language and value set to the current value. If the value is must not be a JSON object or an array , process each item in .
      7. Otherwise, if the array property is @list , @set , or @graph , expand value recursively using this algorithm, passing copies of the active context and active property . . If the expanded value is not an object, process the 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. Otherwise, expand If property is not a keyword and active property has a @container @list and the expanded value according 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 Value Expansion 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 rules, passing active value.
      2. if @value is the only property . or the value of @value equals null , replace element with the value of @value .
    4. Remove Otherwise, if element has an @type property and it's value is not in the context from form of an array , convert it to an array .
    5. If element has an @set or @list property, it must be the object. 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 value 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.9 3.10 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:

{
  "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:

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

  "@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:

{
  "@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.9.1 3.10.1 Compaction Algorithm

The algorithm takes two three input variables: an active context , an active property , and a an value element to be expanded. compacted. To begin, the active context is set to the result of performing Context Processing on the passed context , active property is set to nil, null , and value 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. The active context to the given context. be cleanly applied.

  1. If value element is an array , process each item entry in value 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 value element is an object, 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 key property and value in value element:
      1. If the key property is @id or @type
        1. If Set active property to the value result of the key performing IRI Compaction on property .
        2. If value is a string , the compacted value is the result of performing IRI Compaction on the value. value .
        3. Otherwise, the compacted value is the result of performing this algorithm must be an array . Perform IRI Compaction on the every entry of value with the current . If value contains just one entry, value is set to that entry.
        4. Add active property . and the expanded value to output .
      2. Otherwise: Otherwise, value must be an array .
      3. If the key value is not a keyword , set as empty:
        1. Set active property and compact according to the result of performing IRI Compaction . on property .
        2. If the value is an object If the value contains only Create an @id key or the entry in output for active property and value contains a @value key, the compacted .
      4. For each item in value is :
        1. Set active property to the result of performing Value IRI Compaction on for property and item using the value. active context .
        2. Otherwise, if the value contains only Compact item by recursively performing this algorithm passing a @list key, copy of the active context and the active property is subject to list coercion, the compacted value is the result of performing this algorithm on that value. .
        3. Otherwise, If an entry already exists in output for active property , convert it to an array if necessary, and append the compacted value is the result of performing this algorithm on the value. .
        4. Otherwise, if the compacted value is not an array , the compacted and active property has a @container mapping to @set , create an entry in output for active property and value is the result of performing this algorithm on the value. as an array .
        5. Otherwise, the create an entry in output for active property and value is already compacted. .
  3. Otherwise, return element as the compacted value is the value element .
    Perhaps this should also call Value Compaction on native types and strings, which could consolodate 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.10 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 ).

The JSON-LD document below expresses a library, a book and a chapter: { "@context": { "Book": "http://example.org/vocab#Book", "Chapter": "http://example.org/vocab#Chapter", "contains": { "@id": "http://example.org/vocab#contains", "@type": "@id" }, "creator": "http://purl.org/dc/terms/creator", "description": "http://purl.org/dc/terms/description", "Library": "http://example.org/vocab#Library", "title": "http://purl.org/dc/terms/title" }, "@id": [{ "@id": "http://example.com/library", "@type": "Library", "contains": "http://example.org/library/the-republic" }, { "@id": "http://example.org/library/the-republic", "@type": "Book", "creator": "Plato", "title": "The Republic", "contains": "http://example.org/library/the-republic#introduction" }, { "@id": "http://example.org/library/the-republic#introduction", "@type": "Chapter", "description": "An introductory chapter on The Republic.", "title": "The Introduction" }] } Developers typically like to operate on items in a hierarchical, tree-based fashion. Ideally, a developer would want the data above sorted into top-level libraries, then the books that are contained in each library, and then the chapters contained in each book. To achieve that layout, the developer can define the following frame : { "@context": { "Book": "http://example.org/vocab#Book", "Chapter": "http://example.org/vocab#Chapter", "contains": "http://example.org/vocab#contains", "creator": "http://purl.org/dc/terms/creator" "description": "http://purl.org/dc/terms/description" "Library": "http://example.org/vocab#Library", "title": "http://purl.org/dc/terms/title" }, "@type": "Library", "contains": { "@type": "Book", "contains": { "@type": "Chapter" } } } When Framing makes use of the framing Subject Flattening algorithm is run against the previously to place each object defined JSON-LD document, paired with the frame above, in the following JSON-LD document is into a flat list of objects, allowing them to be operated upon by the end result: framing algorithm.

{ "@context": { "Book": "http://example.org/vocab#Book", "Chapter": "http://example.org/vocab#Chapter", "contains": "http://example.org/vocab#contains", "creator": "http://purl.org/dc/terms/creator" "description": "http://purl.org/dc/terms/description" "Library": "http://example.org/vocab#Library", "title": "http://purl.org/dc/terms/title" }, "@id": "http://example.org/library", "@type": "Library", "contains": { "@type": "Book", "contains": { "@type": "Chapter", }, }, }

3.10.1 3.11.1 Framing Algorithm Terms

This algorithm is a work in progress, do not implement it. There was also a recent update to the algorithm in order to auto-embed frame-unspecified data (if the explicit inclusion flag is not set) in order to preserve graph information. This change is particularly important for comparing subgraphs (or verifying digital signatures on subgraphs). This change is not yet reflected in the algorithm below.
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 missing properties 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.
omit default flag Referenced from framing context , but not defined match limit A value specifying the maximum number of matches to accept when building arrays of values during the framing algorithm. A value of -1 specifies that there is no match limit. map of embedded flattened subjects
A a map of subjects that tracks if a subject has been embedded in is the output result of the Framing Subject Flattening Algorithm .

3.10.2 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 that has been normalized according to the Normalization Algorithm ( normalized expanded input ), ) and an input frame ( expanded frame ) that has have been expanded according to the Expansion Algorithm ( expanded frame ), , and a number of options and produces JSON-LD output . The following series of steps is the recursive portion of the framing algorithm:

Initialize the

Create framing context by setting using null for the map of embeds , the object embed flag set to true , clearing the explicit inclusion flag set to false , and clearing the omit missing properties default flag . Override these values based on input options provided set to the algorithm by the application. Generate a list false along with map of frames by processing the expanded frame : If the expanded frame is not an array , set match limit flattened subjects set to 1, place the expanded frame into the list result of frames , and set the JSON-LD output performing Subject Flattening to null . If the on expanded frame is input . Also create results as an empty array , place an empty object into the list of frames , set .

Invoke the JSON-LD output to an array , and set match limit recursive algorithm using framing context to -1. If ( state ), the map of flattened subjects ( subjects ), expanded frame is a non-empty array , add each item in the expanded ( frame into ), result as parent , and null as active property .

The following series of steps is the list recursive portion of frames , set the JSON-LD output to an array , and set match limit to -1. framing algorithm:

  1. Validate frame .
  2. Create a match array for each expanded frame in the list of frames halting when either the match limit is zero or the end set of matched subjects by filtering subjects checking the list map of frames flattened subjects is reached. against frame :
    1. If an expanded frame is not an object, the processor must throw has a Invalid Frame Format @type exception. Add each matching item from the normalized input to the matches array property containing one or more IRIs and decrement the match limit any subject definition by 1 if: The expanded frame has an with a rdf:type @type that exists in the item's list property including any of those IRIs .
    2. Otherwise, if frame has a rdf:type s. Note: the rdf:type @type can be an array , but property only one value needs to be in common between the item and the expanded frame for a match. The expanded frame does not have an empty JSON object , matches any subject definition with a rdf:type @type property, but every property in regardless of the expanded frame exists in actual values.
    3. Otherwise, match if the item. subject definition contains all of the non- keyword properties in frame .
    matches array not defined anywhere.
  3. Process each item Get values for embedOn and explicitOn by looking in the match array with its associated match frame : If for the match frame contains an keys @embed keyword , set and @explicit using the current values for object embed flag to its value. If the match frame contains an @explicit keyword , set the and explicit inclusion flag to its value. Note: from state if not found.
  4. For each id and subject from the keyword exists, but set of matched subjects, ordered by id :
    1. If the value active property is neither true or false , null , set the associated flag map of embeds in state to an empty map.
    2. Initialize output with true . @id and id .
    3. If the object Initialize embed flag with parent and active property to property .
    4. If embedOn is cleared true , and the item has the @id property, replace the item with id is in map of embeds from state :
      1. Set existing to the value of the @id property. id in map of embeds and set embedOn to false .
      2. If the existing has a parent which is an array containing a JSON object embed flag is set and the item has the with @id property, equal to id , element has already been embedded and its IRI can be overwritten, so set embedOn to true .
      3. 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 map of embedded subjects embed can be overwritten.
      4. If embedOn is true , throw a Duplicate Embed exception. existing is already embedded but can be overwritten, so Remove Embedded Definition for id .
    5. If the object 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.
    6. Otherwise:
      1. Add embed flag to map of embeds is set and the item has the @id for id .
      2. Process each property and its IRI is not value in the map of embedded subjects : matched subject , ordered by property :
        1. If the explicit inclusion flag property is set, then delete any key from the item that does not exist in the match frame a keyword , except @id . add property and a copy of value to output and continue with the next property from subject .
        2. For each key If property is not in the match frame :
          1. If explicitOn is false , except for keyword Embed values s from subject in output using subject as element and rdf:type : property as active property .
          2. Continue to next property.
        3. Process each item from value as follows:
          1. If the key item is in a JSON object with the item, key @list , then build create a new recursion input list using the JSON object or objects associated named list with the key. If any object contains an key @id @list and the value that exists of an empty array. Append list to property in the normalized input , replace the object output . Process each listitem in the recursion input list @list array as follows:
            1. If listitem is a subject reference with process listitem recursively using this algorithm passing a new object containing map of subjects that contains the @id key where the value is the value of listitem as the @id , key and all of the other key-value pairs for that subject. Set the recursion match frame to the value associated with subject definition from the match frame original map of flattened subjects 's key. Replace as the value associated with value. Pass the key by recursively calling this algorithm using recursion input list , recursion match first value from frame for property as input. frame , list as parent , and @list as active property .
            2. If the key is not in the item, add the key to the item and set the associated value Otherwise, append a copy of listitem to an empty array if the match frame key's value is an array or null @list otherwise. in list .
          2. If value associated with the item's key item is null , a subject reference process item recursively using this algorithm passing a new map as subjects that contains the omit missing properties flag : If the value associated with @id of item as the key in and the match frame subject definition is an array, use the first frame from the array original map of flattened subjects as the property frame , otherwise set 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 .
          3. Otherwise, append a copy of item to an empty object. active property in output .
      3. If the Process each property and value in frame contains an @omitDefault , where property is not a keyword , set the omit missing properties flag , ordered by property :
        1. Set property frame to its value. Note: if the keyword first item in value or a newly created JSON object exists, but the if value is neither empty.
        2. Skip to the next property in frame if property is in output or if property frame contains true @omitDefault which is true or if it does not contain false , set @omitDefault but the associated value of omit default flag to true . .
        3. If Set the omit missing properties flag value of property in output to a new JSON object with a property @preserve and a value that is set, delete the key in the item. Otherwise, if a copy of the value of @default keyword is set in the property frame set the item's value to if it exists, or the value of string @default . @null otherwise.
      4. If the JSON-LD Add output is null set it to the item, otherwise, parent . If parent is an array , append the item to the JSON-LD output . , otherwise append output to active property in parent .
    7. Return the JSON-LD output .

At the completion of the recursive algorithm, results will contain the top-level subject definition s.

The final, non-recursive step final two steps of the framing algorithm requires the JSON-LD output require results to be compacted according to the Compaction Algorithm by using the context provided in the input frame . The resulting value is the final output of If the frame has no context, compaction algorithm and is what should be returned to performed with an empty context (not a null context). The compaction result must use the application. What are @graph keyword at the implications for framing lists? 3.11 Normalization This algorithm is a work in progress, do not implement it. Normalization is top-level, even if the process of taking JSON-LD input and performing a deterministic transformation on that input that results in a normalized and serialized JSON-LD representation. Normalization context is achieved by transforming JSON-LD input empty or if there is only one element to RDF, as described put in RDF Conversion , invoking the normalization procedure as described in [ RDF-NORMALIZATION ], returning @graph array. Subsequently, replace all key-value pairs where the serialized results. There an open issue ( ISSUE-53 ) on key is @preserve with the purpose and results of performing normalization. Previous versions of value from the specification generated JSON-LD as key-pair. If the result of value from the normalization algorithm, however normalization is a process required across different linked data serializations. To be useful, a graph requires an identical normalized representation that key-pair is independent of the data format originally used for markup, or the way in which language features or publisher preferences create differences in @null , replace the markup of identical graphs. It may be that value with null . If, after replacement, an array contains only the need for either or both of flattening algorithm or to retrieve such a cryptographic signature. Normalization is useful when comparing two graphs against one another, when generating a detailed list of differences between two graphs, and when generating a cryptographic digital signature for information contained in a graph or when generating a hash of value null remove the information contained in a graph. The example below is value, leaving an un-normalized JSON-LD document: { "@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id" }, "xsd": "http://www.w3.org/2001/XMLSchema#" }, "name": "Manu Sporny", "homepage": "http://manu.sporny.org/" } empty array. The example below resulting value is the normalized form of the final JSON-LD document above: output .

Whitespace is used below to aid readability.

The normalization algorithm for JSON-LD removes all unnecessary whitespace in the fully normalized form. Not clear that whitespace must be normalized, as the JSON-LD representation can't be used directly needs to create a signature, but would be based on updated to consider @graph . For 1.0, this might not require anything, as the serialized result default implementation of [ RDF-NORMALIZATION Subject Flattening ]. should flatten everything into a single graph.

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

3.11.3 Subject Flattening

Notice how all of the term s have been Subject Flattening takes as input an expanded JSON-LD document, and sorted results in alphabetical order. Also, notice how the subject a JSON object has been labeled subjects with a named mapping from each object represented in the document to a single entry within the input document, assigning blank node . Normalization ensures that any arbitrary graph containing exactly the same information would be normalized identifiers to exactly the same form shown above. objects without a @id, or with an @id that references a blank node identifier.

3.11.1 Normalization Algorithm

The normalization algorithm transforms operates on the JSON-LD input into RDF, normalizes it according to [ RDF-NORMALIZATION ] initially empty subjects and then transforms back to JSON-LD. The result takes as input the current document element .

  1. If element is an object representation that deterministically represents array, process each entry in element recursively, using this algorithm.
  2. Otherwise, if element is a RDF graph. JSON object:
    1. Transform the JSON-LD input If element is a subject definition to RDF according to the steps in the RDF Conversion Algorithm . or subject reference :
      1. Perform [ If the property @id is not an RDF-NORMALIZATION IRI ] of that RDF to create , return a serialized N-Triples representation blank node identifer using Generate Blank Node Identifier as name , otherwise use the value of the RDF graph. @id property as name .
      2. Construct Unless subjects as an entry for name create a new entry in subjects initialized using a new JSON array object with @id set to array name to serve as the output object. subject . Otherwise, use that existing entrpy as subject .
      3. For each triple in the N-Triples document having subject , predicate , property and object : value in element other than @id :
        1. If predicate property is a keyword, copy property and http://www.w3.org/1999/02/22-rdf-syntax-ns#first , let object representation be object represented in expanded form as described in Value Expansion . Set value as the last entry in array . to subject .
        2. If the last entry in Otherwise, if value is subject , replace a JSON object , it with must only have the key @list. Create a new JSON object having a key/value pair of containing @list and an array containing created by performing this algorithm recursively on each item in the list and add to object representation subject along with property .
        3. Otherwise, the last key/value entry in value must be an array . Add property to subject and an array value created by performing this algorithm recursively on each item in the array.
      4. Return a new JSON object having a single key of @list with created as a value that is an array . Append subject reference to object representation name .
    2. Otherwise, if return predicate is http://www.w3.org/1999/02/22-rdf-syntax-ns#rest , ignore this triple. element .
  3. Otherwise, if return element .

The algorithm states to set the last entry property in array subject is not using the mapped values, but it really should merge, if the property already exists in subject .

The algorithm should descend into @graph and create a JSON Object with parallel flattened structure of subject to object within that @graph representation. Recursive @graph definitions are also flattened into the default graph. The algorithm should also take an option which descends into @id @graph having and flattens all definitions at the same level, effectively flatting default and named graphs into a value of single default graph; this should be the default implementation for 1.0.

3.11.4 Remove Embedded Definition

This algorithm replaces an already embedded subject : Create a new JSON Object definition with key/value pair of @id and a string representation subject reference . It then recursively removes any entries in the map of embeds that had the removed subject and use definition in their parent chain.

About as clear as mud

The algorithm is invoked with a framing context and subject id value id .

  1. Otherwise, set Find value embed to that value. from map of embeds for id .
  2. If predicate is http://www.w3.org/1999/02/22-rdf-syntax-ns#type : Let parent and property be from embed .
  3. If value parent has an key/value pair of @type and is an array , append array, replace the string representation of subject definition that matches id with a subject reference . If parent is a JSON object , replace the subject definition to for property that array. matches id with a subject reference .
  4. Otherwise, if Remove dependents for value id has an key in map of embeds by scanning the map for entries with parent that have an @type , replace @id of id , removing that value with a new array containing definition from the existing value 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 string representation of framing context , input subject definition object element , active property , and output .

  1. Otherwise, For each item in active property of element :
    1. If item is a JSON object with the key @list , then create a new entry in value JSON object with a key of @type @list and value being a string representation value of an empty array and add it to object 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 .
    2. Otherwise, let If key item by is a subject reference :
      1. If map of embeds does not contain an entry for the string representation @id of predicate item :
        1. Initialize embed with output as parent and let active property as object representation property be and add to map of embeds .
        2. Initialize a new subject definition object o represented in expanded form to act as described in Value Expansion the embedded subject definition .
        3. If For each property and value has an key/value pair of in the expanded definition for key item in subjects :
          1. Add property and an array , append a copy of object representation value to that array. o if property is a keyword .
          2. Otherwise, if recursively call this algorithm passing value has an key of as key element , replace that value with a new array containing the existing value property as active property and object representation o as output .
      2. Otherwise, create a new entry in value with a key of Set key item and to object representation o .
  2. Return If output is an array , append a copy of item , otherwise append a copy of item as the normalized graph representation. to active property in output .

3.12 4. Data Round Tripping

When normalizing coercing numbers to xsd:integer or xsd:double values, as it, e.g., happens during RDF Conversion , implementers must ensure that the normalized value result is a string. In order to generate canonical lexical representation in the form of a string . A canonical lexical representation 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 and a value in the value space as defined in [ XMLSCHEMA-2 ]. In other words, every value must be converted to a deterministic string representation.

The canonical lexical representation 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:


(value).toFixed(0).toString()

The canonical lexical representation of a double value, output equivalent , 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 ( printf("%1.6e", value) + function ) are prohibited in C the exponent. If the exponent is zero, it must be used where "%1.6e" indicated by E0 . For the mantissa, the preceding optional plus sign is prohibited and the string formatter decimal point is required. Leading and value 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 value left of the decimal point and at least a single digit to be converted. the right of the decimal point unless the value being represented is zero. The canonical representation for zero is 0.0E0 . To convert the a double value number in JavaScript, implementers can use the following snippet of code:

// the variable 'value' below is the JavaScript native double value that is to be converted (value).toExponential(6).replace(/(e(?:\+|-))([0-9])$/, '$10$2')
(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 ].

When data needs 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 directly.

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 = {
               "@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 .

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

Round-tripping data can be problematic if we mix and match coercion rules with JSON-native datatypes, like integers. Consider the following code example: var myObj = { "@context" : { "number" : { "@id": "http://example.com/vocab#number", "@type": "xsd:nonNegativeInteger" } }, "number" : 42 }; // Map the language-native object to JSON-LD var jsonldText = jsonld.normalize(myObj); // Convert the normalized object back to a JavaScript object var myObj2 = jsonld.parse(jsonldText); At this point, myObj2 and myObj will have different values for the "number" value. myObj will be the number 42, while myObj2 will be the string "42". This type of data round-tripping error can bite developers. We are currently wondering if having a "coercion validation" phase in the parsing/normalization phases would be a good idea. It would prevent data round-tripping issues like the one mentioned above.

3.13 5. RDF Conversion

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

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

The processing algorithm algorithms described in this section is 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 triples statements during the output process and are not required to implement the algorithm exactly as described.

3.13.1 5.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 may be of three basic types: IRI NamedNode s, , representing IRIs for describing externally named entities, BNodes , BlankNode , resources for which an external name does not exist, or is not known, and Literals, LiteralNode , which describe terminal entities such as strings, dates and other representations having a lexical representation possibly including an explicit language or datatype.

An Internationalized Resource Identifier ( IRI ), as described in [ RFC3987 ], is a mechanism for representing unique identifiers on the web. In Linked Data , an IRI is commonly used for expressing a subject , a property or an object .

Data described with JSON-LD may be considered to be the representation of a graph made up of subject and object resource s related via a property resource . However, specific implementations may choose to operate on the document as a normal JSON description of objects having attributes.

3.13.2 5.2 RDF Conversion Algorithm Terms

default graph name
the destination A IRI or Blank Node used to identify statements belonging to a named graph for all triples generated by JSON-LD markup. .

3.13.3 5.3 Convert to RDF Conversion 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 default graph set of RDF Statement s that the following algorithm generates:

Create

The algorithm takes five input variables: a new processor state with with the active context set element to the initial context and be converted, an active subject , active property and graph name . To begin, the active subject , active property initialized and graph name are set to NULL. 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 is detected, , perform the following steps:
    1. If the JSON Set active object has a @context key, process the local context as described in Context . Create a copy of the current JSON object , changing keys that map to JSON-LD keyword s with those keyword s. Use the new JSON object in subsequent steps. null .
    2. If the JSON object element has a @value key, property, set the active object to a literal value as follows:
      1. as As a typed literal if the JSON object element contains a @type key property after performing IRI Expansion on the specified @type .
      2. otherwise, Otherwise, as a plain literal . If the JSON object element contains a @language key, property, use it's value to set the language of the plain literal.
      3. If the neither the active subject nor the active property , generate a triple representing the active subject , the active property and the active object . Return the active object to the calling location.
    3. If the JSON object element has a @list key and property the value is must be an array process the . Process its value as a list as described in List Conversion . If using the JSON return value as the active object has a @id key:
    4. If the value is a string , set the active object to the result of performing IRI Expansion . Generate is not null :
      1. If nether active subject nor active property are null , generate a triple Statement representing the active subject , the active property and the , active object , and graph name . Set the active subject to the
      2. Return active object .
      3. Create
    5. If element has a new processor state copies of @id property, the active context value must be a string , set the active subject and active property . Process to the previously expanded value starting at Step 2 . Proceed using the previous processor state . (either a blank node or an IRI ).
    6. If the JSON object Otherwise, if element does not have a @id key, property, set the active object subject to newly generated blank node . Generate a triple representing the active subject , the active property and the active object . Set the active subject to the active object .
    7. For Process each key property and value in the JSON object that has not already been processed, perform the following steps: element as follows:
      1. If the key property is @type , set the active property to rdf:type .
      2. Otherwise, set the 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 the result of performing IRI Expansion on the key. next property.
      3. If the active Otherwise, if property is the target of a @list coercion, and the value is an array keyword , process the value as a list as described in in List Conversion . skip this step.
      4. Otherwise, create a new processor state set active property to the IRI value of property .
      5. Process value recursively using this algorithm, passing copies of the active context , active subject and , active property and process the value starting at Step 2 and proceed using the previous processor state graph name .
    8. Return the Set active object to the calling location. active subject .
  2. If a regular Otherwise, if element is an array is detected, , process each value in the array by doing the following returning the result of processing the last value in the array : Create a new processor state as follows, process element recursively using this algorithm, using copies of the active context , active subject and , active property , and process the value starting at Step 2 then proceed using the previous processor state graph name .
  3. If a string is detected: If the active property is the target of a @id coercion, set the active object by performing IRI Expansion on the string.
  4. Otherwise, if the active property element is the target of coercion, set the active object by creating a typed literal using the string and the coercion key as the datatype IRI . Otherwise, , set the active object to a plain literal value created from the string. If the active context contains a language key with a non- null value, use it's value to set the language of the plain literal .
  5. Generate
  6. Otherwise, if element is a triple representing the active subject number , the active property and set the active object . If a number is detected, generate to a typed literal using a string representation of the value with datatype set to either xsd:integer or xsd:double , depending on if the value contains a fractional and/or an exponential component. Generate a triple using the active subject , active property and the generated typed literal.
  7. Otherwise, if element is true or false is detected, generate a triple using , set the active subject , active property object and to a typed literal value created from the string representation of the value with datatype set to xsd:boolean .
  8. If any of these steps created an active object and neither active subject nor active property are null , generate a Statement using active subject , active property , active object and graph name .
  9. Return active object .

3.13.4 5.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 the active context and returns a value to be used as an active object . in the calling location.

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

5.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 Statement s into a JSON-LD document.

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

  1. Construct a JSON array array to serve as the output object.
  2. Construct a JSON object listMap to map graph names and subjects to objects derived from statements having a property of rdf:first .
  3. Construct a JSON object restMap to map graph names and subjects to objects derived from statements having a property of rdf:rest .
  4. Construct a JSON object subjectMap to map graph names and subjects to JSON object instances contained in array .
  5. For each statement in input :
    1. If property is rdf:first , create a new entry in listMap with for name and subject and an array value containing object representation and skip to the next statement.
    2. If property is rdf:rest , and object is a BlankNode , create a new entry in restMap to map name and subject to a value being the result of IRI expansion on object and skip to the next statement.
    3. If name is not null :
      1. If subjectMap does not have an entry for null as name and name as subject:
        1. Create a new JSON object with key/value pair of @id and a string representation of name and use as value .
        2. Save value in subjectMap and append to array .
      2. Otherwise, use that entry as value .
      3. If value does not have an entry for @graph , initialize it as a new array ary .
      4. Otherwise, let ary be that array.
      5. If subjectMap does not have an entry for name and subject :
        1. Create a new JSON object with key/value pair of @id and a string representation of subject and use as value .
        2. Save value in subjectMap and append to ary .
      6. Otherwise, use that entry as value .
    4. Otherwise, if subjectMap does not have an entry for null as name and subject :
      1. Create a new JSON object with key/value pair of @id and a string representation of subject and use as value .
      2. Save value in subjectMap and append to array .
    5. Otherwise, use that entry as value .
    6. If property is rdf:type :
      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. Set the value for key in value to an empty @list representation: {"@list": []} .
    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. Append object representation to the array value for key , creating an entry in value if necessary.
  6. For each name , map in restMap :
    1. For each key/value prev , rest entry in map , append to the listMap value identified by name and prev the listMap value identified by name and rest .
  7. For each name , map in listMap :
    1. For each key/value node , list , in map where list exists as a value of an object in array , replace the object value with list .
  8. Return array as the graph representation in expanded form.

A. IANA Considerations

This section is non-normative.

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.

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 specification.
Applications that use this media type:
Any programming environment that requires the exchange of directed graphs. Implementations 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

B. Initial Context

The initial context is defined with the following default entries:

{
  "@context": {
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": { "@type": "@id"}
  }
}

Processors must act as if the initial context is defined in the outer-most level when processing JSON-LD documents.

Should we define other default prefixes?

A. C. 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, and Richard Cyganiak for their input on the specification.

B. Initial Context The initial context is defined with the following default entries: { "@context": { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": { "@type": "@id"} } } Processors must act as if the initial context is defined in the outer-most level when processing JSON-LD documents. Should we define other default prefixes?

C. D. References

C.1 D.1 Normative references

[BCP47]
A. Phillips, M. Davis. Tags for Identifying Languages September 2009. IETF Best Current Practice. URL: http://tools.ietf.org/rfc/bcp/bcp47.txt
[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]
M. Duerst, M. Suignard. Internationalized Resource Identifiers (IRI). January 2005. Internet RFC 3987. URL: http://www.ietf.org/rfc/rfc3987.txt
[JSON-LD]
Manu Sporny, Gregg Kellogg. Kellogg, Markus Lanthaler. The JSON-LD Syntax Latest. W3C Editor's Draft. URL: http://json-ld.org/spec/latest/json-ld-syntax/
[JSON-POINTER]
P. Bryan, Ed. JSON Pointer Latest. IETF Draft. URL: http://www.ietf.org/id/draft-pbryan-zyp-json-pointer-01.txt
[RDF-CONCEPTS]
Graham Klyne; Jeremy J. Carroll. Resource Description Framework (RDF): Concepts and Abstract Syntax. 10 February 2004. W3C Recommendation. URL: <a href="http://w http://www.w3.org/TR/2004/REC-rdf-concepts-20040210
[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. 27 September 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2011/WD-WebIDL-20110927/
[XMLSCHEMA-2]
Paul V. Biron; Ashok Malhotra. XML Schema Part 2: Datatypes Second Edition. 28 October 2004. W3C Recommendation. URL: http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/

D.2 Informative references

[ECMA-262]
ECMAScript Language Specification. December 1999. URL: http://www.ecma-international.org/publications/standards/Ecma-262.htm
[MICRODATA]
Ian Hickson; et al. Microdata 04 March 2010. W3C Working Draft. URL: http://www.w3.org/TR/microdata/
[MICROFORMATS]
Microformats . URL: http://microformats.org
[RDFA-CORE]
Shane McCarron; et al. RDFa Core 1.1: Syntax and processing rules for embedding RDF through attributes. 13 March 2012. W3C Candidate Recommendation. URL: http://www.w3.org/TR/2012/CR-rdfa-core-20120313/