From 682360bfefca4d1f0c2f5a083f24cb546ef09da6 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
+ Copyright ©
+ 2010-2018
+ the Contributors to the JSON-LD 1.1 Processing Algorithms and API Specification, published by the
+ JSON for Linking Data W3C Community Group under the
+ W3C Community Final Specification Agreement (FSA).
+ A human-readable summary is available.
+
+ This specification defines a set of algorithms for programmatic transformations
+ of JSON-LD documents. Restructuring data according to the defined transformations
+ often dramatically simplifies its usage. Furthermore, this document proposes
+ an Application Programming Interface (API) for developers implementing the
+ specified algorithms.
+ This specification was published by the JSON for Linking Data W3C Community Group.
+ It is not a W3C Standard nor is it on the W3C Standards Track.
+
+ Please note that under the
+ W3C Community Final Specification Agreement (FSA)
+ other conditions apply.
+
+ Learn more about
+ W3C Community and Business Groups.
+ This document has been developed by the
+ JSON for Linking Data W3C Community Group
+ as an update to the 1.0 recommendation [JSON-LD-API] developed
+ by the RDF Working Group.
+ The specification has undergone
+ significant development, review, and changes during the course of several years. There are several independent
+ interoperable implementations of
+ this specification, a test suite [JSON-LD-TESTS] and a
+ live JSON-LD playground that is capable
+ of demonstrating the features described in this document. If you wish to make comments regarding this document, please send them to
+ public-linked-json@w3.org
+ (subscribe,
+ archives). This document is one of three JSON-LD 1.1 Recommendations produced by the
+ JSON for Linking Data W3C Community Group: This section is non-normative. This document is a detailed specification of the JSON-LD processing algorithms.
+ 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 [RFC7159]. You must also understand the
+ JSON-LD syntax defined in the JSON-LD 1.1 Syntax specification [JSON-LD11CG], 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 [ECMASCRIPT-6.0] and
+ WebIDL [WEBIDL]. To understand how JSON-LD maps to RDF, it is helpful to be
+ familiar with the basic RDF concepts [RDF11-CONCEPTS]. There are a number of ways that one may participate in the development of
+ this specification: This document uses the following terms as defined in JSON [RFC7159]. Refer
+ to the JSON Grammar section in [RFC7159] for formal definitions. Furthermore, the following terminology is used throughout this document: The Following terms are used within specific algorithms. The following typographic conventions are used in this specification: Notes are in light green boxes with a green left border and with a "Note" header in green. Notes are normative or informative depending on the whether they are in a normative or informative section, respectively. Note that in the examples used in this document, output
+ is of necessity shown in serialized form as JSON. While the algorithms
+ describe operations on the JSON-LD internal representation, when
+ they as displayed as examples, the JSON serialization is used. In particular,
+ the internal representation use of dictionaries are represented using
+ JSON objects. In the internal representation, the example above would be of a
+ dictionary containing This section is non-normative. The JSON-LD 1.1 Syntax specification [JSON-LD11CG] defines a syntax to
+ express Linked Data in JSON. Because there is more than one way to
+ express Linked Data using this syntax, it is often useful to be able to
+ transform JSON-LD documents so that they may be more easily consumed by
+ specific applications. To allow these algorithms to be adapted for syntaxes
+ other than JSON, the algorithms operate on the JSON-LD internal representation,
+ which uses the generic
+ concepts of arrays, dictionaries,
+ strings, numbers, booleans, and null to describe
+ the data represented by a JSON document. Algorithms act on this
+ internal representation with API entry points responsible for
+ transforming between the concrete and internal representations. JSON-LD uses contexts to allow Linked Data
+ to be expressed in a way that is specifically tailored to a particular
+ person or application. By providing a context,
+ JSON data can be expressed in a way that is a natural fit for a particular
+ person or application whilst also indicating how the data should be
+ understood at a global scale. In order for people or applications to
+ share data that was created using a context that is different
+ from their own, a JSON-LD processor must be able to transform a document
+ from one context to another. Instead of requiring JSON-LD
+ processors to write specific code for every imaginable
+ context switching scenario, it is much easier to specify a
+ single algorithm that can remove any context. Similarly,
+ another algorithm can be specified to subsequently apply any
+ context. These two algorithms represent the most basic
+ transformations of JSON-LD documents. They are referred to as
+ expansion and compaction, respectively. JSON-LD 1.1 introduces new features that are
+ compatible with JSON-LD 1.0 [JSON-LD],
+ but if processed by a JSON-LD 1.0 processor may produce different results.
+ In order to detect this JSON-LD 1.1 requires that the processing
+ mode be explicitly set to There are four major types of transformation that are discussed in this
+ document: expansion, compaction, flattening, and RDF serialization/deserialization. This section is non-normative. The algorithm that removes context is
+ called expansion. Before performing any other
+ transformations on a JSON-LD document, it is easiest to
+ remove any context from it and to make data structures
+ more regular. To get an idea of how context and data structuring affects the same data,
+ here is an example of JSON-LD that uses only terms
+ and is fairly compact: The next input example uses one IRI to express a property
+ and an array to encapsulate another, but
+ leaves the rest of the information untouched. Note that both inputs are valid JSON-LD and both represent the same
+ information. The difference is in their context information
+ and in the data structures used. A JSON-LD processor can remove
+ context and ensure that the data is more regular by employing
+ expansion. Expansion has two important goals: removing any contextual
+ information from the document, and ensuring all values are represented
+ in a regular form. These goals are accomplished by expanding all properties
+ to absolute IRIs and by expressing all
+ values in arrays in
+ expanded form. Expanded form is the most verbose
+ and regular way of expressing of values in JSON-LD; all contextual
+ information from the document is instead stored locally with each value.
+ Running the Expansion algorithm
+ ( The example above is the JSON-LD serialization of the output of the
+ expansion algorithm,
+ where the algorithm's use of dictionaries are replaced with JSON objects. Note that in the output above all context definitions have
+ been removed, all terms and
+ compact IRIs have been expanded to absolute
+ IRIs, and all
+ JSON-LD values are expressed in
+ arrays in expanded form. While the
+ output is more verbose and difficult for a human to read, it establishes a
+ baseline that makes JSON-LD processing easier because of its very regular
+ structure. This section is non-normative. While expansion removes context from a given
+ input, compaction's primary function is to
+ perform the opposite operation: to express a given input according to
+ a particular context. Compaction applies a
+ context that specifically tailors the way information is
+ expressed for a particular person or application. This simplifies applications
+ that consume JSON or JSON-LD by expressing the data in application-specific
+ terms, and it makes the data easier to read by humans. Compaction uses a developer-supplied context to
+ shorten IRIs to terms or
+ compact IRIs and
+ JSON-LD values expressed in
+ expanded form to simple values such as strings
+ or numbers. For example, assume the following expanded JSON-LD input document: Additionally, assume the following developer-supplied JSON-LD
+ context: Running the Compaction Algorithm
+ ( The example above is the JSON-LD serialization of the output of the
+ compaction algorithm,
+ where the algorithm's use of dictionaries are replaced with JSON objects. Note that all IRIs have been compacted to
+ terms as specified in the context,
+ which has been injected into the output. While compacted output is
+ useful to humans, it is also used to generate structures that are easy to
+ program against. Compaction enables developers to map any expanded document
+ into an application-specific compacted document. While the context provided
+ above mapped This section is non-normative. While expansion ensures that a document is in a uniform structure,
+ flattening goes a step further to ensure that the shape of the data
+ is deterministic. In expanded documents, the properties of a single
+ node may be spread across a number of different
+ dictionaries. By flattening a
+ document, all properties of a node are collected in a single
+ dictionary and all blank nodes
+ are labeled with a blank node identifier. This may drastically
+ simplify the code required to process JSON-LD data in certain applications. For example, assume the following JSON-LD input document: Running the Flattening Algorithm
+ ( The example above is the JSON-LD serialization of the output of the
+ flattening algorithm,
+ where the algorithm's use of dictionaries are replaced with JSON objects. Note how in the output above all properties of a node are collected in a
+ single dictionary and how the blank node representing
+ "Dave Longley" has been assigned the blank node identifier
+ To make it easier for humans to read or for certain applications to
+ process it, a flattened document can be compacted by passing a context. Using
+ the same context as the input document, the flattened and compacted document
+ looks as follows: Please note that the result of flattening and compacting a document
+ is always a dictionary,
+ (represented as a JSON object when serialized),
+ which contains an This section is non-normative. JSON-LD can be used to serialize RDF data as described in
+ [RDF11-CONCEPTS]. This ensures that data can be round-tripped to and from
+ any RDF syntax without any loss in fidelity. For example, assume the following RDF input serialized in Turtle [TURTLE]: Using the Serialize RDF as JSON-LD algorithm
+ a developer could transform this document into expanded JSON-LD: The example above is the JSON-LD serialization of the output of the
+ Serialize RDF as JSON-LD algorithm,
+ where the algorithm's use of dictionaries are replaced with JSON objects. Note that the output above could easily be compacted using the technique outlined
+ in the previous section. It is also possible to deserialize the JSON-LD document back
+ to RDF using the Deserialize JSON-LD to RDF algorithm.
+ As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+ and notes in this specification are non-normative. Everything else in this specification is
+ normative.
+ The key words MAY, MUST, and MUST NOT are
+ to be interpreted as described in [RFC2119].
+ There are two classes of products that can claim conformance to this
+ specification: JSON-LD Processors,
+ and RDF Serializers/Deserializers. A conforming JSON-LD Processor is a system which can perform the
+ Expansion, Compaction,
+ and Flattening operations
+ in a manner consistent with
+ the algorithms defined in this specification. JSON-LD Processors MUST NOT
+ attempt to correct malformed IRIs or language tags;
+ however, they MAY issue validation warnings. IRIs are not modified other
+ than conversion between relative and
+ absolute IRIs. A conforming RDF Serializer/Deserializer is a system that can
+ deserialize JSON-LD to RDF and
+ serialize RDF as JSON-LD as
+ defined in this specification. The algorithms in this specification are generally written with more concern for clarity
+ than efficiency. Thus, JSON-LD Processors may
+ implement the algorithms given in this specification in any way desired,
+ so long as the end result is indistinguishable from the result that would
+ be obtained by the specification's algorithms. In algorithm steps that describe operations on keywords, those steps
+ also apply to keyword aliases. Implementers can partially check their level of conformance to
+ this specification by successfully passing the test cases of the JSON-LD test
+ suite [JSON-LD-TESTS]. Note, however, that passing all the tests in the test
+ suite does not imply complete conformance to this specification. It only implies
+ that the implementation conforms to aspects tested by the test suite. When processing a JSON-LD data structure, each processing rule is applied
+ using information provided by the active context. This
+ section describes how to produce an active context. The active context contains the active
+ term definitions which specify how
+ properties and values have to be interpreted as well as the current base IRI,
+ the vocabulary mapping and the default language. Each
+ term definition consists of an IRI mapping, a boolean
+ flag reverse property, an optional type mapping
+ or language mapping,
+ an optional context,
+ an optional nest value,
+ an optional prefix flag,
+ and an optional container mapping.
+ A term definition can not only be used to map a term
+ to an IRI, but also to map a term to a keyword,
+ in which case it is referred to as a keyword alias. When processing, active context is initialized
+ without any term definitions,
+ vocabulary mapping, or default language.
+ If a local context is encountered during processing, a new
+ active context is created by cloning the existing
+ active context. Then the information from the
+ local context is merged into the new active context.
+ Given that local contexts may contain
+ references to remote contexts, this includes their retrieval. This section is non-normative. First we prepare a new active context result by cloning
+ the current active context. Then we normalize the form of the original
+ local context to an array.
+ Local contexts may be in the form of a
+ dictionary, a string, or an array containing
+ a combination of the two. Finally we process each context contained
+ in the local context array as follows. Unless specified using
+ If context is a string, it represents a reference to
+ a remote context. We dereference the remote context and replace context
+ with the value of the If context is a dictionary, we first update the
+ base IRI, the vocabulary mapping, processing mode, and the
+ default language by processing three specific keywords:
+ Then, for every other key in local context, we update
+ the term definition in result. Since
+ term definitions in a local context
+ may themselves contain terms or
+ compact IRIs, we may need to recurse.
+ When doing so, we must ensure that there is no cyclical dependency,
+ which is an error. After we have processed any
+ term definition dependencies,
+ we update the current term definition,
+ which may be a keyword alias. Finally, we return result as the new active context. This algorithm specifies how a new active context is updated
+ with a local context. The algorithm takes three input variables:
+ an active context, a local context, and an array
+ remote contexts which is used to detect cyclical context inclusions.
+ If remote contexts is not passed, it is initialized to an empty
+ array. This algorithm is called from the
+ Context Processing algorithm
+ to create a term definition in the active context
+ for a term being processed in a local context. This section is non-normative. term definitions are created by
+ parsing the information in the given local context for the
+ given term. If the given term is a
+ compact IRI, it may omit an IRI mapping by
+ depending on its prefix having its own
+ term definition. If the prefix is
+ a key in the local context, then its term definition
+ must first be created, through recursion, before continuing. Because a
+ term definition can depend on other
+ term definitions, a mechanism must
+ be used to detect cyclical dependencies. The solution employed here
+ uses a map, defined, that keeps track of whether or not a
+ term has been defined or is currently in the process of
+ being defined. This map is checked before any recursion is attempted. After all dependencies for a term have been defined, the rest of
+ the information in the local context for the given
+ term is taken into account, creating the appropriate
+ IRI mapping, container mapping, and
+ type mapping or language mapping for the
+ term. The algorithm has four required inputs which are:
+ an active context, a local context,
+ a term, and a map defined. In JSON-LD documents, some keys and values may represent
+ IRIs. This section defines an algorithm for
+ transforming a string that represents an IRI into
+ an absolute IRI or blank node identifier.
+ It also covers transforming keyword aliases
+ into keywords. IRI expansion may occur during context processing or during
+ any of the other JSON-LD algorithms. If IRI expansion occurs during context
+ processing, then the local context and its related defined
+ map from the Context Processing algorithm
+ are passed to this algorithm. This allows for term definition
+ dependencies to be processed via the
+ Create Term Definition algorithm. This section is non-normative. In order to expand value to an absolute IRI, we must
+ first determine if it is The algorithm takes two required and four optional input variables. The
+ required inputs are an active context and a value
+ to be expanded. The optional inputs are two flags,
+ document relative and vocab, that specifying
+ whether value can be interpreted as a relative IRI
+ against the document's base IRI or the
+ active context's
+ vocabulary mapping, respectively, and
+ a local context and a map defined to be used when
+ this algorithm is used during Context Processing.
+ If not passed, the two flags are set to This algorithm expands a JSON-LD document, such that all context
+ definitions are removed, all terms and
+ compact IRIs are expanded to
+ absolute IRIs,
+ blank node identifiers, or
+ keywords and all
+ JSON-LD values are expressed in
+ arrays in expanded form. This section is non-normative. Starting with its root element, we can process the
+ JSON-LD document recursively, until we have a fully
+ expanded result. When
+ expanding an element, we can treat
+ each one differently according to its type, in order to break down the
+ problem: Finally, after ensuring result is in an array,
+ we return result. The algorithm takes three required and one optional input variables.
+ The required inputs are an active context,
+ an active property, and an element to be expanded.
+ The optional input is the flag frame expansion the allows
+ special forms of input used for frame expansion.
+ To begin, the active property is set to The algorithm also performs processing steps specific to expanding
+ a JSON-LD Frame. For a frame, the If, after the above algorithm is run, the result is a
+ dictionary that contains only an 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. A value is said to be in expanded form
+ after the application of this algorithm. This section is non-normative. If active property has a type mapping in the
+ active context set to Otherwise, the result will be a dictionary containing
+ an Note that values interpreted as IRIs fall into two categories:
+ those that are document relative, and those that are
+ vocabulary relative. Properties and values of The algorithm takes three required inputs: an active context,
+ an active property, and a value to expand. This algorithm compacts a JSON-LD document, such that the given
+ context is applied. This must result in shortening
+ any applicable IRIs to
+ terms or
+ compact IRIs, any applicable
+ keywords to
+ keyword aliases, and
+ any applicable JSON-LD values
+ expressed in expanded form to simple values such as
+ strings or
+ numbers. This section is non-normative. Starting with its root element, we can process the
+ JSON-LD document recursively, until we have a fully
+ compacted result. When
+ compacting an element, we can treat
+ each one differently according to its type, in order to break down the
+ problem: The final output is a dictionary with an The algorithm takes five required input variables: an active context,
+ an inverse context, an active property, an
+ element to be compacted, and a flag
+ If, after the algorithm outlined above is run, result
+ is an empty array, replace it with a new dictionary.
+ Otherwise, if result is an array, replace it with a new
+ dictionary with a single member whose key is the result
+ of using the IRI Compaction algorithm,
+ passing active context, inverse context, and
+ Finally, if a non-empty context has been passed,
+ add an When there is more than one term that could be chosen
+ to compact an IRI, it has to be ensured that the term
+ selection is both deterministic and represents the most context-appropriate
+ choice whilst taking into consideration algorithmic complexity. In order to make term selections, the concept of an
+ inverse context is introduced. An inverse context
+ is essentially a reverse lookup table that maps
+ container mapping,
+ type mappings, and
+ language mappings to a simple
+ term for a given active context. A
+ inverse context only needs to be generated for an
+ active context if it is being used for compaction. To make use of an inverse context, a list of preferred
+ container mapping and the
+ type mapping or language mapping are gathered
+ for a particular value associated with an IRI. These parameters
+ are then fed to the Term Selection algorithm,
+ which will find the term that most appropriately
+ matches the value's mappings. This section is non-normative. To create an inverse context for a given
+ active context, each term in the
+ active context is visited, ordered by length, shortest
+ first (ties are broken by choosing the lexicographically least
+ term). For each term, an entry is added to
+ the inverse context for each possible combination of
+ container mapping and type mapping
+ or language mapping that would legally match the
+ term. Illegal matches include differences between a
+ value's type mapping or language mapping and
+ that of the term. If a term has no
+ container mapping, type mapping, or
+ language mapping (or some combination of these), then it
+ will have an entry in the inverse context using the special
+ key The algorithm takes one required input: the active context that
+ the inverse context is being created for. This algorithm compacts an IRI to a term or
+ compact IRI, or a keyword to a
+ keyword alias. A value that is associated with the
+ IRI may be passed in order to assist in selecting the most
+ context-appropriate term. This section is non-normative. If the passed IRI is If no term was found that could be used to compact the
+ IRI, an attempt is made to compact the IRI using the
+ active context's vocabulary mapping,
+ if there is one. If the IRI could not be compacted, an
+ attempt is made to find a compact IRI.
+ A term will be used to create a compact IRI
+ only if the term definition contains the prefix flag
+ with the value This algorithm takes three required inputs and three optional inputs.
+ The required inputs are an active context, an inverse context,
+ and the var to be compacted. The optional inputs are a value associated
+ with the var, a vocab flag which specifies whether the
+ passed var should be compacted using the
+ active context's
+ vocabulary mapping, and a reverse flag which specifies whether
+ a reverse property is being compacted. If not passed, value is set to
+ This algorithm, invoked via the IRI Compaction algorithm,
+ makes use of an active context's
+ inverse context to find the term that is best
+ used to compact an IRI. Other
+ information about a value associated with the IRI is given,
+ including which container mapping
+ and which type mapping or language mapping would
+ be best used to express the value. This section is non-normative. The inverse context's entry for
+ the IRI will be first searched according to the preferred
+ container mapping, in the order
+ that they are given. Amongst terms with a matching
+ container mapping, preference will be given to those
+ with a matching type mapping or language mapping,
+ over those without a type mapping or
+ language mapping. If there is no term
+ with a matching container mapping then the term
+ without a container mapping that matches the given
+ type mapping or language mapping is selected. If
+ there is still no selected term, then a term
+ with no type mapping or language mapping will
+ be selected if available. No term will be selected that
+ has a conflicting type mapping or language mapping.
+ Ties between terms that have the same
+ mappings are resolved by first choosing the shortest terms, and then by
+ choosing the lexicographically least term. Note that these ties are
+ resolved automatically because they were previously resolved when the
+ Inverse Context Creation algorithm
+ was used to create the inverse context. This algorithm has five required inputs. They are:
+ an inverse context, a keyword or IRI
+ var, an array containers that represents an
+ ordered list of preferred container mapping,
+ a string type/language that indicates whether
+ to look for a term with a matching type mapping
+ or language mapping, and an array representing
+ an ordered list of preferred values for the type mapping
+ or language mapping to look for. This section is non-normative. The following examples are intended to illustrate how the term selection algorithm
+ behaves for different term definitions and values. It is not comprehensive, but
+ intended to illustrate different parts of the algorithm. If the term definition has The inverse context will contain the following: If the term definition has a datatype, it will only match a
+ value object having a matching datatype. The inverse context will contain the following: Expansion transforms all values into expanded form
+ in JSON-LD. This algorithm performs the opposite operation, transforming
+ a value into compacted form. This algorithm compacts a
+ value according to the term definition in the given
+ active context that is associated with the value's associated
+ active property. This section is non-normative. The value to compact has either an For the former case, if the type mapping of
+ active property is set to For the latter case, it might be possible to compact value
+ just into the value associated with the This algorithm has four required inputs: an active context, an
+ inverse context, an active property, and a value
+ to be compacted. This algorithm flattens an expanded JSON-LD document by collecting all
+ properties of a node in a single dictionary
+ and labeling all blank nodes with
+ blank node identifiers.
+ This resulting uniform shape of the document, may drastically simplify
+ the code required to process JSON-LD data in certain applications. This section is non-normative. First, a node map is generated using the
+ Node Map Generation algorithm
+ which collects all properties of a node in a single
+ dictionary. In the next step, the node map is
+ converted to a JSON-LD document in
+ flattened document form.
+ Finally, if a context has been passed, the flattened document
+ is compacted using the Compaction algorithm
+ before being returned. The algorithm takes two input variables, an element to flatten and
+ an optional context used to compact the flattened document. If not
+ passed, context is set to This algorithm generates new blank node identifiers
+ and relabels existing blank node identifiers.
+ The Generate Blank Node Identifier algorithm
+ keeps an identifier map and a counter to ensure consistent
+ relabeling and avoid collisions. Thus, before this algorithm is run,
+ the identifier map is reset and the counter is initialized
+ to This algorithm creates a dictionary node map holding an indexed
+ representation of the graphs and nodes
+ represented in the passed expanded document. All nodes that are not
+ uniquely identified by an IRI get assigned a (new) blank node identifier.
+ The resulting node map will have a member for every graph in the document whose
+ value is another object with a member for every node represented in the document.
+ The default graph is stored under the This section is non-normative. The algorithm recursively runs over an expanded JSON-LD document to
+ collect all properties of a node
+ in a single dictionary. The algorithm constructs a
+ dictionary node map whose keys represent the
+ graph names used in the document
+ (the default graph is stored under the key The algorithm takes as input an expanded JSON-LD document element and a reference to
+ a dictionary node map. Furthermore it has the optional parameters
+ active graph (which defaults to This algorithm is used to generate new
+ blank node identifiers or to
+ relabel an existing blank node identifier to avoid collision
+ by the introduction of new ones. This section is non-normative. The simplest case is if there exists already a blank node identifier
+ in the identifier map for the passed identifier, in which
+ case it is simply returned. Otherwise, a new blank node identifier
+ is generated by concatenating the string The algorithm takes a single input variable identifier which may
+ be This algorithm creates a new map of subjects to nodes using all graphs
+ contained in the graph map created using the Node Map Generation algorithm
+ to create merged node objects containing information defined for a given subject
+ in each graph contained in the node map. This section describes algorithms to deserialize a JSON-LD document to an
+ RDF dataset and vice versa. The algorithms are designed for in-memory
+ implementations with random access to dictionary elements. Throughout this section, the following vocabulary
+ prefixes are used in
+ compact IRIs: This algorithm deserializes a JSON-LD document to an RDF dataset.
+ Please note that RDF does not allow a blank node to be used
+ as a property, while JSON-LD does. Therefore, by default
+ RDF triples that would have contained blank nodes as properties are
+ discarded when interpreting JSON-LD as RDF. This section is non-normative. The JSON-LD document is expanded and converted to a node map using the
+ Node Map Generation algorithm.
+ This allows each graph represented within the document to be
+ extracted and flattened, making it easier to process each
+ node object. Each graph from the node map
+ is processed to extract RDF triple,
+ to which any (non-default) graph name is applied to create an
+ RDF dataset. Each node object in the
+ node map has an The algorithm takes a JSON-LD document element and returns an
+ RDF dataset. Unless the This algorithm generates new blank node identifiers
+ and relabels existing blank node identifiers.
+ The Generate Blank Node Identifier algorithm
+ keeps an identifier map and a counter to ensure consistent
+ relabeling and avoid collisions. Thus, before this algorithm is run,
+ the identifier map is reset and the counter is initialized
+ to This algorithm takes a node object or value object
+ and transforms it into an
+ RDF resource
+ to be used as the object of an RDF triple. If a
+ node object containing a relative IRI is passed to
+ the algorithm, This section is non-normative. Value objects are transformed to
+ RDF literals as described in
+ section 8.6 Data Round Tripping
+ whereas node objects are transformed
+ to IRIs,
+ blank node identifiers,
+ or The algorithm takes as its sole argument item which MUST be
+ either a value object or node object. List Conversion is the process of taking a list object
+ and transforming it into an
+ RDF collection
+ as defined in RDF Semantics [RDF11-MT]. This section is non-normative. For each element of the list a new blank node identifier
+ is allocated which is used to generate The algorithm takes two inputs: an array list
+ and an empty array list triples used for returning
+ the generated triples. This algorithm serializes an RDF dataset consisting of a
+ default graph and zero or more
+ named graphs into a JSON-LD document. In the RDF abstract syntax, RDF literals have a
+ lexical form, as defined
+ in [RDF11-CONCEPTS]. The form of these literals is used when creating JSON-LD values based on these literals. This section is non-normative. Iterate through each graph in the dataset, converting each
+ RDF collection into a list
+ and generating a JSON-LD document in expanded form for all
+ RDF literals, IRIs
+ and blank node identifiers.
+ If the use native types flag is set to The algorithm takes one required and two optional inputs: an RDF dataset dataset
+ and the two flags use native types and use This algorithm transforms an RDF literal to a JSON-LD value object
+ and a RDF blank node or IRI to an JSON-LD node object. This section is non-normative. RDF literals are transformed to
+ value objects whereas IRIs and
+ blank node identifiers are
+ transformed to node objects.
+ If the use native types flag is set to This algorithm takes two required inputs: a value to be converted
+ to a dictionary and a flag use native types. When deserializing JSON-LD to RDF
+ JSON-native numbers are automatically
+ type-coerced to The canonical lexical form of an integer, i.e., a
+ number with no non-zero fractional part or a number
+ coerced to The canonical lexical form of a double, i.e., a
+ number with a non-zero fractional part or a number
+ coerced to The canonical lexical form of the boolean
+ values When JSON-native numbers are deserialized
+ to RDF, lossless data round-tripping cannot be guaranteed, as rounding
+ errors might occur. When
+ serializing RDF as JSON-LD,
+ similar rounding errors might occur. Furthermore, the datatype or the lexical
+ representation might be lost. An To ensure lossless round-tripping the
+ Serialize RDF as JSON-LD algorithm
+ specifies a use native types flag which controls whether
+ RDF literals
+ with a datatype IRI
+ equal to Some JSON serializers, such as PHP's native implementation in some versions,
+ backslash-escape the forward slash character. For example, the value
+ This API provides a clean mechanism that enables developers to convert
+ JSON-LD data into a variety of output formats that are often easier to
+ work with. The JSON-LD API uses Promises to represent
+ the result of the various asynchronous operations.
+ Promises are defined in [ECMASCRIPT-6.0].
+ General use within specifications can be found in [promises-guide]. The It is important to highlight that implementations do not modify the input parameters.
+ If an error is detected, the Promise is
+ rejected passing a If the Compacts the given input using the
+ context according to the steps in the
+ Compaction algorithm: Expands the given input according to
+ the steps in the Expansion algorithm: Flattens the given input and
+ compacts it using the passed context
+ according to the steps in the Flattening algorithm: The The The The Users of an API implementation can utilize a callback to control how remote
+ documents and contexts are retrieved. This section details the parameters of
+ that callback and the data structure used to return the retrieved context. The All errors result in the Promise being rejected with
+ a The This section describes the datatype definitions used within the
+ JSON-LD API for error handling. The The This section is non-normative. Consider requirements from Self-Review Questionnaire: Security and Privacy. This section is non-normative. This section is non-normative. The following is a list of issues open at the time of publication. Thanks for the great work with JSON-LD! However, when trying to use JSON-LD for to present data in the company I'm working in, I noticed the following missing feature: FEATURE PROPOSAL: ABILITY TO DEFINE ANY KEY AS AN INDEX KEY In addition to JSON-LD's existing index container structure, I propose that any key under a JSON-LD node could be defined as a index key. This would help clustering data under a node into coder friendly logical groups without messing up the Linked Data interpretation with e.g. blank nodes. I encountered the need for this feature at our company where our problem is that the amount of attributes a single JSON-LD node can have can potentially be quite many, say, tens or hundreds of attributes. As far as I know, this can not be currently done with JSON-LD without 1) ending up with blank nodes or 2) the need to create a deeper JSON structure by using a separate index term (using "@container":"@index") which then contains the data underneath. In addition, if a single key could be defined as a index term, this would make it more flexible to attach the JSON-LD Linked Data interpretation to even a wider amount of existing JSON data, without having to change the structure of such data (and without ending up with e.g. lots of blank nodes). DEFINING AN INDIVIDUAL INDEX KEY IN @context The "@context" definition could be done e.g. using the existing reserved keyword "@index" in the following way: which should be interpreted in the following way: 1) the "indexkey" is an index key and should be skipped when traversing the JSON tree while doing the JSON-LD to RDF interpretation, 2) any data directly under the "indexkey" should be interpreted as data directly attached to the node of the indexkey (same RDF subject). EXAMPLE To give a full example, in the following a single key "labels" is defined as an index index key to help grouping the data into coder friendly logical groups without messing up the Linked Data interpretation): This example JSON-LD should generate the following RDF triplets: This has already been discussed several times usingvarious terms.. the most recent request has come from David Janes on the mailing list. The basic idea is to support JSON values/subtrees that aren't mapped to an IRI in the context. They should survive algorithmic transformations (basically without being touched at all). _This was raised by Fabian Steeg:_ The JSON-LD API document states: "Expansion has two important goals: removing any contextual information from the document, and ensuring all values are represented in a regular form." Is there a way to achieve only the second goal, the regular form, but with compact terms? Using compaction with compactArrays=false is pretty close, but there is still at least one thing that is irregular and causing issues for me. Given this input: I get this from compaction with compactArrays=false: But I'd like to get this (which is what expansion does to the values): So I guess I'm looking for something like a compactValues=false option. Is there some way to get this output? We are encountering an issue when converting RDF Datasets to JSON-LD. The problem is with blank nodes that are shared between graphs and lists. In TriG (yes, this is a synthetic reduced test case that captures a The triple in :G1 references into the list in :G. But as we understand the conversion algorithm, section 4 only considers Is this a correct reading of the spec text? Part 4 of the conversion algorithm has so 4.3.3.* walks back up the list in one graph only. (Conversion generated by jsonld-java : it does not matter if compaction There is no _:b1 in :G to refer to because the algorith generated @list If it is all the same graph (s/:G1/:G/), the RDF dataset structure is Andy See: digitalbazaar/jsonld.js#72 It would be helpful to have the ability to use @language within an object as a shorthand for "@context": {"@language": "..."} ... for instance... make: equivalent to: In the spirit of "Labeling Everything" (http://patterns.dataincubator.org/book/label-everything.html) ... it would be worthwhile, IMO, for JSON-LD to provide a basic @Label keyword for use both in @context and nodes. It's largely syntactic sugar but would be useful. For example: Which would expand to: Many JSON specs existed before JSON-LD. A couple of these specs may not be compatible with JSON-LD as they contain multidimensional containers, such as GeoJSON. Example of a multidimensional array: This issue is a result from the discussion on the GeoJSON-LD repository: geojson/geojson-ld#32. If this issue will not get resolved, the GeoJSON-LD community would suggest creating custom JSON-LD parsers for JSON-LD dialects. This situation would be far from desirable. Introduce a new When an array is given in the When an object is given in the Would transform to (and vice versa): I want the following: However this is not allowed. The playground says "Invalid JSON-LD syntax; colliding keywords detected". However, this one works: I understand that this restriction probably makes sense for other keywords, but could it do any harm for There have been some discussions on what it would take to be able to do a streaming parse of JSON-LD into Quads, and similarly to generate compliant JSON-LD from a stream of quads. Describing these as some kind of a profile would be useful for implementations that expect to work in a streaming environment, when it's not feasible to work on an entire document basis. As currently stated, the JSON-LD to RDF algorithm requires expanding the document and creating a node map. A profile of JSON-LD which used a flattened array of node objects, where each node object could be independently expanded and no flattening is required could facilitate deserializing an arbitrarily long JSON-LD source to Quads. (Some simplifying restrictions on shared lists may be necessary). Outer document is an object, containing Fo serializing RDF to JSON-LD, expectations on the grouping of quads with the same graph name and subject are necessary to reduce serialization cost, and marshaling components of RDF Lists is likely not feasible. Even if graph name/subject grouping is not maintained in the input, the resulting output will still represent a valid JSON-LD document, although it may require flattening for further processing. (Many triple stores will, in fact, generate statements/quads properly grouped, so this is likely not an issue in real world applications). Hi there, I was looking for a way to access properties in a JSON-LD document based on triples (to patch the document). This would mean having a view which creates a dictionary for a given document. The term Normalisation is already used, but this approach would be close to the way https://github.com/paularmstrong/normalizr. D3 uses https://github.com/d3/d3-hierarchy/blob/master/README.md#stratify in a slightly different way but with the same general intent. The goal would be to be able to address document values with this syntax This could also be a For a document: Such a This would therefore allow to do the following: Issue: The compaction algorithm prefers the most compact format, which for resources without relationships is a string containing the URI. This causes problems in systems that cannot handle arrays of mixed data types (for example ElasticSearch) when there are also resources that have relationships, resulting in both objects and strings in the same array. For example: would raise an error in Elastic. Proposed solution: Provide a flag to the compaction algorithm to signal that the resulting JSON should always create objects for resources, even if there is only the URI available. This would instead render the example above as an array of objects: The purpose of the There are two situations in which this functionality could be desirable but is currently not possible: This is related to #235: When I have the following document: By point We have web application that needs to be able to modify RDF lists from a triple store and propagate the changes back. To do this, we are utilizing jsonld-java to serialize the RDF into JSON-LD, modifying it in the web app, and then sending it back to be deserialized and stored in the triple store. Originally, we were using blank nodes like the ones shown in Turtle below. However, we discovered that blank node lists are collapsed during serialization thus losing all the blank node IDs. With blank node IDs removed, we are no longer able to reference the existing RDF in the triple store to perform updates when the lists are modified in the web-app without much more complex logic. To avoid this, we skolemized the blank node IDs into IRIs. However, when serializing the skolemized triples, the IRI for the last element in the RDF list is hidden, in this case Issue #277 seems to be the point where the implementation changed from serializing lists in the manner we expect to this new compact way. Is there any way we can get around this so that the last blank node of a list is not collapsed? Currently it appears that properties are sorted into alphabetical order after any JSON-LD operation (compaction, framing). In the context of framing, this is sometimes a nice feature, since it means that after framing multiple input JSON files, the JSON data is at least in a consistent order. I understand that ordering is semantically meaningless, but as framing exists to turn the graph (which could correspond to multiple different trees) into a predictable JSON tree as a convenience for developers, it seems natural to me that if an explicit ordering is given in the frame, that the algorithm would respect that order rather than alphabetize. For example, if my data is: Under the frame: the returned document reverses the order of Related issue: there is no way to indicate that referenced nodes should occur before they are references (excluding circular references), which can be useful in streaming files. Having control of the node order via the frame would also give a mechanism to address that. Hope this makes sense and apologies if I'm missing something fundamental here that makes alphabetizing the node order the only logical thing to do; or if I've misunderstood the expected behavior. Comments at TPAC suggested that as our work is a breaking change (causing 1.0 processors that are not 1.1 compatible to intentionally break when they see This could impact a potential WG, which may want to make further changes, and then be in the place of using either In some situations it is important/necessary to include the base direction of a text, alongside its language; see the “Requirements for Language and Direction Metadata in Data Formats” for further details. In practice, in a vanilla JSON, it would require something like: (the example comes from that document). At this moment, I believe the only way you can reasonably express that in JSON-LD is via cheating a bit: and making sure that the The difficulty lies in the RDF layer, in fact; RDF does not have any means (alas!) to express text direction. On the other hand, this missing feature is a general I18N problem whenever JSON-LD is used (there were issues when developing the Web Annotation Model, these issues are popping up in the Web Publication work, etc.). Here is what I would propose as a non-complete solution Cc: @BigBlueHat @r12a Per a suggestion by @danbri, we may want to add a container type, similar to Markup might look like the following: This would expand to the following: Otherwise, it works like When compacting, the processor will re-order items based on Expansion shows 1-base position, but could be 0-base as well. Note that specific During the last meeting it was resolved to have one playground for 1.0 and 1.1 processing. Some notes on that related to jsonld.js: From an ease of site development viewpoint, I think we should just put the most recent jsonld.js on the playground and add a UI control to pick the This section is non-normative. A large amount of thanks goes out to the JSON-LD Community Group
+ participants who worked through many of the technical issues on the mailing
+ list and the weekly telecons - of special mention are Niklas Lindström,
+ François Daoust, Lin Clark, and Zdenko 'Denny' Vrandečić.
+ 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.
+ The work of Dave Lehn and Mike Johnson are appreciated for reviewing,
+ and performing several implementations of the specification. Ian Davis is
+ thanked for his work on RDF/JSON. Thanks also to Nathan Rixham,
+ Bradley P. Allen, Kingsley Idehen, Glenn McDonald, Alexandre Passant,
+ Danny Ayers, Ted Thibodeau Jr., Olivier Grisel, Josh Mandel, Eric Prud'hommeaux,
+ David Wood, Guus Schreiber, Pat Hayes, Sandro Hawke, and Richard Cyganiak
+ for their input on the specification.
+ Copyright ©
+ 2010-2018
+ the Contributors to the JSON-LD 1.1 Framing Specification, published by the
+ Linking Data in JSON Community Group under the
+ W3C Community Final Specification Agreement (FSA).
+ A human-readable summary is available.
+
+ JSON-LD Framing allows developers to query by example and
+ force a specific tree layout to a JSON-LD document.
+ This specification was published by the Linking Data in JSON Community Group.
+ It is not a W3C Standard nor is it on the W3C Standards Track.
+
+ Please note that under the
+ W3C Community Final Specification Agreement (FSA)
+ other conditions apply.
+
+ Learn more about
+ W3C Community and Business Groups.
+ This document has been developed by the
+ JSON for Linking Data W3C Community Group.
+ The specification has undergone
+ significant development, review, and changes during the course of several years. There are several independent
+ interoperable implementations of
+ this specification, a test suite [JSON-LD-TESTS] and a
+ live JSON-LD playground that is capable
+ of demonstrating the features described in this document. If you wish to make comments regarding this document, please send them to
+ public-linked-json@w3.org
+ (subscribe,
+ archives). This document is one of three JSON-LD 1.1 Recommendations produced by the
+ JSON for Linking Data W3C Community Group: 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 objects. 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.
+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 [RFC7159]. You must also understand the
+JSON-LD 1.1 Syntax specification [JSON-LD11CG], which is the base syntax used by all of the
+algorithms in this document,
+and the JSON-LD 1.1 API [JSON-LD11CG-API]. 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 [ECMASCRIPT-6.0] and
+WebIDL [WEBIDL]. To understand how JSON-LD maps to RDF, it is helpful to be
+familiar with the basic RDF concepts [RDF-CONCEPTS]. There are a number of ways that one may participate in the development of
+ this specification: This document uses the following terms as defined in JSON [RFC7159]. Refer
+ to the JSON Grammar section in [RFC7159] for formal definitions. Furthermore, the following terminology is used throughout this document: The Following terms are used within specific algorithms. The following typographic conventions are used in this specification: Notes are in light green boxes with a green left border and with a "Note" header in green. Notes are normative or informative depending on the whether they are in a normative or informative section, respectively. This section is non-normative. This section is non-normative. Framing is used to shape the data in a JSON-LD document,
+ using an example frame document which is used to both match the
+ flattened
+ data and show an example of how the resulting data should be shaped.
+ Matching is performed by using properties present in in the frame
+ to find objects in the data that share common values. Matching can be done
+ either using all properties present in the frame, or any property in the frame.
+ By chaining together objects using matched property values, objects can be embedded
+ within one another. A frame also includes a context, which is used for compacting the resulting
+ framed output. For example, assume the following JSON-LD frame: This frame document describes an embedding structure that would place
+ objects with type When using a flattened set of objects that match the frame components: The Frame Algorithm can create a new document which follows the structure
+ of the frame: If processing mode is The Framing Algorithm does this by
+ first expanding both the input frame and document. It then creates
+ a map of flattened subjects. The outer-most node object within the frame
+ is used to match objects in the map, in this case looking for node objects
+ which have an A frame may specify properties that don't exist in an input file. If the
+ explicit inclusion flag is The value of the property in the frame is not otherwise
+ used in the output document. It's purpose is for frame matching and
+ finding default values. Note the description value for Library in the following example. Framing can be controlled using API options,
+ or by adding framing keywords within the frame as
+ described in section 4.1 Syntax Tokens and Keywords. Framing flags set using keywords have effect only for the
+ frame in which they appear, and for implicit frames which are created
+ for objects where no frame object exists. The object embed flag determines if a referenced
+ node object is embedded as a property value of a referencing
+ object, or kept as a node reference.
+ The initial value for the object embed flag is set using the
+ Because, the default for the object embed flag is However, if the The explicit inclusion flag used to determine
+ properties which will be included in the output document.
+ The default value is For example, take an expanded version of the library frame which include
+ some properties from the input, but omit others. The resulting output will exclude properties for Book which are not explicitly
+ listed in the frame object: The omit default flag changes the way framing generates output when a property
+ described in the frame is not present in the input document.
+ The initial value for the omit default flag is set using the
+ The omit graph flag determines if framed output containing a single
+ node object is contained within The require all flag is used in frame matching to determine when a
+ node object from an input document matches a frame. When
+ matching, an object may include A frame may include @reverse, or a value of a term defined using @reverse
+ to invert the relationships in the output object. For example, the
+ Library example can be inverted using the following frame: Using the flattened library example above, results in the following: Frames can include The following example uses a variation on our library theme where information
+ is split between the default graph, and a graph named
+ As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+ and notes in this specification are non-normative. Everything else in this specification is
+ normative.
+ The key words MAY, MUST, MUST NOT, RECOMMENDED, and SHOULD NOT are
+ to be interpreted as described in [RFC2119].
+ There is one class of products that can claim conformance to this
+ specification: JSON-LD Processors. A conforming JSON-LD Processor is a system which can perform the
+ Framing operation in a manner consistent with
+ the algorithms defined in this specification. JSON-LD Processors MUST NOT
+ attempt to correct malformed IRIs or language tags;
+ however, they MAY issue validation warnings. IRIs are not modified other
+ than conversion between relative and
+ absolute IRIs. The algorithms in this specification are generally written with more concern for clarity
+ than efficiency. Thus, JSON-LD Processors MAY
+ implement the algorithms given in this specification in any way desired,
+ so long as the end result is indistinguishable from the result that would
+ be obtained by the specification's algorithms. In algorithm steps that describe operations on keywords, those steps
+ also apply to keyword aliases. Implementers can partially check their level of conformance to
+ this specification by successfully passing the test cases of the JSON-LD test
+ suite [JSON-LD-TESTS]. Note, however, that passing all the tests in the test
+ suite does not imply complete conformance to this specification. It only implies
+ that the implementation conforms to aspects tested by the test suite. 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. Reference to JSON data structures are interpreted using their internal representation for the purpose
+ of describing algorithms. This specification adds a number of keywords (framing keywords) to
+ the ones defined in the JSON-LD 1.1 Syntax specification [JSON-LD11CG]: Any other value for All JSON-LD tokens and keywords are case-sensitive. Framing is the process of taking a JSON-LD document, which expresses a
+ graph of information, and applying a specific graph layout
+ (called a Frame). Framing makes use of the Node Map Generation algorithm
+ to place each object defined in the JSON-LD document into a map of flattened subjects, allowing
+ them to be operated upon by the Framing algorithm. A valid JSON-LD Frame is a superset of a valid JSON-LD document,
+ allowing additional content, which is preserved through expansion.
+ The Grammar defined in the JSON-LD 1.1 Syntax specification [JSON-LD11CG]
+ is extended as follows: The framing algorithm takes an JSON-LD input (expanded input),
+ which MUST be a JSON-LD document in
+ expanded form,
+ an input frame (expanded frame),
+ which MUST be a JSON-LD frame in
+ expanded form,
+ a context (context),
+ and a number of options and produces JSON-LD output. If an error is detected in the expanded frame, a Set graph map to the result of performing the
+ Node Map Generation algorithm on
+ expanded input. If the The recursive algorithm operates with a framing state (state),
+ created initially using
+ the object embed flag set to Processors MAY use other runtime options to set different framing state defaults
+ for values of state. Invoke the recursive algorithm using framing state (state),
+ the keys from the map of flattened subjects as subjects,
+ expanded frame (frame), result as parent, and
+ The recursive algorithm adds elements to parent either by appending
+ the element to parent, if it is an array, or by appending it
+ to an array associated with active property in parent, if it is a dictionary.
+ Note that if parent is an array, active property MUST be The following series of steps is the recursive
+ portion of the framing algorithm: Can we remove sorting, or make it subject to a processing
+ flag? In general, sorting is a performance problem for JSON-LD, and
+ inhibits stream processing. If the processing mode is Using result from the recursive algorithm, set compacted results to the result of using the
+ If the omit graph flag is Recursively, replace all key-value pairs in compacted results
+ where the key is Return compacted results. The Frame Matching Algorithm is used as part of the Framing algorithm
+ to determine if a particular node object matches the criteria set in a frame.
+ In general, a node object matches a frame if it meets the matches on As matching is performed on expanded node objects, all values will be in the form of an array. Node matching uses a combination of JSON constructs to match any, zero, or some specific values: The frame matching algorithm takes the framing state (state),
+ a list of subjects to match from the map of flattened subjects (subjects),
+ a frame to match against (frame), and the requireAll flag
+ and returns a list of matched subjects by filtering each node in subjects as follows: Frame matching follows an order of precedence, first attempting to match on a particular The Value Pattern Matching Algorithm is used as part of the Framing
+ and Frame Matching algorithms. A value object
+ matches a value pattern using the The algorithm takes a This API provides a clean mechanism that enables developers to convert
+ JSON-LD data into 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.
+ The JSON-LD Processor interface is the high-level programming structure that developers
+ use to access the JSON-LD transformation methods. The definition below is an experimental
+ extension of the interface defined in the JSON-LD 1.1 API [JSON-LD11CG-API]. The The JSON-LD Framing extends the error interface and codes defined in
+ the JSON-LD 1.1 API [JSON-LD11CG-API].
+
+ The This section describes datatype definitions used within the JSON-LD API. The JsonLdContext type is used to refer to a value that
+ that may be a dictionary, a string representing an
+ IRI, or an array of dictionaries
+ and strings. See JsonLdContext definition in the JSON-LD 1.1 API [JSON-LD11CG-API]. The In addition to those options defined in the JSON-LD 1.1 API [JSON-LD11CG-API], framing defines these
+ additional options: See JsonLdOptions definition in the JSON-LD 1.1 API [JSON-LD11CG-API]. 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. Fragment identifiers have no meaning with
+ application/frame-ld+json resources. Consider requirements from Self-Review Questionnaire: Security and Privacy. This section is non-normative. This section is non-normative. This section is non-normative. The following is a list of issues open at the time of publication. Currently it appears that properties are sorted into alphabetical order after any JSON-LD operation (compaction, framing). In the context of framing, this is sometimes a nice feature, since it means that after framing multiple input JSON files, the JSON data is at least in a consistent order. I understand that ordering is semantically meaningless, but as framing exists to turn the graph (which could correspond to multiple different trees) into a predictable JSON tree as a convenience for developers, it seems natural to me that if an explicit ordering is given in the frame, that the algorithm would respect that order rather than alphabetize. For example, if my data is: Under the frame: the returned document reverses the order of Related issue: there is no way to indicate that referenced nodes should occur before they are references (excluding circular references), which can be useful in streaming files. Having control of the node order via the frame would also give a mechanism to address that. Hope this makes sense and apologies if I'm missing something fundamental here that makes alphabetizing the node order the only logical thing to do; or if I've misunderstood the expected behavior. The CSS/JS does not render in safari, with the error: The current draft for JSON-LD framing (January 2018) does not mention blank nodes in the frame matching algorithm specification and a strict interpretation of the first test goes a bit against the semantics of RDF in case a frame includes blank nodes: 1 Node matches if it has an According to its definition, a frame is a JSON-LD document, meaning it can include blank nodes. if it happens, blank nodes in the frame will match blank nodes in a document only if they have the same ID and I believe that the Ruby implementation performs simple string comparison. In RDF, shared blank nodes require a special handling and we loose that specificity here. It would be good to either redefine JSON-LD frames such that blank nodes are not allowed or precise the specification of frame matching. I would be in favor of the latter approach. Blank nodes in JSON-LD frames might be useful when nodes have multiple relations to each other. For instance, nodes matching the following frame represent all alumni of a university who still work for that university: Further to #311, should the predicate that triggered the use of an For example, if the data shape is: X includes Y And there's a @reverse of "in" called "proxies" which is then @embed always via a Frame, should the Z resources also have in back to X? I would have expected: But instead the This section is non-normative. A large amount of thanks goes out to the JSON-LD Community Group
+participants who worked through many of the technical issues on the mailing
+list and the weekly telecons - of special mention are Niklas Lindström,
+François Daoust, and Zdenko 'Denny' Vrandečić.
+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.
+The work of Dave Lehn and Mike Johnson are appreciated for reviewing,
+and performing several implementations of the specification. Ian Davis is
+thanked for this work on RDF/JSON. Thanks also to Nathan Rixham,
+Bradley P. Allen,
+Kingsley Idehen, Glenn McDonald, Alexandre Passant, Danny Ayers, Ted
+Thibodeau Jr., Olivier Grisel, Josh Mandel, Eric Prud'hommeaux,
+David Wood, Guus Schreiber, Pat Hayes, Sandro Hawke, and Richard
+Cyganiak for their input on the specification.
+
+ Copyright ©
+ 2010-2018
+ the Contributors to the JSON-LD 1.1 Specification, published by the
+ JSON for Linking Data W3C Community Group under the
+ W3C Community Final Specification Agreement (FSA).
+ A human-readable summary is available.
+
+ JSON is a useful data serialization and messaging format.
+ This specification defines JSON-LD, a JSON-based format to serialize
+ Linked Data. The syntax is designed to easily integrate into deployed
+ systems that already use JSON, and provides a smooth upgrade path from
+ JSON to JSON-LD.
+ It is primarily intended to be a way to use Linked Data in Web-based
+ programming environments, to build interoperable Web services, and to
+ store Linked Data in JSON-based storage engines.
+ This specification was published by the JSON for Linking Data W3C Community Group.
+ It is not a W3C Standard nor is it on the W3C Standards Track.
+
+ Please note that under the
+ W3C Community Final Specification Agreement (FSA)
+ other conditions apply.
+
+ Learn more about
+ W3C Community and Business Groups.
+ This document has been developed by the
+ JSON for Linking Data W3C Community Group
+ as an update to the 1.0 recommendation [JSON-LD] developed
+ by the RDF Working Group.
+ The specification has undergone
+ significant development, review, and changes during the course of several years. There are several independent
+ interoperable implementations of
+ this specification, a test suite [JSON-LD-TESTS] and a
+ live JSON-LD playground that is capable
+ of demonstrating the features described in this document. If you wish to make comments regarding this document, please send them to
+ public-linked-json@w3.org
+ (subscribe,
+ archives). This document is one of three JSON-LD 1.1 Recommendations produced by the
+ JSON for Linking Data W3C Community Group: This section is non-normative. Linked Data [LINKED-DATA] is a way to create a network of
+ standards-based machine interpretable data across different documents and
+ Web sites. It allows an application to start at one piece of Linked Data,
+ and follow embedded links to other pieces of Linked Data that are hosted on
+ different sites across the Web. JSON-LD is a lightweight syntax to serialize Linked Data in
+ JSON [RFC7159]. Its design allows existing JSON to be interpreted as
+ Linked Data with minimal changes. JSON-LD is primarily intended to be a
+ way to use Linked Data in Web-based programming environments, to build
+ interoperable Web services, and to store Linked Data in JSON-based storage engines. Since
+ JSON-LD is 100% compatible with JSON, the large number of JSON parsers and libraries
+ available today can be reused. In addition to all the features JSON provides,
+ JSON-LD introduces:
+ JSON-LD is designed to be usable directly as JSON, with no knowledge of RDF
+ [RDF11-CONCEPTS]. It is also designed to be usable as RDF, if desired, for
+ use with other Linked Data technologies like SPARQL. Developers who
+ require any of the facilities listed above or need to serialize an RDF Graph
+ or RDF Dataset in a JSON-based syntax will find JSON-LD of interest. People
+ intending to use JSON-LD with RDF tools will find it can be used as another
+ RDF syntax, like Turtle [TURTLE]. Complete details of how JSON-LD relates
+ to RDF are in section 7. Relationship to RDF.
+
+ The syntax is designed to not disturb already
+ deployed systems running on JSON, but provide a smooth upgrade path from
+ JSON to JSON-LD. Since the shape of such data varies wildly, JSON-LD
+ features mechanisms to reshape documents into a deterministic structure
+ which simplifies their processing. This section is non-normative. This document is a detailed specification for a serialization of Linked
+ Data in JSON. The document is primarily intended for the following audiences: A companion document, the JSON-LD 1.1 Processing Algorithms and API specification
+ [JSON-LD11CG-API], specifies how to work with JSON-LD at a higher level by
+ providing a standard library interface for common JSON-LD operations. To understand the basics in this specification you must first be familiar with
+ JSON, which is detailed in [RFC7159]. This document almost exclusively uses the term IRI
+ (Internationalized Resource Indicator)
+ when discussing hyperlinks. Many Web developers are more familiar with the
+ URL (Uniform Resource Locator)
+ terminology. The document also uses, albeit rarely, the URI
+ (Uniform Resource Indicator)
+ terminology. While these terms are often used interchangeably among
+ technical communities, they do have important distinctions from one
+ another and the specification goes to great lengths to try and use the
+ proper terminology at all times.
+ There are a number of ways that one may participate in the development of
+ this specification: This document uses the following terms as defined in JSON [RFC7159]. Refer
+ to the JSON Grammar section in [RFC7159] for formal definitions. Furthermore, the following terminology is used throughout this document: The following typographic conventions are used in this specification: Notes are in light green boxes with a green left border and with a "Note" header in green. Notes are normative or informative depending on the whether they are in a normative or informative section, respectively. This section is non-normative. JSON-LD satisfies the following design goals: This section is non-normative. Generally speaking, the data model described by a
+ JSON-LD document is a labeled,
+ directed graph. The graph contains
+ nodes, which are connected by
+ edges. A node is typically data
+ such as a string, number,
+ typed values (like dates and times)
+ or an IRI.
+ There is also a special class of node called a
+ blank node, which is typically used to express data that does
+ not have a global identifier like an IRI.
+ Blank nodes are identified using a
+ blank node identifier. This simple data model is incredibly
+ flexible and powerful, capable of modeling almost any kind of
+ data. For a deeper explanation of the data model, see
+ section 5. Data Model.
+ Developers who are familiar with Linked Data technologies will
+ recognize the data model as the RDF Data Model. To dive deeper into how
+ JSON-LD and RDF are related, see
+ section 7. Relationship to RDF. At the surface level, a JSON-LD document is simply
+ JSON, detailed in [RFC7159].
+ For the purpose of describing the core data structures,
+ this is limited to arrays, dictionaries (the parsed version of a JSON Object),
+ strings, numbers, booleans, and null,
+ called the JSON-LD internal representation.
+ This allows surface syntaxes other than JSON
+ to be manipulated using the same algorithms, when the syntax maps
+ to equivalent core data structures. Although not discussed in this specification,
+ parallel work using YAML [YAML]
+ and binary representations such as CBOR [RFC7049]
+ could be used to map into the internal representation, allowing
+ the JSON-LD 1.1 API [JSON-LD11CG-API] to operate as if the source was a
+ JSON document. JSON-LD specifies a number of syntax tokens and keywords
+ that are a core part of the language: All keys, keywords, and values in JSON-LD are case-sensitive.
+ As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+ and notes in this specification are non-normative. Everything else in this specification is
+ normative.
+ The key words MAY, MUST, MUST NOT, RECOMMENDED, SHOULD, and SHOULD NOT are
+ to be interpreted as described in [RFC2119].
+ Conformance criteria are relevant to authors and authoring tool implementers. As well
+ as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+ and notes in this specification are non-normative. Everything else in this
+ specification is normative. A JSON-LD document complies with this specification if it follows
+ the normative statements in appendix 6. JSON-LD Grammar. JSON documents
+ can be interpreted as JSON-LD by following the normative statements in
+ section 4.9 Interpreting JSON as JSON-LD. For convenience, normative
+ statements for documents are often phrased as statements on the properties of the document. This specification makes use of the following namespaces: This section is non-normative. JSON [RFC7159] is a lightweight, language-independent data interchange format.
+ It is easy to parse and easy to generate. However, it is difficult to integrate JSON
+ from different sources as the data may contain keys that conflict with other
+ data sources. Furthermore, JSON has no
+ built-in support for hyperlinks, which are a fundamental building block on
+ the Web. Let's start by looking at an example that we will be using for the
+ rest of this section: It's obvious to humans that the data is about a person whose
+ Linked Data, and the Web in general, uses IRIs
+ (Internationalized Resource Identifiers as described in [RFC3987]) for unambiguous
+ identification. The idea is to use IRIs
+ to assign unambiguous identifiers to data that may be of use to other developers.
+ It is useful for terms,
+ like Leveraging the popular schema.org vocabulary,
+ the example above could be unambiguously expressed as follows: In the example above, every property is unambiguously identified by an IRI and all values
+ representing IRIs are explicitly marked as such by the
+ This section is non-normative. When two people communicate with one another, the conversation takes
+ place in a shared environment, typically called
+ "the context of the conversation". This shared context allows the
+ individuals to use shortcut terms, like the first name of a mutual friend,
+ to communicate more quickly but without losing accuracy. A context in
+ JSON-LD works in the same way. It allows two applications to use shortcut
+ terms to communicate with one another more efficiently, but without
+ losing accuracy. Simply speaking, a context is used to map terms to
+ IRIs. Terms are case sensitive
+ and any valid string that is not a reserved JSON-LD keyword
+ can be used as a term. For the sample document in the previous section, a context would
+ look something like this: As the context above shows, the value of a term definition can
+ either be a simple string, mapping the term to an IRI,
+ or a JSON object. When a JSON object is associated with a term, it is called
+ an expanded term definition. The example above specifies that
+ the values of Contexts can either be directly embedded
+ into the document or be referenced. Assuming the context document in the previous
+ example can be retrieved at The referenced context not only specifies how the terms map to
+ IRIs in the Schema.org vocabulary but also
+ specifies that string values associated with
+ the JSON documents can be interpreted as JSON-LD without having to be modified by
+ referencing a context via an HTTP Link Header
+ as described in section 4.9 Interpreting JSON as JSON-LD. It is also
+ possible to apply a custom context using the JSON-LD 1.1 API [JSON-LD11CG-API]. In JSON-LD documents,
+ contexts may also be specified inline.
+ This has the advantage that documents can be processed even in the
+ absence of a connection to the Web. Ultimately, this is a modeling decision
+ and different use cases may require different handling. This section only covers the most basic features of the JSON-LD
+ Context. More advanced features related to the JSON-LD Context are covered
+ in section section 4. Advanced Concepts.
+ This section is non-normative. IRIs (Internationalized Resource Identifiers
+ [RFC3987]) are fundamental to Linked Data as that is how most
+ nodes and properties
+ are identified. In JSON-LD, IRIs may be represented as an
+ absolute IRI or a relative IRI. An
+ absolute IRI is defined in [RFC3987] as containing a
+ scheme along with path and optional query and
+ fragment segments. A relative IRI is an IRI
+ that is relative to some other absolute IRI.
+ In JSON-LD, with exceptions are as described below, all relative IRIs
+ are resolved relative to the base IRI. Properties, values of A string is interpreted as an IRI when it is the
+ value of an Values that are interpreted as IRIs, can also be
+ expressed as relative IRIs. For example,
+ assuming that the following document is located at
+ Absolute IRIs can be expressed directly
+ in the key position like so: In the example above, the key Term-to-IRI expansion occurs if the key matches a term defined
+ within the active context: JSON keys that do not expand to an IRI, such as If type coercion rules are specified in the In the example above, since the value In summary, IRIs can be expressed in a variety of
+ different ways in JSON-LD: This section only covers the most basic features associated with IRIs
+ in JSON-LD. More advanced features related to IRIs are covered in
+ section 4. Advanced Concepts.
+ This section is non-normative. To be able to externally reference nodes
+ in a graph, it is important that
+ nodes have an identifier. IRIs
+ are a fundamental concept of Linked Data, for
+ nodes to be truly linked, dereferencing the
+ identifier should result in a representation of that node.
+ This may allow an application to retrieve further information about a
+ node. In JSON-LD, a node is identified using the The example above contains a node object identified by the IRI
+ This section only covers the most basic features associated with
+ node identifiers in JSON-LD. More advanced features related to
+ node identifiers are covered in section 4. Advanced Concepts.
+ This section is non-normative. The type of a particular node can be specified using the A node can be assigned more than one type by using an array: The value of an This section only covers the most basic features associated with
+ types in JSON-LD. It is worth noting that the JSON-LD has a number of features that provide functionality above and beyond
+ the core functionality described above. The following section describes this
+ advanced functionality in more detail. This section is non-normative. New features defined in JSON-LD 1.1 are available
+ when the processing mode is set to The first Setting the processing mode explicitly
+ for JSON-LD 1.1 is necessary so that a JSON-LD 1.0 processor
+ does not attempt to process a JSON-LD 1.1 document and silently
+ produce different results. This section is non-normative. JSON-LD allows IRIs
+ to be specified in a relative form which is
+ resolved against the document base according
+ section 5.1 Establishing a Base URI
+ of [RFC3986]. The base IRI may be explicitly set with a context
+ using the For example, if a JSON-LD document was retrieved from This document uses an empty Setting Please note that the This section is non-normative. At times, all properties and types may come from the same vocabulary. JSON-LD's
+ If In some cases, vocabulary terms are defined directly within the document
+ itself, rather than in an external vocabulary. Since
+ If this document were located at This section is non-normative. A compact IRI is a way of expressing an IRI
+ using a prefix and suffix separated by a colon ( In the example above, Prefixes are expanded when the form of the value
+ is a compact IRI represented as a It's also possible to use compact IRIs within the context as shown in the
+ following example: In JSON-LD 1.0, terms may be chosen as compact IRI prefixes when
+ compacting only if a simple term definition is used where the value ends with a
+ URI gen-delim character (e.g, In JSON-LD 1.1, terms may be chosen as compact IRI prefixes
+ when compacting only if
+ a simple term definition is used where the value ends with a URI gen-delim character,
+ or if their expanded term definition contains
+ a This represents a small change to the 1.0 algorithm to prevent IRIs
+ that are not really intended to be used as prefixes from being used for creating
+ compact IRIs. When processing mode is set to In this case, the compact-iris term would not normally be usable as a prefix, both
+ because it is defined with an expanded term definition, and because
+ it's This section is non-normative.
+ A value with an associated type, also known as a
+ typed value, is indicated by associating a value with
+ an IRI which indicates the value's type. Typed values may be
+ expressed in JSON-LD in three ways:
+ The first example uses the The modified key's value above is automatically type coerced to a
+ dateTime value because of the information specified in the
+ The second example uses the expanded form of setting the type information
+in the body of a JSON-LD document: Both examples above would generate the value
+ The A node type specifies the type of thing
+ that is being described, like a person, place, event, or web page. A
+ value type specifies the data type of a particular value, such
+ as an integer, a floating point number, or a date. The first use of This section is non-normative. JSON-LD supports the coercion of values to particular data types.
+Type coercion allows someone deploying JSON-LD to coerce the incoming or
+outgoing values to the proper data type based on a mapping of data type IRIs to
+terms. Using type coercion, value representation is preserved without requiring
+the data type to be specified with each piece of data. Type coercion is specified within an expanded term definition
+ using the Terms or compact IRIs used as the value of a
+ The example below demonstrates how a JSON-LD author can coerce values to
+typed values and IRIs. The example shown above would generate the following data. Terms may also be defined using absolute IRIs
+ or compact IRIs. This allows coercion rules
+ to be applied to keys which are not represented as a simple term.
+ For example: In this case the Type coercion is always performed using the unexpanded value of the key. In the
+ example above, that means that type coercion is done looking for Keys in the context are treated as terms for the purpose of
+ expansion and value coercion. At times, this may result in multiple representations for the same expanded IRI.
+ For example, one could specify that This section is non-normative. Embedding is a JSON-LD feature that allows an author to
+ use node objects as
+ property values. This is a commonly used mechanism for
+ creating a parent-child relationship between two nodes. Without embedding, node objects can be linked by referencing the
+ identifier of another node object. For example: The previous example describes two node objects, for Manu and Gregg, with
+ the A node object, like the one used above, may be used in
+ any value position in the body of a JSON-LD document. Note that type coercion of the This section is non-normative. Section 3.1 The Context introduced the basics of what makes
+ JSON-LD work. This section expands on the basic principles of the
+ context and demonstrates how more advanced use cases can
+ be achieved using JSON-LD. In general, contexts may be used at any time a
+ JSON object is defined.
+ The only time that one cannot express a context is as a direct child of another context definition.
+ For example, a JSON-LD document may use more than one context at different
+ points in a document: Duplicate context terms are overridden using a
+ most-recently-defined-wins mechanism. In the example above, the Multiple contexts may be combined using an array, which is processed
+ in order. The set of contexts defined within a specific JSON object are
+ referred to as local contexts. The
+ active context refers to the accumulation of
+ local contexts that are in scope at a
+ specific point within the document. Setting a local context
+ to When possible, the context definition should be put
+ at the top of a JSON-LD document. This makes the document easier to read and
+ might make streaming parsers more efficient. Documents that do not have the
+ context at the top are still conformant JSON-LD. To avoid forward-compatibility issues, terms
+ starting with an Ordinary JSON documents can be interpreted as JSON-LD
+ by providing an explicit JSON-LD context document. One way
+ to provide this is by using referencing a JSON-LD
+ context document in an HTTP Link Header.
+ Doing so allows JSON to be unambiguously machine-readable without requiring developers to drastically
+ change their documents and provides an upgrade path for existing infrastructure
+ without breaking existing clients that rely on the In order to use an external context with an ordinary JSON document,
+ when retrieving an ordinary JSON document via HTTP, processors MUST
+ retrieve any JSON-LD document referenced by a
+ Link Header with: The referenced document MUST have a top-level JSON object.
+ The Other mechanisms for providing a JSON-LD Context MAY be described for other
+ URI schemes. The JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API]
+ provides for an expandContext option for specifying
+ a context to use when expanding JSON documents programatically. The following example demonstrates the use of an external context with an
+ ordinary JSON document over HTTP: Please note that JSON-LD documents
+ served with the This section is non-normative. At times, it is important to annotate a string
+ with its language. In JSON-LD this is possible in a variety of ways.
+ First, it is possible to define a default language for a JSON-LD document
+ by setting the The example above would associate the To clear the default language for a subtree, Second, it is possible to associate a language with a specific term
+ using an expanded term definition: The example above would associate 忍者 with the specified default
+ language code Language associations are only applied to plain
+ strings. Typed values
+ or values that are subject to type coercion
+ are not language tagged. Just as in the example above, systems often need to express the value of a
+ property in multiple languages. Typically, such systems also try to ensure that
+ developers have a programmatically easy way to navigate the data structures for
+ the language-specific data. In this case, language maps
+ may be utilized. The example above expresses exactly the same information as the previous
+ example but consolidates all values in a single property. To access the
+ value in a specific language in a programming language supporting dot-notation
+ accessors for object properties, a developer may use the
+ Third, it is possible to override the default language by using a
+ value object: This makes it possible to specify a plain string by omitting the
+ This section is non-normative. In general, normal IRI expansion rules apply
+ anywhere an IRI is expected (see section 3.2 IRIs). Within
+ a context definition, this can mean that terms defined
+ within the context may also be used within that context as long as
+ there are no circular dependencies. For example, it is common to use
+ the In this example, the Terms may also be used when defining the IRI of another
+term: Compact IRIs
+ and IRIs may be used on the left-hand side of a
+ term definition.
+In this example, the compact IRI form is used in two different
+ways.
+In the first approach,
+Absolute IRIs may also be used in the key position in a context:
+ In order for the absolute IRI to match above, the absolute IRI
+ needs to be used in the JSON-LD document. Also note that While it is possible to define a compact IRI, or
+ an absolute IRI to expand to some other unrelated IRI
+ (for example, The only exception for using terms in the context is that
+ circular definitions are not allowed. That is,
+ a definition of term1 cannot depend on the
+ definition of term2 if term2 also depends on
+ term1. For example, the following context definition
+ is illegal: This section is non-normative. A JSON-LD author can express multiple values in a compact way by using
+ arrays. Since graphs do not describe ordering for links
+ between nodes, arrays in JSON-LD do not provide an ordering of the
+ contained elements by default. This is exactly the opposite from regular JSON
+ arrays, which are ordered by default. For example, consider the following
+ simple document: The example shown above would result in the following data being generated,
+ each relating the node to an individual value, with no inherent order: Multiple values may also be expressed using the expanded form: The example shown above would generate the following data, again with
+ no inherent order: Although multiple values of a property are typically of the same type,
+ JSON-LD places no restriction on this, and a property may have values
+ of different types: The example shown above would generate the following data, also with
+ no inherent order: As the notion of ordered collections is rather important in data
+ modeling, it is useful to have specific language support. In JSON-LD,
+ a list may be represented using the This describes the use of this array as being ordered,
+ and order is maintained when processing a document. If every use of a given multi-valued
+ property is a list, this may be abbreviated by setting List of lists in the form of list objects
+ are not allowed in this version of JSON-LD. This decision was made due to the
+ extreme amount of added complexity when processing lists of lists. While This section is non-normative. JSON-LD serializes directed graphs. That means that
+ every property points from a node to another node
+ or value. However, in some cases, it is desirable
+ to serialize in the reverse direction. Consider for example the case where a person
+ and its children should be described in a document. If the used vocabulary does not
+ provide a children property but just a parent
+ property, every node representing a child would have to
+ be expressed with a property pointing to the parent as in the following
+ example. Expressing such data is much simpler by using JSON-LD's The This section is non-normative. An expanded term definition can include a In this case, the social profile is defined using the schema.org vocabulary, but interest is imported from FOAF, and is used to define a node describing one of Manu's interests where those properties now come from the FOAF vocabulary. Expanding this document, uses a combination of terms defined in the outer context, and those defined specifically for that term in an embedded context. Scoping can also be performed using a term used as a value of Scoping on When expanding, each value of The values of If a term defines a scoped context, and then that term
+ is later re-defined, the association of the context defined in the earlier
+ expanded term definition is lost
+ within the scope of that re-definition. This is consistent with
+ term definitions of a term overriding previous term definitions from
+ earlier less deeply nested definitions, as discussed in
+ section 4.8 Advanced Context Usage. Scoped Contexts are a new feature in JSON-LD 1.1, requiring
+ processing mode set to This section is non-normative. At times, it is necessary to make statements about a graph
+ itself, rather than just a single node. This can be done by
+ grouping a set of nodes using the The example above expresses a named graph that is identified
+ by the Blank Node identifier When a JSON-LD document's top-level structure is an
+ object that contains no other
+ properties than In this case, embedding doesn't work as each node object
+ references the other. This is equivalent to using multiple
+ node objects in array and defining
+ the In some cases, it is useful to logically partition data into separate
+ graphs, without making this explicit within the JSON expression. For
+ example, a JSON document may contain data against which other metadata is
+ asserted and it is useful to separate this data in the data model using
+ the notion of named graphs, without the syntactic overhead
+ associated with the An expanded term definition can use An alternative to our example above could use an anonymously named graph
+ as follows: The example above expresses a named graph that is identified
+ by the blank node identifier Expanding this graph results in the following: Strictly speaking, the value of such a term
+ is not a named graph, rather it is the graph name
+ associated with the named graph, which exists separately within
+ the dataset. Graph Containers are a new feature in JSON-LD 1.1, requiring
+ processing mode set to This section is non-normative. At times, it becomes necessary to be able to express information without
+ being able to uniquely identify the node with an IRI.
+ This type of node is called a blank node. JSON-LD does not require
+ all nodes to be identified using The example above contains information about two secret agents that cannot be identified
+ with an IRI. While expressing that agent 1 knows agent 2
+ is possible without using blank node identifiers,
+ it is necessary to assign agent 1 an identifier so that it can be referenced
+ from agent 2. It is worth noting that blank node identifiers may be relabeled during processing.
+ If a developer finds that they refer to the blank node more than once,
+ they should consider naming the node using a dereferenceable IRI so that
+ it can also be referenced from other documents. This section is non-normative. Each of the JSON-LD keywords,
+ except for In the example above, the Since keywords cannot be redefined, they can also not be aliased to
+ other keywords. This section is non-normative. Databases are typically used to make access to
+ data more efficient. Developers often extend this sort of functionality into
+ their application data to deliver similar performance gains. Often this
+ data does not have any meaning from a Linked Data standpoint, but is
+ still useful for an application. JSON-LD introduces the notion of index maps
+ that can be used to structure data into a form that is
+ more efficient to access. The data indexing feature allows an author to
+ structure data using a simple key-value map where the keys do not map
+ to IRIs. This enables direct access to data
+ instead of having to scan an array in search of a specific item.
+ In JSON-LD such data can be specified by associating the
+ In the example above, the post term has
+ been marked as an index map. The en and
+ de keys will be ignored semantically, but preserved
+ syntactically, by the JSON-LD Processor. This allows a developer to
+ access the German version of the post using the
+ following code snippet: The interpretation of the data above is expressed in
+ the table below. Note how the index keys do not appear in the Linked Data
+ below, but would continue to exist if the document were compacted or
+ expanded (see section 4.26 Compacted Document Form and
+ section 4.25 Expanded Document Form) using a JSON-LD processor: The value of If the processing mode is set to In addition to indexing node objects by index, graph objects may
+ also be indexed by an index. By using the The following example describes a default graph referencing multiple named
+ graphs using an index map. This expands to the following: When expressed as Quads, this becomes the following: As with index maps, when used with If the processing mode is set to This expands to the following: This section is non-normative. JSON which includes string values in multiple languages may be
+ represented using a language map to allow for easily
+ indexing property values by language tag. This enables direct access to
+ language values instead of having to scan an array in search of a specific item.
+ In JSON-LD such data can be specified by associating the
+ In the example above, the label term has
+ been marked as an language map. The en and
+ de keys are implicitly associated with their respective
+ values by the JSON-LD Processor. This allows a developer to
+ access the German version of the label using the
+ following code snippet: The value of If the processing mode is set to This section is non-normative. In addition to index maps, JSON-LD introduces the notion of id maps
+ for structuring data. The id indexing feature allows an author to
+ structure data using a simple key-value map where the keys map
+ to IRIs. This enables direct access to associated node objects
+ instead of having to scan an array in search of a specific item.
+ In JSON-LD such data can be specified by associating the
+ In the example above, the The interpretation of the data above is exactly the same
+ as that in section 4.18 Data Indexing
+ using a JSON-LD processor. The value of The special index Id maps are a new feature in JSON-LD 1.1, requiring
+ processing mode set to In addition to indexing node objects by identifier, graph objects may
+ also be indexed by their graph name. By using the The following example describes a default graph referencing multiple named
+ graphs using an id map. This expands to the following: When expressed as Quads, this becomes the following: As with id maps, when used with As with id maps, the special index Graph Containers are a new feature in JSON-LD 1.1, requiring
+ processing mode set to This section is non-normative. In addition to id and index maps, JSON-LD introduces the notion of type maps
+ for structuring data. The type indexing feature allows an author to
+ structure data using a simple key-value map where the keys map
+ to IRIs. This enables data to be structured based on the In the example above, the The value of The special index As with id maps, when used with Type maps are a new feature in JSON-LD 1.1, requiring
+ processing mode set to This section is non-normative. Many JSON APIs separate properties from their entities using an
+ intermediate object; in JSON-LD these are called nested properties.
+ For example, a set of possible labels may be grouped
+ under a common property: By defining labels using the keyword Similarly, node definitions may contain a Nested properties are a new feature in JSON-LD 1.1, requiring
+ processing mode set to This section is non-normative. The JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API]
+ defines a method for expanding a JSON-LD document.
+ Expansion is the process of taking a JSON-LD document and applying a
+ For example, assume the following JSON-LD input document: Running the JSON-LD Expansion algorithm against the JSON-LD input document
+ provided above would result in the following output: JSON-LD's media type defines a
+ This section is non-normative. The JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API] defines
+ a method for compacting a JSON-LD document. Compaction is the process
+ of applying a developer-supplied context to shorten IRIs
+ to terms or compact IRIs
+ and JSON-LD values expressed in expanded form to simple values such as
+ strings or numbers.
+ Often this makes it simpler to work with document as the data is expressed in
+ application-specific terms. Compacted documents are also typically easier to read
+ for humans. For example, assume the following JSON-LD input document: Additionally, assume the following developer-supplied JSON-LD context: 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: JSON-LD's media type defines a
+ This section is non-normative. The JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API] defines
+ a method for flattening a JSON-LD document. Flattening collects all
+ properties of a node in a single JSON object and labels
+ all blank nodes with
+ blank node identifiers.
+ This ensures a shape of the data and consequently may drastically simplify the code
+ required to process JSON-LD in certain applications. For example, assume the following JSON-LD input document: Running the JSON-LD Flattening algorithm against the JSON-LD input document in
+ the example above and using the same context would result in the following
+ output: JSON-LD's media type defines a
+ This section is non-normative. HTML script tags can be used to embed blocks of data in documents.
+ This way, JSON-LD content can be easily embedded in HTML by placing
+ it in a script element with the Depending on how the HTML document is served, certain strings may need
+ to be escaped. Defining how such data may be used is beyond the scope of this specification.
+ The embedded JSON-LD document might be extracted as is or, e.g., be
+ interpreted as RDF. If JSON-LD content is extracted as RDF [RDF11-CONCEPTS], it should be expanded into an
+ RDF Dataset using the
+ Deserialize JSON-LD to RDF Algorithm
+ [JSON-LD11CG-API]. JSON-LD is a serialization format for Linked Data based on JSON.
+ It is therefore important to distinguish between the syntax, which is
+ defined by JSON in [RFC7159], and the data model which is
+ an extension of the RDF data model [RDF11-CONCEPTS]. The precise
+ details of how JSON-LD relates to the RDF data model are given in
+ section 7. Relationship to RDF. To ease understanding for developers unfamiliar with the RDF model, the
+ following summary is provided: JSON-LD documents MAY contain data
+ that cannot be represented by the data model
+ defined above. Unless otherwise specified, such data is ignored when a
+ JSON-LD document is being processed. One result of this rule
+ is that properties which are not mapped to an IRI,
+ a blank node, or keyword will be ignored. Additionally, the JSON serialization format is internally represented using
+ the JSON-LD internal representation, which uses the generic
+ concepts of arrays, dictionaries,
+ strings, numbers, booleans, and null to describe
+ the data represented by a JSON document. Figure 1: An illustration of the data model. This appendix restates the syntactic conventions described in the
+ previous sections more formally. A JSON-LD document MUST be valid JSON text as described
+ in [RFC7159], or some format that can be represented
+ in the JSON-LD internal representation that is equivalent to
+ valid JSON text. A JSON-LD document MUST be a single node object,
+ a JSON object consisting of only
+ the members In contrast to JSON, in JSON-LD the keys in objects
+ MUST be unique. JSON-LD allows keywords to be aliased
+ (see section 4.17 Aliasing Keywords for details). Whenever a keyword is
+ discussed in this grammar, the statements also apply to an alias for
+ that keyword. For example, if the active context
+ defines the term A term is a short-hand string that expands
+ to an IRI or a blank node identifier. A term MUST NOT equal any of the JSON-LD
+ keywords. When used as the prefix in a Compact IRI, to avoid
+ the potential ambiguity of a prefix being confused with an IRI
+ scheme, terms SHOULD NOT come from the list of URI schemes as defined in
+ [IANA-URI-SCHEMES]. Similarly, to avoid confusion between a
+ Compact IRI and a term, terms SHOULD NOT include a colon ( To avoid forward-compatibility issues, a term SHOULD NOT start
+ with an See section 3.1 The Context and
+ section 3.2 IRIs for further discussion
+ on mapping terms to IRIs. A node object represents zero or more properties of a
+ node in the graph serialized by the
+ JSON-LD document. A JSON object is a
+ node object if it exists outside of a JSON-LD
+ context and: The properties of a node in
+ a graph may be spread among different
+ node objects within a document. When
+ that happens, the keys of the different
+ node objects need to be merged to create the
+ properties of the resulting node. A node object MUST be a JSON object. All keys
+ which are not IRIs, compact IRIs, terms valid in the
+ active context, or one of the following keywords
+ (or alias of such a keyword)
+ MUST be ignored when processed: If the node object contains the If the node object contains the If the node object contains the If the node object contains the If the node object contains the If the node object contains the If the node object contains the Keys in a node object that are not
+ keywords MAY expand to an absolute IRI
+ using the active context. The values associated with keys that expand
+ to an absolute IRI MUST be one of the following: A graph object represents a named graph, which MAY include
+ include an explicit graph name.
+ A JSON object is a graph object if
+ it exists outside of a JSON-LD context,
+ it is not a node object,
+ it is not the top-most JSON object in the JSON-LD document, and
+ it consists of no members other than If the graph object contains the If the graph object contains the A graph object without an The value of the A value object is used to explicitly associate a type or a
+ language with a value to create a typed value or a language-tagged
+ string. A value object MUST be a JSON object containing the
+ The value associated with the The value associated with the The value associated with the The value associated with the See section 4.5 Typed Values and
+ section 4.10 String Internationalization
+ for more information on value objects. A list represents an ordered set of values. A set
+ represents an unordered set of values. Unless otherwise specified,
+ arrays are unordered in JSON-LD. As such, the
+ A list object MUST be a JSON object that contains no
+ keys that expand to an absolute IRI or keyword other
+ than A set object MUST be a JSON object that contains no
+ keys that expand to an absolute IRI or keyword other
+ than In both cases, the value associated with the keys See section 4.12 Sets and Lists for further discussion on sets and lists. A language map is used to associate a language with a value in a
+ way that allows easy programmatic access. A language map may be
+ used as a term value within a node object if the term is defined
+ with See section 4.10 String Internationalization for further discussion
+ on language maps. An index map allows keys that have no semantic meaning,
+ but should be preserved regardless, to be used in JSON-LD documents.
+ An index map may
+ be used as a term value within a node object if the
+ term is defined with See section 4.18 Data Indexing for further information on this topic. Index Maps may also be used to map indexes to associated
+ named graphs, if the term is defined with An id map is used to associate an IRI with a value that allows easy
+ programmatic access. An id map may be used as a term value within a node object if the term
+ is defined with If the value contains a property expanding to Id Maps may also be used to map graph names to their
+ named graphs, if the term is defined with A type map is used to associate an IRI with a value that allows easy
+ programmatic access. A type map may be used as a term value within a node object if the term
+ is defined with If the value contains a property expanding to A nested property is used to gather properties of a node object in a separate
+ JSON object, or array of JSON objects which are not
+ value objects. It is semantically transparent and is removed
+ during the process of expansion. Property nesting is recursive, and
+ collections of nested properties may contain further nesting. Semantically, nesting is treated as if the properties and values were declared directly
+ within the containing node object. A context definition defines a local context in a
+ node object. A context definition MUST be a JSON object whose
+ keys MUST be either terms, compact IRIs, absolute IRIs,
+ or one of the keywords If the context definition has an If the context definition has an If the context definition has an If the context definition has an The value of keys that are not keywords MUST be either an
+ absolute IRI, a compact IRI, a term,
+ a blank node identifier, a keyword, null,
+ or an expanded term definition. An expanded term definition is used to describe the mapping
+ between a term and its expanded identifier, as well as other
+ properties of the value associated with the term when it is
+ used as key in a node object. An expanded term definition MUST be a JSON object
+ composed of zero or more keys from
+ If the term being defined is not a compact IRI or
+ absolute IRI and the active context does not have an
+ If the expanded term definition contains the If an expanded term definition has an If the expanded term definition contains the If the expanded term definition contains the If the expanded term definition contains the If an expanded term definition has an If the expanded term definition contains the If the expanded term definition contains the Terms MUST NOT be used in a circular manner. That is,
+ the definition of a term cannot depend on the definition of another term if that other
+ term also depends on the first term. See section 3.1 The Context for further discussion on contexts. JSON-LD is a
+ concrete RDF syntax
+ as described in [RDF11-CONCEPTS]. Hence, a JSON-LD document is both an
+ RDF document and a JSON document and correspondingly represents an
+ instance of an RDF data model. However, JSON-LD also extends the RDF data
+ model to optionally allow JSON-LD to serialize
+ generalized RDF Datasets.
+ The JSON-LD extensions to the RDF data model are: Summarized, these differences mean that JSON-LD is capable of serializing any RDF
+ graph or dataset and most, but not all, JSON-LD documents can be directly
+ interpreted as RDF as described in RDF 1.1 Concepts [RDF11-CONCEPTS]. For authors and developers working with blank nodes
+ as properties when deserializing to RDF,
+ three potential approaches are suggested: The normative algorithms for interpreting JSON-LD as RDF and serializing
+ RDF as JSON-LD are specified in the JSON-LD 1.1 Processing Algorithms and API
+ specification [JSON-LD11CG-API]. Even though JSON-LD serializes
+ generalized RDF Datasets, it can
+ also be used as a RDF graph source.
+ In that case, a consumer MUST only use the default graph and ignore all named graphs.
+ This allows servers to expose data in languages such as Turtle and JSON-LD
+ using content negotiation. Publishers supporting both dataset and graph syntaxes have to ensure that
+ the primary data is stored in the default graph to enable consumers that do not support
+ datasets to process the information. This section is non-normative. The process of serializing RDF as JSON-LD and deserializing JSON-LD to RDF
+ depends on executing the algorithms defined in
+ RDF Serialization-Deserialization Algorithms
+ in the JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API].
+ It is beyond the scope of this document to detail these algorithms any further,
+ but a summary of the necessary operations is provided to illustrate the process. The procedure to deserialize a JSON-LD document to RDF involves the
+ following steps: For example, consider the following JSON-LD document in compact form: Running the JSON-LD Expansion and Flattening algorithms against the
+ JSON-LD input document in the example above would result in the
+ following output: Deserializing this to RDF now is a straightforward process of turning
+ each node object into one or more RDF triples. This can be
+ expressed in Turtle as follows: The process of serializing RDF as JSON-LD can be thought of as the
+ inverse of this last step, creating an expanded JSON-LD document closely
+ matching the triples from RDF, using a single node object
+ for all triples having a common subject, and a single property
+ for those triples also having a common predicate. This section is non-normative. This section is non-normative. The following is a list of issues open at the time of publication. Thanks for the great work with JSON-LD! However, when trying to use JSON-LD for to present data in the company I'm working in, I noticed the following missing feature: FEATURE PROPOSAL: ABILITY TO DEFINE ANY KEY AS AN INDEX KEY In addition to JSON-LD's existing index container structure, I propose that any key under a JSON-LD node could be defined as a index key. This would help clustering data under a node into coder friendly logical groups without messing up the Linked Data interpretation with e.g. blank nodes. I encountered the need for this feature at our company where our problem is that the amount of attributes a single JSON-LD node can have can potentially be quite many, say, tens or hundreds of attributes. As far as I know, this can not be currently done with JSON-LD without 1) ending up with blank nodes or 2) the need to create a deeper JSON structure by using a separate index term (using "@container":"@index") which then contains the data underneath. In addition, if a single key could be defined as a index term, this would make it more flexible to attach the JSON-LD Linked Data interpretation to even a wider amount of existing JSON data, without having to change the structure of such data (and without ending up with e.g. lots of blank nodes). DEFINING AN INDIVIDUAL INDEX KEY IN @context The "@context" definition could be done e.g. using the existing reserved keyword "@index" in the following way: which should be interpreted in the following way: 1) the "indexkey" is an index key and should be skipped when traversing the JSON tree while doing the JSON-LD to RDF interpretation, 2) any data directly under the "indexkey" should be interpreted as data directly attached to the node of the indexkey (same RDF subject). EXAMPLE To give a full example, in the following a single key "labels" is defined as an index index key to help grouping the data into coder friendly logical groups without messing up the Linked Data interpretation): This example JSON-LD should generate the following RDF triplets: When using JSON-LD in a browser (XMLHttpRequest) it is impossible to discover the Base IRI after a redirect because the XHR object hides the final URL of the resource. This means documents without an explicit base URI cannot be resolved into triples in a browser This has already been discussed several times usingvarious terms.. the most recent request has come from David Janes on the mailing list. The basic idea is to support JSON values/subtrees that aren't mapped to an IRI in the context. They should survive algorithmic transformations (basically without being touched at all). See: digitalbazaar/jsonld.js#72 It would be helpful to have the ability to use @language within an object as a shorthand for "@context": {"@language": "..."} ... for instance... make: equivalent to: In the spirit of "Labeling Everything" (http://patterns.dataincubator.org/book/label-everything.html) ... it would be worthwhile, IMO, for JSON-LD to provide a basic @Label keyword for use both in @context and nodes. It's largely syntactic sugar but would be useful. For example: Which would expand to: Many JSON specs existed before JSON-LD. A couple of these specs may not be compatible with JSON-LD as they contain multidimensional containers, such as GeoJSON. Example of a multidimensional array: This issue is a result from the discussion on the GeoJSON-LD repository: geojson/geojson-ld#32. If this issue will not get resolved, the GeoJSON-LD community would suggest creating custom JSON-LD parsers for JSON-LD dialects. This situation would be far from desirable. Introduce a new When an array is given in the When an object is given in the Would transform to (and vice versa): Hi all, I've recently been trying to design a JSON format to act as a bridge between the RDF world and the typical JSON developer. However due to complexities in the underlying RDF ontology, it is proving almost impossible with the current JSON-LD features to create both an easy to use JSON format and an isomorphic representation of the semantic graph from which the data is derived. My primary goal is basically to create a useful JSON format and I don't really care about the semantics expressed via the RDF interpreatation of the JSON at all. My feeling is that if our users want the RDF interpretation they can I really want to leverage only the JSON side semantics of JSON-LD as a means to give JSON users access to linked data URI's (which are syntactically For me this is perhaps the most exciting application of JSON-LD, and I think it'd be nice if there was a way to formally tell processors and users, to not process it as RDF. Basically I can get the syntax I want at the expense of RDF semantics, and I'd like to inform users "not to interpret this as RDF". I realise I can achieve this by taking advantage of the fact that processors don't pursue keys that they don't know about in the context. However it might be nice to flag this to users, incase they think it's going to yield some meaningful RDF. I'm sure you've thought about cases like these, so I'm curious what you think the best way to tackle it is. Also please pass on my thanks to everyone in the Working Group for coming up with what looks to be a great new standard. the current descriptions provide means to specify encoding and framing options through a programmatic api. these include the context to apply, whether to frame the result. the 1.0 descriptions do not appear to provide a way to specify that same information to a json-ld source as part of an http request. In the Verifiable Claims (and other) groups, the concern about things such as JSON-LD contexts changing meaning over time came up. On thought would be to create a convention, or rely upon some other standard, to allow URIs to be "content addressable", in the sense that it can be determined that the content derived from dereferencing a remote resource can be determined to be the same content as was originally intended. There's also a desire to be able to pre-load contexts, without requiring that they be downloaded when accessed, which could be addressed using such a mechanism. There are also some proposed RFCs that attempt to address this problem (thanks to @mesinter): 'duri' URI takes the form: 'tdb' URI takes a similar form: Comments at TPAC suggested that as our work is a breaking change (causing 1.0 processors that are not 1.1 compatible to intentionally break when they see This could impact a potential WG, which may want to make further changes, and then be in the place of using either In some situations it is important/necessary to include the base direction of a text, alongside its language; see the “Requirements for Language and Direction Metadata in Data Formats” for further details. In practice, in a vanilla JSON, it would require something like: (the example comes from that document). At this moment, I believe the only way you can reasonably express that in JSON-LD is via cheating a bit: and making sure that the The difficulty lies in the RDF layer, in fact; RDF does not have any means (alas!) to express text direction. On the other hand, this missing feature is a general I18N problem whenever JSON-LD is used (there were issues when developing the Web Annotation Model, these issues are popping up in the Web Publication work, etc.). Here is what I would propose as a non-complete solution Cc: @BigBlueHat @r12a JSON-LD has a restriction that terms must not be the empty string From JSON-LD Syntax 6.1: Furthermore, the term MUST NOT be an empty string ("") as not all programming languages are able to handle empty JSON keys. IIRC, this was added due to an issue in an earlier version of PHP, and I suspect it is no longer an issue. Furthermore, the use of empty prefixes is common in other RDF syntaxes, so allowing it here for 1.1 documents would be reasonable, if tooling supports it. As evidence, consider this stackoverflow question. Also, note that while the syntax document makes such a normative statement, the API algorithms don't call this out as an error condition. It is currently not possible to have all three of Any time there is markdown, html, xml, json, yaml, latex, or any other formatting instructions beyond simply print the string to the user, this becomes extremely valuable. Given the usage of those formats on the web, it would enable appropriate management of internationalized texts. Example: Reference: https://lists.w3.org/Archives/Public/public-linked-json/2014Aug/0031.html One of my chief concerns for using JSON-LD in the Beaker/Dat ecosystem is that vocabulary IRIs will be too burdensome for developers to create and maintain consistently. I think often it will be done, but many times devs won't be bothered. To counter that, I'd like to investigate a "Lax" IRI form which allows an arbitrary string to be used. The string would not be registered to any global ownership system (not DNS, not a urn registry, not a public key, not a content hash). Users would be encouraged to use a string that is long and unlikely to collide with other strings, but there would be no enforcement mechanism. For instance, The goal would be to create identifiers which behave like IRIs, but which are human readable and which don't require any registration and maintenance of the ID. Rather than a locator to documentation, the Lax IRI would be a label which could be used to discover documentation (on Google, etc). The original author of the identifier would ideally publish documentation somewhere searchable, but it would not be required. To continue from my example, I'd publish a document labeled I've not found any existing IRI scheme that matches my description yet. There are probably two discussions to have in response to this exploration: As for whether it would be a net benefit, the reasoning I'd give is that some information is better than no information, and if developers are going to abstain from providing a vocabulary IRI because of the difficulty, wouldn't it be better to have a low-effort solution? A "lax" IRI trades total specificity for improved specificity. And, bear in mind, many developers in my audience are going to be building for fun. A valid counter-argument to my reasoning is, if you create the "lax" option, you may get more IRIs overall, but you risk getting fewer "non-lax" IRIs overall. (Once the option to be lazy is given, then won't everybody be lazy?) So the precision of the global system might suffer overall. Per a suggestion by @danbri, we may want to add a container type, similar to Markup might look like the following: This would expand to the following: Otherwise, it works like When compacting, the processor will re-order items based on Expansion shows 1-base position, but could be 0-base as well. Note that specific Looking at a schema.org example for ItemList, there is a JSON-LD example which includes the fictitious There's nothing to signal an issue, and a JSON-LD processor will happily resolve this relative to cc/ @danbri This section is non-normative. The JSON-LD examples below demonstrate how JSON-LD can be used to
+ express semantic data marked up in other linked data formats such as Turtle,
+ RDFa, Microformats, and Microdata. These sections are merely provided as
+ evidence that JSON-LD is very flexible in what it can express across different
+ Linked Data approaches. This section is non-normative. The following are examples of transforming RDF expressed in Turtle [TURTLE]
+ into JSON-LD. The JSON-LD context has direct equivalents for the Turtle
+ Both Turtle and JSON-LD allow embedding, although Turtle only allows embedding of
+ blank nodes. In JSON-LD numbers and boolean values are native data types. While Turtle
+ has a shorthand syntax to express such values, RDF's abstract syntax requires
+ that numbers and boolean values are represented as typed literals. Thus,
+ to allow full round-tripping, the JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API]
+ defines conversion rules between JSON-LD's native data types and RDF's
+ counterparts. Numbers without fractions are
+ converted to Both JSON-LD and Turtle can represent sequential lists of values. This section is non-normative. The following example describes three people with their respective names and
+ homepages in RDFa [RDFA-CORE]. An example JSON-LD implementation using a single context is
+ described below. This section is non-normative. The following example uses a simple Microformats hCard example to express
+ how Microformats [MICROFORMATS] are represented in JSON-LD. The representation of the hCard expresses the Microformat terms in the
+ context and uses them directly for the This section is non-normative. The HTML Microdata [MICRODATA] example below expresses book information as
+ a Microdata Work item. Note that the JSON-LD representation of the Microdata information stays
+ true to the desires of the Microdata community to avoid contexts and
+ instead refer to items by their full IRI. This section has been submitted to the Internet Engineering Steering
+ Group (IESG) for review, approval, and registration with IANA. A non-empty list of space-separated URIs identifying specific
+ constraints or conventions that apply to a JSON-LD document according to [RFC6906].
+ A profile does not change the semantics of the resource representation
+ when processed without profile knowledge, so that clients both with
+ and without knowledge of a profiled resource can safely use the same
+ representation. The This specification defines three values for the When processing the "profile" media type parameter, it is important to
+ note that its value contains one or more URIs and not IRIs. In some cases
+ it might therefore be necessary to convert between IRIs and URIs as specified in
+ section 3 Relationship between IRIs and URIs
+ of [RFC3987]. Since JSON-LD is intended to be a pure data exchange format for
+ directed graphs, the serialization SHOULD NOT be passed through a
+ code execution mechanism such as JavaScript's When processing JSON-LD documents, links to remote contexts are
+ typically followed automatically, resulting in the transfer of files
+ without the explicit request of the user for each one. If remote
+ contexts are served by third parties, it may allow them to gather
+ usage patterns or similar information leading to privacy concerns.
+ Specific implementations, such as the API defined in the
+ JSON-LD 1.1 Processing Algorithms and API specification [JSON-LD11CG-API],
+ may provide fine-grained mechanisms to control this behavior. JSON-LD contexts that are loaded from the Web over non-secure connections,
+ such as HTTP, run the risk of being altered by an attacker such that
+ they may modify the JSON-LD active context in a way that
+ could compromise security. It is advised that any application that
+ depends on a remote context for mission critical purposes vet and
+ cache the remote context before allowing the system to use it. Given that JSON-LD allows the substitution of long IRIs with short terms,
+ JSON-LD documents may expand considerably when processed and, in the worst case,
+ the resulting data might consume all of the recipient's resources. Applications
+ should treat any data with due skepticism. Fragment identifiers used with application/ld+json
+ are treated as in RDF syntaxes, as per
+ RDF 1.1 Concepts and Abstract Syntax
+ [RDF11-CONCEPTS]. Consider requirements from Self-Review Questionnaire: Security and Privacy. This section is non-normative. The authors would like to extend a deep appreciation and the most sincere
+ thanks to Mark Birbeck, who contributed foundational concepts
+ to JSON-LD via his work on RDFj. JSON-LD uses a number of core concepts
+ introduced in RDFj, such as the context as a mechanism to provide an
+ environment for interpreting JSON data. Mark had also been very involved in
+ the work on RDFa as well. RDFj built upon that work. JSON-LD exists
+ because of the work and ideas he started nearly a decade ago in 2004. A large amount of thanks goes out to the JSON-LD Community Group
+ participants who worked through many of the technical issues on the mailing
+ list and the weekly telecons - of special mention are François Daoust,
+ Stéphane Corlosquet, Lin Clark, and Zdenko 'Denny' Vrandečić. The work of David I. Lehn and Mike Johnson are appreciated for
+ reviewing, and performing several early implementations
+ of the specification. Thanks also to Ian Davis for this work on RDF/JSON. Thanks to the following individuals, in order of their first name, for
+ their input on the specification: Adrian Walker, Alexandre Passant,
+ Andy Seaborne, Ben Adida, Blaine Cook, Bradley Allen, Brian Peterson,
+ Bryan Thompson, Conal Tuohy, Dan Brickley, Danny Ayers, Daniel Leja,
+ Dave Reynolds, David Booth, David I. Lehn, David Wood, Dean Landolt,
+ Ed Summers, elf Pavlik,
+ Eric Prud'hommeaux, Erik Wilde, Fabian Christ, Jon A. Frost, Gavin Carothers,
+ Glenn McDonald, Guus Schreiber, Henri Bergius, Jose María Alvarez Rodríguez,
+ Ivan Herman, Jack Moffitt, Josh Mandel, KANZAKI Masahide, Kingsley Idehen,
+ Kuno Woudt, Larry Garfield, Mark Baker, Mark MacGillivray, Marko Rodriguez,
+ Marios Meimaris, Matt Wuerstl,
+ Melvin Carvalho, Nathan Rixham, Olivier Grisel, Paolo Ciccarese, Pat Hayes,
+ Patrick Logan, Paul Kuykendall, Pelle Braendgaard,
+ Peter Patel-Schneider, Peter Williams, Pierre-Antoine Champin,
+ Richard Cyganiak, Roy T. Fielding, Sandro Hawke, Simon Grant, Srecko Joksimovic,
+ Stephane Fellah, Steve Harris, Ted Thibodeau Jr., Thomas Steiner, Tim Bray,
+ Tom Morris, Tristan King, Sergio Fernández, Werner Wilms, and William Waites. ^Xc$Vdz
zj%>pgL(qFmc0v5~16z`eMA+wX&i85VzO-~merI1aUwNHYRB-s^mgI#(-+xTY_41Ch
zJKm4xK@td4=`9F=Dy-@BjOzHv4{ahwma~RW0sLNBjjjVee7d&3ev$Bsu @SlHy{ht|cTS03>t9bo9mP+PB=Iu|V2yrzd}ouu2rcA}xRn
z)7RH`zRqg2XXWWBPFgzA(MsHvA5FY@^?3jvXQ?^W^skvvY+*G+;LneV5?M0hL8K>x
zA9!}RBUbO1m!GfmXK6I)@F6M4z}k-s4{R;X)&HPsp#cYcUPadQoqX7LZJr&7Hb5PU
zcU9UqCpOni$d|8}&iqADl;c In algorithm steps that describe operations on keywords, those steps
- also apply to keyword aliases. Implementers can partially check their level of conformance to
this specification by successfully passing the test cases of the JSON-LD test
@@ -1576,7 +1576,6 @@
+
+
JSON-LD 1.1 Processing Algorithms and API
+
+ Final Community Group Report
+
+
+
+
+
+
+Abstract
+ Status of This Document
Set of Documents
+ 1. Introduction §
+
+
+ 1.1 Contributing §
+
+
+
+
+ 1.2 Terminology §
+
+
+
+@context where
+ the value, or the @id of the value, is null
+ explicitly decouples a term's association with an IRI. A key-value pair in
+ the body of a JSON-LD document whose value is null has the
+ same meaning as if the key-value pair was not defined. If
+ @value, @list, or @set is set to
+ null in expanded form, then the entire JSON
+ object is ignored.
+_:._:.@language key whose
+ value MUST be a string representing a [BCP47] language code or null.@graph member, and may also have
+ @id, and @index members.
+ A simple graph object is a
+ graph object which does not have an @id member. Note
+ that node objects may have a @graph member, but are
+ not considered graph objects if they include any other properties.
+ A top-level object consisting of @graph is also not a graph object.@container set to @id, who's keys are
+ interpreted as IRIs representing the @id
+ of the associated node object; value MUST be a node object.
+ If the value contains a property expanding to @id, it's value MUST
+ be equivalent to the referencing key.@container set to @index, whose values MUST be any of the following types:
+ string,
+ number,
+ true,
+ false,
+ null,
+ node object,
+ value object,
+ list object,
+ set object, or
+ an array of zero or more of the above possibilities.
+ @container set to @language, whose keys MUST be strings representing
+ [BCP47] language codes and the values MUST be any of the following types:
+ null,
+ string, or
+ an array of zero or more of the above possibilities.
+ @list
+ member.@context keyword.
+
+ @value, @list,
+ or @set keywords, or@graph and @context.@version member in a
+ context, or via explicit API option, other processing modes
+ can be accessed. This specification defines extensions for the
+ json-ld-1.1 processing mode.@type, and values of terms defined to be vocabulary relative
+ are resolved relative to the vocabulary mapping, not the base IRI.@set
+ member.@container set to @type, who's keys are
+ interpreted as IRIs representing the @type
+ of the associated node object;
+ value MUST be a node object, or array of node objects.
+ If the value contains a property expanding to @type, it's values
+ are merged with the map value when expanding.@value
+ member.@vocab key whose
+ value MUST be an absolute IRI null.1.2.1 Algorithm Terms §
+
+
+1.3 Typographical conventions §
+
+
+
+ markupmarkup definition reference markup external definition referenceExamples are in light khaki boxes, with khaki left border, and with a
+numbered "Example" header in khaki. Examples are always informative.
+The content of the example is in monospace font and may be syntax colored.1.4 Example Conventions §
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+}@context, @id, name, and knows keys,
+ with either dictionaries, strings, or arrays of
+ dictionaries or strings values. In the JSON serialization, JSON objects are used
+ for dictionaries, while arrays and strings are serialized using a
+ convention common to many programming languages.2. Features §
json-ld-1.1, either through the
+ processingMode API option, or using the
+ @version member within a context.2.1 Expansion §
{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "homepage": {
+ "@id": "http://xmlns.com/foaf/0.1/homepage",
+ "@type": "@id"
+ }
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "homepage": "http://www.markus-lanthaler.com/"
+}{
+ "@context": {
+ "website": "http://xmlns.com/foaf/0.1/homepage"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": "Markus Lanthaler",
+ "website": { "@id": "http://www.markus-lanthaler.com/" }
+}expand)
+ operation) against the above examples results in the following output:[
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Markus Lanthaler" }
+ ],
+ "http://xmlns.com/foaf/0.1/homepage": [
+ { "@id": "http://www.markus-lanthaler.com/" }
+ ]
+ }
+]2.2 Compaction §
[
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Markus Lanthaler" }
+ ],
+ "http://xmlns.com/foaf/0.1/homepage": [
+ { "@id": "http://www.markus-lanthaler.com/" }
+ ]
+ }
+]{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "homepage": {
+ "@id": "http://xmlns.com/foaf/0.1/homepage",
+ "@type": "@id"
+ }
+ }
+}compact)
+ operation) 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"
+ }
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "homepage": "http://www.markus-lanthaler.com/"
+}http://xmlns.com/foaf/0.1/name to name, it
+ could also have been mapped to any other term provided by the developer.2.3 Flattening §
{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "name": "Dave Longley"
+ }
+ ]
+}flatten)
+ operation) with a context set to null to prevent compaction
+ returns the following document:[
+ {
+ "@id": "_:t0",
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Dave Longley" }
+ ]
+ },
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Markus Lanthaler" }
+ ],
+ "http://xmlns.com/foaf/0.1/knows": [
+ { "@id": "_:t0" }
+ ]
+ }
+]_:t0.{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@graph": [
+ {
+ "@id": "_:t0",
+ "name": "Dave Longley"
+ }, {
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": { "@id": "_:t0" }
+ }
+ ]
+}@graph
+ member that represents the default graph.2.4 RDF Serialization/Deserialization §
<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
+<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/homepage> <http://www.markus-lanthaler.com/> .
[
+ {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Markus Lanthaler" }
+ ],
+ "http://xmlns.com/foaf/0.1/homepage": [
+ { "@id": "http://www.markus-lanthaler.com/" }
+ ]
+ }
+]3. Conformance §
4. Context Processing Algorithms §
+
+ 4.1 Context Processing Algorithm §
+
+ 4.1.1 Overview §
processingMode API option,
+ the processing mode is set using the @version member
+ in a local context and
+ affects the behavior of algorithms including expansion and compaction.@context key of the top-level object in the
+ retrieved JSON-LD document. If there's no such key, an
+ invalid remote context
+ has been detected. Otherwise, we process context by recursively using
+ this algorithm ensuring that there is no cyclical reference.@base, @vocab, @version, and @language.
+ These are handled before any other keys in the local context because
+ they affect how the other keys are processed. Please note that @base is
+ ignored when processing remote contexts.4.1.2 Algorithm §
+
+
+
+
+
+ null, set result to a
+ newly-initialized active context and continue with the
+ next context.
+ In JSON-LD 1.0, the base IRI was given
+ a default value here; this is now described conditionally
+ in section 9. The Application Programming Interface.
+
+ recursive context inclusion
+ error has been detected and processing is aborted;
+ otherwise, add context to remote contexts.loading remote context failed
+ error has been detected and processing is aborted. If the dereferenced document has no
+ top-level dictionary with an @context member, an
+ invalid remote context
+ has been detected and processing is aborted; otherwise,
+ set context to the value of that member.invalid local context
+ error has been detected and processing is aborted.@base key and remote contexts is empty, i.e., the currently
+ being processed context is not a remote context:
+
+
+ @base key.null, remove the
+ base IRI of result.null,
+ set the base IRI of result to the result of
+ resolving value against the current base IRI
+ of result.invalid base IRI
+ error has been detected and processing is aborted.@version key:
+
+
+ 1.1,
+ an invalid @version value
+ has been detected, and processing is aborted.json-ld-1.0,
+ a processing mode conflict
+ error has been detected and processing is aborted.json-ld-1.1, if not already set.@vocab key:
+
+
+ @vocab key.""),
+ the effective value is the current base IRI.invalid vocab mapping
+ error has been detected and processing is aborted.@language key:
+
+
+ @language key.null, remove
+ any default language from result.invalid default language
+ error has been detected and processing is aborted.@base, @vocab, or
+ @language, invoke the
+ Create Term Definition algorithm,
+ passing result for active context,
+ context for local context, key,
+ and defined.4.2 Create Term Definition §
+
+ 4.2.1 Overview §
4.2.2 Algorithm §
+
+
+
+ true (indicating that the
+ term definition has already been created), return. Otherwise,
+ if the value is false, a
+ cyclic IRI mapping
+ error has been detected and processing is aborted.false. This indicates that the term definition
+ is now being created but is not yet complete.keyword redefinition
+ error has been detected and processing is aborted.null or value
+ is a dictionary containing the key-value pair
+ @id-null, set the
+ term definition in active context to
+ null, set the value associated with defined's
+ key term to true, and return.@id and whose value is value.
+ Set simple term to true.invalid term definition
+ error has been detected and processing is aborted.
+ Set simple term to false.@type:
+
+
+ @type key, which must be a string. Otherwise, an
+ invalid type mapping
+ error has been detected and processing is aborted.true for vocab,
+ local context, and defined. If the expanded type is
+ neither @id, nor @vocab, nor an absolute IRI, an
+ invalid type mapping
+ error has been detected and processing is aborted.@reverse:
+
+
+ @id or @nest, members, an
+ invalid reverse property
+ error has been detected and processing is aborted.@reverse key
+ is not a string, an
+ invalid IRI mapping
+ error has been detected and processing is aborted.@reverse key for value, true
+ for vocab,
+ local context, and defined. If the result
+ is neither an absolute IRI nor a blank node identifier,
+ i.e., it contains no colon (:), an
+ invalid IRI mapping
+ error has been detected and processing is aborted.@container member,
+ set the container mapping of definition
+ to its value; if its value is neither @set, nor
+ @index, nor null, an
+ invalid reverse property
+ error has been detected (reverse properties only support set- and
+ index-containers) and processing is aborted.true.true and return.false.@id and its value
+ does not equal term:
+
+
+ @id key is not a string, an
+ invalid IRI mapping
+ error has been detected and processing is aborted.@id key for
+ value, true for vocab,
+ local context, and defined. If the resulting
+ IRI mapping is neither a keyword, nor an
+ absolute IRI, nor a blank node identifier, an
+ invalid IRI mapping
+ error has been detected and processing is aborted; if it equals @context, an
+ invalid keyword alias
+ error has been detected and processing is aborted.:),
+ simple term is true, and the,
+ IRI mapping of definition ends with a URI
+ gen-delim character,
+ set the prefix flag in definition to true.:):
+
+
+ invalid IRI mapping
+ error been detected and processing is aborted.@container:
+
+
+ @container key, which must be either
+ @graph,
+ @id,
+ @index,
+ @language,
+ @list,
+ @set, or
+ @type.
+
+ or an array containing exactly any one of those
+ keywords, an array containing @graph and
+ either @id or @index optionally
+ including @set, or an array containing a
+ combination of @set and any of
+ @index, @id, @type,
+ @language in any order
+ .
+ Otherwise, an
+ invalid container mapping
+ has been detected and processing is aborted.processingMode
+ is json-ld-1.0 and the container value
+ is @graph, @id, or @type, or is otherwise not a string, an
+ invalid container mapping
+ has been detected and processing is aborted.@context:
+
+
+ processingMode is json-ld-1.0, an
+ invalid term definition
+ has been detected and processing is aborted.@context key, which is treated as a local context.invalid scoped context error
+ has been detected and processing is aborted.@language and
+ does not contain the key @type:
+
+
+ @language key, which must be either null
+ or a string. Otherwise, an
+ invalid language mapping
+ error has been detected and processing is aborted.@nest:
+
+
+ processingMode is json-ld-1.0, an
+ invalid term definition
+ has been detected and processing is aborted.@nest key, which must be a string and
+ must not be a keyword other than @nest. Otherwise, an
+ invalid @nest value
+ error has been detected and processing is aborted.@prefix:
+
+
+ processingMode is json-ld-1.0, or if
+ term contains a colon (:), an
+ invalid term definition
+ has been detected and processing is aborted.@prefix key, which must be a boolean. Otherwise, an
+ invalid @prefix value
+ error has been detected and processing is aborted.@id,
+ @reverse, @container,
+ @context, @nest,
+ @prefix, or @type, an
+ invalid term definition error has
+ been detected and processing is aborted.true.4.3 IRI Expansion §
+
+ 4.3.1 Overview §
null, a term, a
+ keyword alias, or some form of IRI. Based on what
+ we find, we handle the specific kind of expansion; for example, we expand
+ a keyword alias to a keyword and a term
+ to an absolute IRI according to its IRI mapping
+ in the active context. While inspecting value we
+ may also find that we need to create term definition
+ dependencies because we're running this algorithm during context processing.
+ We can tell whether or not we're running during context processing by
+ checking local context against null.
+ We know we need to create a term definition in the
+ active context when value is
+ a key in the local context and the defined map
+ does not have a key for value with an associated value of
+ true. The defined map is used during
+ Context Processing to keep track of
+ which terms have already been defined or are
+ in the process of being defined. We create a
+ term definition by using the
+ Create Term Definition algorithm.4.3.2 Algorithm §
+
+ false and
+ local context and defined are initialized to null.
+
+ null,
+ return value as is.null, it contains
+ a key that equals value, and the value associated with the key
+ that equals value in defined is not true,
+ invoke the Create Term Definition algorithm,
+ passing active context, local context,
+ value as term, and defined. This will ensure that
+ a term definition is created for value in
+ active context during Context Processing.
+ true and the
+ active context has a term definition for
+ value, return the associated IRI mapping.:), it is either
+ an absolute IRI, a compact IRI, or a
+ blank node identifier:
+
+
+ :)._)
+ or suffix begins with double-forward-slash
+ (//), return value as it is already an
+ absolute IRI or a blank node identifier.null, it
+ contains a key that equals prefix, and the value
+ associated with the key that equals prefix in defined
+ is not true, invoke the
+ Create Term Definition algorithm,
+ passing active context,
+ local context, prefix as term,
+ and defined. This will ensure that a
+ term definition is created for prefix
+ in active context during
+ Context Processing.true, and
+ active context has a vocabulary mapping,
+ return the result of concatenating the vocabulary mapping
+ with value.true
+ set value to the result of resolving value against
+ the base IRI. Only the basic algorithm in
+ section 5.2
+ of [RFC3986] is used; neither
+ Syntax-Based Normalization nor
+ Scheme-Based Normalization
+ are performed. Characters additionally allowed in IRI references are treated
+ in the same way that unreserved characters are treated in URI references, per
+ section 6.5
+ of [RFC3987].5. Expansion Algorithms §
+
+ 5.1 Expansion Algorithm §
+
+ 5.1.1 Overview §
+
+
+ null, there is nothing
+ to expand.5.1.2 Algorithm §
+
+ null,
+ and element is set to the JSON-LD input.
+ If not passed, the frame expansion flag is set to false.@id and
+ @type properties can accept an array of IRIs or
+ an empty dictionary. The properties of a value object can also
+ accept an array of strings, or an empty dictionary.
+ Framing also uses additional keyword properties:
+ (@explicit, @default,
+ @embed, @explicit, @omitDefault, or
+ @requireAll) which are preserved through expansion.
+ Special processing for a JSON-LD Frame is invoked when the
+ frame expansion flag is set to true.
+
+
+ null, return null.@default,
+ set the frame expansion flag to false.
+
+ null or @graph,
+ drop the free-floating scalar by returning null.
+
+
+
+ @list or its
+ container mapping includes @list, the
+ expanded item must not be an array or a
+ list object, otherwise a
+ list of lists
+ error has been detected and processing is aborted.@context, set
+ active context to the result of the
+ Context Processing algorithm,
+ passing active context and the value of the
+ @context key as local context.@type using the
+ IRI Expansion algorithm,
+ passing active context, key for
+ value, and true for vocab:
+
+
+
+
+ @context, continue to
+ the next key.true for vocab.null or it neither
+ contains a colon (:) nor it is a keyword,
+ drop key by continuing to the next key.
+
+ @reverse, an
+ invalid reverse property map
+ error has been detected and processing is aborted.colliding keywords
+ error has been detected and processing is aborted.@id and
+ value is not a string, an
+ invalid @id value
+ error has been detected and processing is aborted. Otherwise,
+ set expanded value to the result of using the
+ IRI Expansion algorithm,
+ passing active context, value, and true
+ for document relative.
+
+ When the frame expansion flag is set, value
+ may be an empty dictionary, or an array of one
+ or more strings. expanded value will be
+ an array of one or more of these, with string
+ values expanded using the IRI Expansion Algorithm.@type and value
+ is neither a string nor an array of
+ strings, an
+ invalid type value
+ error has been detected and processing is aborted. Otherwise,
+ set expanded value to the result of using the
+ IRI Expansion algorithm, passing
+ active context, true for vocab,
+ and true for document relative to expand the value
+ or each of its items.
+
+ When the frame expansion flag is set, value
+ may also be an empty dictionary.@graph, set
+ expanded value to the result of using this algorithm
+ recursively passing active context, @graph
+ for active property, value for element,
+ and the frame expansion flag,
+
+ ensuring that expanded value is an array of one or more dictionaries.@value and
+ value is not a scalar or null, an
+ invalid value object value
+ error has been detected and processing is aborted. Otherwise,
+ set expanded value to value. If expanded value
+ is null, set the @value
+ member of result to null and continue with the
+ next key from element. Null values need to be preserved
+ in this case as the meaning of an @type member depends
+ on the existence of an @value member.
+
+ When the frame expansion flag is set, value
+ may also be an empty dictionary or an array of
+ scalar values. expanded value will be null, or an
+ array of one or more scalar values.@language and
+ value is not a string, an
+ invalid language-tagged string
+ error has been detected and processing is aborted.
+
+ Otherwise, set expanded value to lowercased value.
+ When the frame expansion flag is set, value
+ may also be an empty dictionary or an array of zero or
+ strings. expanded value will be an
+ array of one or more string values converted to lower case.@index and
+ value is not a string, an
+ invalid @index value
+ error has been detected and processing is aborted. Otherwise,
+ set expanded value to value.@list:
+
+
+ null or
+ @graph, continue with the next key
+ from element to remove the free-floating list.list of lists
+ error has been detected and processing is aborted.@set, set
+ expanded value to the result of using this algorithm
+ recursively, passing active context,
+ active property, value for element,
+ and the frame expansion flag.@reverse and
+ value is not a dictionary, an
+ invalid @reverse value
+ error has been detected and processing is aborted. Otherwise
+
+
+ @reverse as active property,
+ value as element,
+ and the frame expansion flag.@reverse member,
+ i.e., properties that are reversed twice, execute for each of its
+ property and item the following steps:
+
+
+ @reverse:
+
+
+ @reverse member, create
+ one and set its value to an empty dictionary.@reverse member in result
+ using the variable reverse map.@reverse:
+
+
+
+
+ invalid reverse property value
+ has been detected and processing is aborted.@nest,
+ add key to nests, initializing it to an empty array,
+ if necessary.
+ Continue with the next key from element.@explicit, @default,
+ @embed, @explicit, @omitDefault, or
+ @requireAll),
+ set expanded value to the result of performing the
+ Expansion Algorithm
+ recursively, passing active context,
+ active property, value for element,
+ and the frame expansion flag.null, set
+ the expanded property member of result to
+ expanded value.@language and
+ value is a dictionary then value
+ is expanded from a language map
+ as follows:
+
+
+
+
+
+
+ null,
+ otherwise an
+ invalid language map value
+ error has been detected and processing is aborted.@value-item)
+ and (@language-lowercased
+ language),
+ unless item is null.
+ If language is @none,
+ or expands to @none, do not set the @language member.
+ @index,
+ @type, or @id and
+ value is a dictionary then value
+ is expanded from an map as follows:
+
+
+
+
+ @type,
+ and index's term definition in
+ term context has a local context, set
+ map context to the result of the Context Processing
+ algorithm, passing term context as active context and the
+ value of the index's local context as
+ local context. Otherwise, set map context
+ to term context.true
+ for vocab.
+
+ @graph and if item is not a
+ graph object, set item to a new
+ dictionary containing the key-value pair
+ @graph-item, ensuring that the
+ value is represented using an array.@index
+ and item does not have the key
+ @index and expanded index is not @none,
+ add the key-value pair
+ (@index-index) to item.@id
+ and item does not have the key
+ @id, add the key-value pair
+ (@id-expanded index) to
+ item, where expanded index is set to the result of
+ using the
+ IRI Expansion algorithm,
+ passing active context, index, and true
+ for document relative, unless expanded index
+ is already set to @none.@type
+ set types to the concatenation of
+ expanded index with any existing values of
+ @type in item.
+ If expanded index is @none,
+ do not concatenate expanded index to types.
+ Add the key-value pair
+ (@type-types) to
+ item.null, ignore key
+ by continuing to the next key from element.@list and
+ expanded value is not already a list object,
+ convert expanded value to a list object
+ by first setting it to an array containing only
+ expanded value if it is not already an array,
+ and then by setting it to a dictionary containing
+ the key-value pair @list-expanded value.@graph, convert expanded value into an array, if necessary,
+ then convert each value ev in expanded value into a
+ graph object:
+
+
+ @graph-ev
+ where ev is represented as an array.
+
+ @reverse member, create
+ one and initialize its value to an empty dictionary.@reverse member in result
+ using the variable reverse map.
+
+ invalid reverse property value
+ has been detected and processing is aborted.
+
+
+
+
+
+ @value, an
+ invalid @nest value error
+ has been detected and processing is aborted.@value:
+
+
+ @value, @language, @type,
+ and @index. It must not contain both the
+ @language key and the @type key.
+ Otherwise, an
+ invalid value object
+ error has been detected and processing is aborted.@value key is
+ null, then set result to null.@value member
+ is not a string and result contains the key
+ @language, an
+ invalid language-tagged value
+ error has been detected (only strings
+ can be language-tagged) and processing is aborted.@type member
+ and its value is not an IRI, an
+ invalid typed value
+ error has been detected and processing is aborted.@type
+ and its associated value is not an array, set it to
+ an array containing only the associated value.@set
+ or @list:
+
+
+ @index. Otherwise, an
+ invalid set or list object
+ error has been detected and processing is aborted.@set, then
+ set result to the key's associated value.@language, set result to null.null or @graph,
+ drop free-floating values as follows:
+
+
+ @value or @list, set result to
+ null.@id, set result to null.
+
+ When the frame expansion flag is set, a dictionary
+ containing only the @id key is retained.@graph key, set the
+ result to the value of @graph's value. Otherwise, if the result
+ is null, set it to an empty array. Finally, if
+ the result is not an array, then set the result to an
+ array containing only the result.5.2 Value Expansion §
+
+ 5.2.1 Overview §
@id or @vocab,
+ and the value is a string,
+ a dictionary with a single member @id whose
+ value is the result of using the
+ IRI Expansion algorithm on value
+ is returned.@value member whose value is the passed value.
+ Additionally, an @type member will be included if there is a
+ type mapping associated with the active property
+ or an @language member if value is a
+ string and there is language mapping associated
+ with the active property.@type,
+ along with terms marked as "@type": "@vocab"
+ are vocabulary relative, meaning that they need to be either
+ a defined term, a compact IRI
+ where the prefix is a term,
+ or a string which is turned into an absolute IRI using
+ the vocabulary mapping.5.2.2 Algorithm §
+
+
+
+ @id,
+ and the value is a string,
+ return a new
+ dictionary containing a single key-value pair where the
+ key is @id and the value is the result of using the
+ IRI Expansion algorithm, passing
+ active context, value, and true for
+ document relative.@vocab,
+ and the value is a string,
+ return a new
+ dictionary containing a single key-value pair where the
+ key is @id and the value is the result of using the
+ IRI Expansion algorithm, passing
+ active context, value, true for
+ vocab, and true for
+ document relative.@value member whose value is set to
+ value.@id or @vocab,
+ add an @type member to
+ result and set its value to the value associated with the
+ type mapping.
+
+ @language to result and set its
+ value to the language code associated with the
+ language mapping; unless the
+ language mapping is set to null in
+ which case no member is added.@language
+ to result and set its value to the
+ default language.6. Compaction Algorithms §
+
+ 6.1 Compaction Algorithm §
+
+ 6.1.1 Overview §
+
+
+ @index or @language
+ maps.@context
+ key, if a non-empty context was given, where the dictionary
+ is either result or a wrapper for it where result appears
+ as the value of an (aliased) @graph key because result
+ contained two or more items in an array.6.1.2 Algorithm §
+
+ compactArrays
+ To begin, the active context is set to the result of
+ performing Context Processing
+ on the passed context, the inverse context is
+ set to the result of performing the
+ Inverse Context Creation algorithm
+ on active context, the active property is
+ set to null, element is set to the result of
+ performing the Expansion algorithm
+ on the JSON-LD input, and, if not passed,
+ compactArrays
+ is set to true.
+
+
+
+
+
+
+
+
+ null, then append
+ it to result.1),
+
+ active property is not @graph or @set,
+ or the container mapping for active property in
+ active context does not include @list or @set,
+
+ and compactArrays
+ is true, set result to its only item.@value or @id
+ member and the result of using the
+ Value Compaction algorithm,
+ passing active context, inverse context,
+ active property,and element as value is
+ a scalar, return that result.true if
+ active property equals @reverse,
+ otherwise to false.@type member,
+ create a new array compacted types initialized
+ by transforming each expanded type of that member
+ into it's compacted form using the IRI Compaction algorithm,
+ passing active context, inverse context,
+ expanded type for var, and
+ true for vocab. Then, for each term
+ in compacted types ordered lexicographically:
+
+
+
+
+
+
+ @id or
+ @type:
+
+
+ true for vocab if
+ expanded property is @type,
+ false otherwise.@type array:
+
+
+
+
+ true for vocab.1), then
+ set compacted value to its only item.true for vocab.@reverse:
+
+
+ @reverse for
+ active property, and expanded value
+ for element.
+
+
+
+ @set or
+ compactArrays
+ is false, and value is not an
+ array, set value to a new
+ array containing only value.
+
+ @reverse for var,
+ and true for vocab.@preserve
+ then:
+
+
+ @preserve
+ in result unless expanded value is an empty array.@index and
+ active property has a container mapping
+ in active context that includes @index,
+ then the compacted result will be inside of an @index
+ container, drop the @index property by continuing
+ to the next expanded property.@index,
+ @value, or @language:
+
+
+ true for vocab.
+
+ true for vocab, and
+ inside reverse.@nest, or a term in the
+ active context that expands to @nest,
+ otherwise an invalid @nest
+ value error has been detected, and processing is aborted.
+ If result does not have the key that equals nest
+ term, initialize it to an empty JSON object (nest
+ object). If nest object does not have the key
+ that equals item active property, set this key's
+ value in nest object to an empty
+ array.Otherwise, if the key's value is not an
+ array, then set it to one containing only the
+ value.
+
+ true for vocab, and
+ inside reverse.@nest, or a term in the
+ active context that expands to @nest,
+ otherwise an invalid @nest
+ value error has been detected, and processing is aborted.
+ Set nest result to the value of nest term in result,
+ initializing it to a new dictionary, if necessary; otherwise
+ set nest result to result.null. If there
+ is a container mapping for
+ item active property in active context,
+ set container to the first
+ such value other than @set.true or false depending on if the container mapping for
+ item active property in active context
+ includes @set or if item active property
+ is @graph or @list.@list
+ and is not a graph object containing @list,
+ otherwise pass the key's associated value for element.
+
+ @list:
+
+
+ @list for var, and compacted item
+ for value and the value is the original compacted item.@index, then add a key-value pair
+ to compacted item where the key is the
+ result of the IRI Compaction algorithm,
+ passing active context, inverse context,
+ @index as var, and the value associated with the
+ @index key in expanded item as value.compaction to list of lists
+ error has been detected and processing is aborted.
+
+ @graph and @id:
+
+
+ @id in expanded item
+ or @none if no such value exists as var, with vocab set to true
+ if there is no @id member in expanded item.true,
+ set compacted item to an array containing that value.@graph and @index
+ and expanded item is a simple graph object:
+
+
+ @index in
+ expanded item or @none, if no such
+ value exists.true,
+ set compacted item to an array containing that value.@graph
+ and expanded item is a simple graph
+ object the value cannot be represented as a map
+ object. If compacted item is not an array
+ and as array is true, set
+ compacted item to an array containing
+ that value. If the value associated with the key that
+ equals item active property in
+ nest result is not an array,
+ set it to a new array containing only the value.
+ Then append compacted item to the value if
+ compacted item is not an array,
+ otherwise, concatenate it.
+ @graph
+ or otherwise does not match one of the previous cases, redo compacted item.
+
+
+ @graph as
+ var, and true for
+ vocab using the original
+ compacted item as a value.@id,
+ add the key resulting from calling the IRI Compaction algorithm
+ passing active context, @id as
+ var, and true for
+ vocab using the value resulting from calling the IRI Compaction algorithm
+ passing active context, the value of @id
+ in expanded item as
+ var.@index,
+ add the key resulting from calling the IRI Compaction algorithm
+ passing active context, @index as
+ var, and true for
+ vocab using the value of @index
+ in expanded item.true,
+ set compacted item to an array
+ containing that value.@language,
+ @index, @id,
+ or @type
+ and container does not include @graph:
+
+
+ @language, @index, @id, or @type
+ based on the contents of container, as var, and true
+ for vocab.@language and
+ expanded item contains the key
+ @value, then set compacted item
+ to the value associated with its @value key.
+ Set map key to the value of @language in expanded item, if any.@index set map key to the value of @index in expanded item, if any,
+ and remove container key from compacted item.@id, set
+ map key to the value of container key in
+ compacted item and remove container key from compacted item.@type,
+ set map key to the first value of container key in compacted item, if any.
+ If there are remaining values in compacted item
+ for compacted container, set the value of
+ compacted container in compacted value
+ to those remaining values. Otherwise, remove that
+ key-value pair from compacted item.true,
+ set compacted item to an array containing that value.null, set it to the result of calling the
+ IRI Compaction algorithm
+ passing active context, @none as
+ var, and true for
+ vocab.
+
+ compactArrays
+ is false, as array is true and
+ compacted item is not an array,
+ set it to a new array
+ containing only compacted item.@graph as var and whose value is the array
+ result.@context member to result and set its value
+ to the passed context.6.2 Inverse Context Creation §
+
+ 6.2.1 Overview §
@none. This allows the
+ Term Selection algorithm to fall back
+ to choosing more generic terms when a more
+ specifically-matching term is not available for a particular
+ IRI and value combination.6.2.2 Algorithm §
+
+
+
+ @none. If the
+ active context has a default language,
+ set default language to it.
+
+ null,
+ term cannot be selected during compaction,
+ so continue to the next term.@none.
+
+ If the container mapping is not empty, set container
+ to the concatenation of all values of the container mapping
+ in lexicographically order
+ .@language and its value is a new empty
+ dictionary, the second member is @type
+ and its value is a new empty dictionary,
+ and the third member is @any
+ and its value is a new dictionary with the member
+ @none set to the term being processed.
+
+ @type
+ member in type/language map using the variable
+ type map.@reverse
+ member, create one and set its value to the term
+ being processed.
+
+ @type
+ member in type/language map using the variable
+ type map.null):
+
+
+ @language
+ member in type/language map using the variable
+ language map.null,
+ set language to @null; otherwise set it
+ to the language code in language mapping.
+
+ @language
+ member in type/language map using the variable
+ language map.@none
+ member, create one and set its value to the term
+ being processed.@type
+ member in type/language map using the variable
+ type map.@none
+ member, create one and set its value to the term
+ being processed.6.3 IRI Compaction §
+
+ 6.3.1 Overview §
null, we simply
+ return null. Otherwise, we first try to find a term
+ that the IRI or keyword can be compacted to if
+ it is relative to active context's
+ vocabulary mapping. In order to select the most appropriate
+ term, we may have to collect information about the passed
+ value. This information includes which
+ container mapping
+ would be preferred for expressing the value, and what its
+ type mapping or language mapping is. For
+ JSON-LD lists, the type mapping
+ or language mapping will be chosen based on the most
+ specific values that work for all items in the list. Once this
+ information is gathered, it is passed to the
+ Term Selection algorithm, which will
+ return the most appropriate term to use.true.
+ If there is no appropriate compact IRI,
+ and the compactToRelative option is true,
+ the IRI is
+ transformed to a relative IRI using the document's
+ base IRI. Finally, if the IRI or
+ keyword still could not be compacted, it is returned
+ as is.6.3.2 Algorithm §
+
+ null and vocab and reverse are both set to
+ false.
+
+ null, return null.true and var is a
+ key in inverse context:
+
+
+ @none.@preserve, use the first
+ element from the value of @preserve as value.@language,
+ and type/language value to @null. These two
+ variables will keep track of the preferred
+ type mapping or language mapping for
+ a term, based on what is compatible with value.@index,
+ and value is not a graph object
+ then append the values @index and @index@set to containers.true, set type/language
+ to @type, type/language value to
+ @reverse, and append @set to containers.
+
+ @index is a not key in value, then
+ append @list to containers.@list in value.null. If
+ list is empty, set common language to
+ default language.
+
+ @none and
+ item type to @none.@value:
+
+
+ @language,
+ then set item language to its associated
+ value.@type, set item type to its
+ associated value.@null.@id.null, set it
+ to item language.@value, then set common language
+ to @none because list items have conflicting
+ languages.null, set it
+ to item type.@none because list items have conflicting
+ types.@none and
+ common type is @none, then
+ stop processing items in the list because it has been
+ detected that there is no common language or type amongst
+ the items.null, set it to
+ @none.null, set it to
+ @none.@none then set
+ type/language to @type and
+ type/language value to common type.
+
+ @index,
+ append the values @graph@index and @graph@index@set
+ to containers.@id,
+ append the values @graph@id and @graph@id@set
+ to containers.@graph @graph@set,
+ and @set
+ to containers.@index,
+ append the values @graph@index and @graph@index@set
+ to containers.@id,
+ append the values @graph@id and @graph@id@set
+ to containers.@index and @index@set
+ to containers.
+
+
+
+ @language
+ and does not contain the key @index,
+ then set type/language value to its associated
+ value and, append @language
+ and @language@set to
+ containers.@type, then set type/language value to
+ its associated value and set type/language to
+ @type.@type
+ and set type/language value to @id,
+ and append @id, @id@set,
+ @type, and @set@type,
+ to containers.@set to containers.@none to containers. This represents
+ the non-existence of a container mapping, and it will
+ be the last container mapping value to be checked as it
+ is the most generic.json-ld-1.1 and value does not contain the key @index, append
+ @index and @index@set to containers.
+ json-ld-1.1 and value contains only the key @value, append
+ @language and @language@set to containers.
+ null, set it to
+ @null. This is the key under which null values
+ are stored in the inverse context entry.@reverse, append
+ @reverse to preferred values.@id or @reverse
+ and value has an @id member:
+
+
+ @id key in value for
+ var, and true for vocab has a
+ term definition in the active context
+ with an IRI mapping that equals the value associated
+ with the @id key in value,
+ then append @vocab, @id, and
+ @none, in that order, to preferred values.@id, @vocab, and
+ @none, in that order, to preferred values.@none, in
+ that order, to preferred values.
+ If value is an empty list object,
+ set type/language to @any.null, return term.true and
+ active context has a vocabulary mapping:
+
+
+ null. This variable will be used to
+ tore the created compact IRI, if any.
+
+ null,
+ its IRI mapping equals var, its
+ IRI mapping is not a substring at the beginning of
+ var,
+ or the term definition does not contain
+ the prefix flag having a value of true,
+ the term cannot be used as a prefix.
+ Continue with the next term.:), and the substring of var
+ that follows after the value of the
+ term definition's
+ IRI mapping.null, candidate is
+ shorter or the same length but lexicographically less than
+ compact IRI and candidate does not have a
+ term definition in active context, or if the
+ term definition has an IRI mapping
+ that equals var and value is null,
+ set compact IRI to candidate.null, return compact IRI.false,
+ transform var to a relative IRI using
+ the base IRI from active context, if it exists.6.4 Term Selection §
+
+ 6.4.1 Overview §
6.4.2 Algorithm §
+
+
+
+
+
+
+
+ null.6.4.3 Examples §
6.4.3.1 Language Map Term §
+ "@container": "@language", it will only match a
+ value object having no @type.{
+ "@context": {"t": {"@id": "http://example/t", "@container": "@language"}}
+}{
+ "@language": {
+ "@language": {"@none": "t"},
+ "@type": {"@none": "t"},
+ "@any": {"@none": "t"}
+ }
+}
+
+
+
+ 6.4.3.2 Datatyped Term §
+ {
+ "@context": {"t": {"@id": "http://example/t", "@type": "http:/example/type"}}
+}{
+ "@none": {
+ "@language": {},
+ "@type": {"http:/example/type": "t"},
+ "@any": {"@none": "t"}
+ }
+}
+
+
+
+
+
+
+
+ 6.5 Value Compaction §
+
+ 6.5.1 Overview §
@id or an
+ @value member.@id or @vocab
+ and value consists of only an @id member and, if
+ the container mapping of active property
+ includes @index, an @index member, value
+ can be compacted to a string by returning the result of
+ using the IRI Compaction algorithm
+ to compact the value associated with the @id member.
+ Otherwise, value cannot be compacted and is returned as is.@value member.
+ This can be done if the active property has a matching
+ type mapping or language mapping and there
+ is either no @index member or the container mapping
+ of active property includes @index. It can
+ also be done if @value is the only member in value
+ (apart an @index member in case the container mapping
+ of active property includes @index) and
+ either its associated value is not a string, there is
+ no default language, or there is an explicit
+ null language mapping for the
+ active property.6.5.2 Algorithm §
+
+
+
+ @index member and the
+ container mapping associated to active property
+ includes @index, decrease number members by
+ 1.2, return
+ value as it cannot be compacted.@id member:
+
+
+ 1 and
+ the type mapping of active property
+ is set to @id, return the result of using the
+ IRI compaction algorithm,
+ passing active context, inverse context,
+ and the value of the @id member for var.1 and
+ the type mapping of active property
+ is set to @vocab, return the result of using the
+ IRI compaction algorithm,
+ passing active context, inverse context,
+ the value of the @id member for var, and
+ true for vocab.@type member whose
+ value matches the type mapping of active property,
+ return the value associated with the @value member
+ of value.@language member whose
+ value matches the language mapping of
+ active property, return the value associated with the
+ @value member of value.1 and either
+ the value of the @value member is not a string,
+ or the active context has no default language,
+ or the language mapping of active property
+ is set to null,, return the value associated with the
+ @value member.7. Flattening Algorithms §
+
+ 7.1 Flattening Algorithm §
+
+ 7.1.1 Overview §
7.1.2 Algorithm §
+
+ null.0.
+
+ @default and whose value is
+ an empty dictionary.@default
+ member of node map, which is a dictionary representing
+ the default graph.@default, perform the following steps:
+
+
+ @id member whose value is set to graph name.@graph member to entry and set it to an
+ empty array.@graph member of entry,
+ unless the only member of node is @id.@id.null, return flattened.@graph keyword (or its alias)
+ at the top-level other than @context, even if the context is empty or if there is only one element to
+ put in the @graph array. This ensures that the returned
+ document has a deterministic structure.7.2 Node Map Generation §
+
+ @default member, all other graphs are
+ stored under their graph name.7.2.1 Overview §
@default)
+ and whose associated values are dictionaries
+ which index the nodes in the
+ graph. If a
+ property's value is a node object,
+ it is replaced by a node object consisting of only an
+ @id member. If a node object has no @id
+ member or it is identified by a blank node identifier,
+ a new blank node identifier is generated. This relabeling
+ of blank node identifiers is
+ also done for properties and values of
+ @type.7.2.2 Algorithm §
+
+ @default), an active subject,
+ active property, and a reference to a dictionary list. If
+ not passed, active subject, active property, and list are
+ set to null.
+
+
+
+ null, set node to null
+ otherwise reference the active subject member of graph using the
+ variable node.@type member, perform for each
+ item the following steps:
+
+
+ @value member, perform the following steps:
+
+
+ null:
+
+
+ @list member of list.@list member, perform
+ the following steps:
+
+
+ @list whose value is initialized to an empty array.@list member for element, active graph,
+ active subject, active property, and
+ result for list.
+
+ @id member, set id
+ to its value and remove the member from element. If id
+ is a blank node identifier, replace it with a newly
+ generated blank node identifier
+ passing id for identifier.null for identifier.@id whose
+ value is id.
+
+ null, perform the following steps:
+
+
+ @id whose value is id.null:
+
+
+ @list member of list.@type key, append
+ each item of its associated array to the
+ array associated with the @type key of
+ node unless it is already in that array. Finally
+ remove the @type member from element.@index member, set the @index
+ member of node to its value. If node has already an
+ @index member with a different value, a
+ conflicting indexes
+ error has been detected and processing is aborted. Otherwise, continue by
+ removing the @index member from element.@reverse member:
+
+
+ @id whose
+ value is id.@reverse member of
+ element.
+
+
+
+ @reverse member from element.@graph member, recursively invoke this
+ algorithm passing the value of the @graph member for element,
+ node map, and id for active graph before removing
+ the @graph member from element.
+
+ 7.3 Generate Blank Node Identifier §
+
+ 7.3.1 Overview §
_:b and the
+ counter. If the passed identifier is not null,
+ an entry is created in the identifier map associating the
+ identifier with the blank node identifier. Finally,
+ the counter is increased by one and the new
+ blank node identifier is returned.7.3.2 Algorithm §
+
+ null. Between its executions, the algorithm needs to
+ keep an identifier map to relabel existing
+ blank node identifiers
+ consistently and a counter to generate new
+ blank node identifiers. The
+ counter is initialized to 0 by default.
+
+ null and has an entry in the
+ identifier map, return the mapped identifier._:b and counter.1.null, create a new entry
+ for identifier in identifier map and set its value
+ to the new blank node identifier.7.4 Merge Node Maps §
+
+
+
+
+ @id whose value is id, if it does not exist.8. RDF Serialization/Deserialization Algorithms §
+
+
+
+
+
+
+
+ Prefix
+ IRI
+
+
+ rdf
+ http://www.w3.org/1999/02/22-rdf-syntax-ns#
+
+
+ rdfs
+ http://www.w3.org/2000/01/rdf-schema#
+
+
+
+ xsd
+ http://www.w3.org/2001/XMLSchema#
+ 8.1 Deserialize JSON-LD to RDF algorithm §
+
+ 8.1.1 Overview §
@id member which corresponds to the
+ RDF subject, the other members
+ represent RDF predicates. Each
+ member value is either an IRI or
+ blank node identifier or can be transformed to an
+ RDF literal
+ to generate an RDF triple. Lists
+ are transformed into an
+ RDF collection
+ using the List to RDF Conversion algorithm.8.1.2 Algorithm §
+
+ produceGeneralizedRdf option
+ is set to true, RDF triple
+ containing a blank node predicate
+ are excluded from output.0.
+
+
+
+
+
+
+
+ @type, then for each
+ type in values, append a triple
+ composed of subject, rdf:type,
+ and type to triples.produceGeneralizedRdf option is not true,
+ continue with the next property-values pair.
+
+ @list key from
+ item and list triples. Append first a
+ triple composed of subject,
+ property, and list head to triples and
+ finally append all triples from
+ list triples to triples.null, indicating a relative IRI that has
+ to be ignored.@default, add
+ triples to the default graph in dataset.8.2 Object to RDF Conversion §
+
+ null is returned which then causes the resulting
+ RDF triple to be ignored.8.2.1 Overview §
null.8.2.2 Algorithm §
+
+
+
+ @id member is a relative IRI, return
+ null.@id member.@value
+ member in item.
+ @type member of item or null if
+ item does not have such a member.true or
+ false, set value to the string
+ true or false which is the
+ canonical lexical form as described in
+ section 8.6 Data Round Tripping
+ If datatype is null, set it to
+ xsd:boolean.xsd:double, convert value to a
+ string in canonical lexical form of
+ an xsd:double as defined in [XMLSCHEMA11-2]
+ and described in
+ section 8.6 Data Round Tripping.
+ If datatype is null, set it to
+ xsd:double.xsd:integer, convert value to a
+ string in canonical lexical form of
+ an xsd:integer as defined in [XMLSCHEMA11-2]
+ and described in
+ section 8.6 Data Round Tripping.
+ If datatype is null, set it to
+ xsd:integer.null, set it to
+ xsd:string or rdf:langString, depending on if
+ item has an @language member.@language member, add the value associated with the
+ @language key as the language tag of literal.8.3 List to RDF Conversion §
+
+ 8.3.1 Overview §
rdf:first and
+ rdf:rest ABBR. The
+ algorithm returns the list head, which is either the first allocated
+ blank node identifier or rdf:nil if the
+ list is empty. If a list element represents a relative IRI,
+ the corresponding rdf:first triple is omitted.8.3.2 Algorithm §
+
+
+
+ rdf:nil.
+
+ null, append a triple
+ composed of subject, rdf:first, and object.rdf:nil. Append a
+ triple composed of subject,
+ rdf:rest, and rest to list triples.rdf:nil if bnodes is empty.8.4 Serialize RDF as JSON-LD Algorithm §
+
+ 8.4.1 Overview §
true,
+ RDF literals with a
+ datatype IRI
+ that equals xsd:integer or xsd:double are converted
+ to a JSON numbers and RDF literals
+ with a datatype IRI
+ that equals xsd:boolean are converted to true or
+ false based on their
+ lexical form
+ as described in
+ section 8.6 Data Round Tripping.
+ Unless the use rdf:type flag is set to true, rdf:type
+ predicates will be serialized as @type as long as the associated object is
+ either an IRI or blank node identifier.8.4.2 Algorithm §
+
+ rdf:type
+ that both default to false.
+
+ @default whose value references
+ default graph.
+
+ @default, otherwise to the
+ graph name associated with graph.@id
+ whose value is name.
+
+ @id whose value is
+ set to subject.@id whose value is
+ set to object.rdf:type, the
+ use rdf:type flag is not true, and object
+ is an IRI or blank node identifier,
+ append object to the value of the @type
+ member of node; unless such an item already exists.
+ If no such member exists, create one
+ and initialize it to an array whose only item is
+ object. Finally, continue to the next
+ RDF triple.
+
+ @id member of node to
+ the object member of node usage map.usages member, create one and initialize it to
+ an empty array.usages member of the object
+ member of node map using the variable usages.node, property, and value
+ to the usages array. The node member
+ is set to a reference to node, property to predicate,
+ and value to a reference to value.
+
+ rdf:nil member, continue
+ with the next name-graph object pair as the graph does
+ not contain any lists that need to be converted.rdf:nil member
+ of graph object.usages member of
+ nil, perform the following steps:
+
+
+ node member of usage, property to
+ the value of the property member of usage,
+ and head to the value of the value member
+ of usage.rdf:rest,
+ the value of the @id member
+ of node is a blank node identifier,
+ the array value of the member of node usage map associated with the @id
+ member of node has only one member,
+
+ the value associated to the usages member of node has
+ exactly 1 entry,
+ node has a rdf:first and rdf:rest property,
+ both of which have as value an array consisting of a single element,
+ and node has no other members apart from an optional @type
+ member whose value is an array with a single item equal to
+ rdf:List,
+ node represents a well-formed list node.
+ Perform the following steps to traverse the list backwards towards its head:
+
+
+ rdf:first member of
+ node to the list array.@id member of
+ node to the list nodes array.usages member of node.node member
+ of node usage, property to the value of the
+ property member of node usage, and
+ head to the value of the value member
+ of node usage.@id member of node is an
+ IRI instead of a blank node identifier,
+ exit the while loop.rdf:first, i.e., the
+ detected list is nested inside another list
+
+
+ @id of node equals
+ rdf:nil, i.e., the detected list is empty,
+ continue with the next usage item. The
+ rdf:nil node cannot be converted to a
+ list object as it would result in a list of
+ lists, which isn't supported.@id
+ member of head.rdf:rest member of head.@id member from head.@list member to head and initialize
+ its value to the list array.
+
+
+
+ @graph member to node and initialize
+ its value to an empty array.@graph member of node after
+ removing its usages member, unless the only
+ remaining member of n is @id.usages member, unless the only remaining member of
+ node is @id.8.5 RDF to Object Conversion §
+
+ 8.5.1 Overview §
true,
+ RDF literals with a
+ datatype IRI
+ that equals xsd:integer or xsd:double are converted
+ to a JSON numbers and RDF literals
+ with a datatype IRI
+ that equals xsd:boolean are converted to true or
+ false based on their
+ lexical form
+ as described in
+ section 8.6 Data Round Tripping.8.5.2 Algorithm §
+
+
+
+ @id whose value is set to
+ value.
+
+ nulltrue
+
+
+ xsd:string, set
+ converted value to the
+ lexical form
+ of value.xsd:boolean, set
+ converted value to true if the
+ lexical form
+ of value matches true, or false
+ if it matches false. If it matches neither,
+ set type to xsd:boolean.xsd:integer or
+ xsd:double and its
+ lexical form
+ is a valid xsd:integer or xsd:double
+ according [XMLSCHEMA11-2], set converted value
+ to the result of converting the
+ lexical form
+ to a JSON number.@language to result and set its value to the
+ language tag of value.xsd:string which is ignored.@value to result whose value
+ is set to converted value.null, add a member @type
+ to result whose value is set to type.8.6 Data Round Tripping §
+
+ xsd:integer or xsd:double
+ depending on whether the number has a non-zero fractional part
+ or not (the result of a modulo‑1 operation), the boolean values
+ true and false are coerced to xsd:boolean,
+ and strings are coerced to xsd:string.
+ The numeric or boolean values themselves are converted to
+ canonical lexical form, i.e., a deterministic string
+ representation as defined in [XMLSCHEMA11-2].xsd:integer, is a finite-length sequence of decimal
+ digits (0-9) with an optional leading minus sign; leading
+ zeros are prohibited. In JavaScript, implementers can use the following
+ snippet of code to convert an integer to
+ canonical lexical form:(value).toFixed(0).toString()
xsd:double, consists of a mantissa followed by the
+ character E, followed by an exponent. The mantissa is a
+ decimal number and the exponent is an integer. Leading zeros and a
+ preceding plus sign (+) are prohibited in the exponent.
+ If the exponent is zero, it is indicated by E0. For the
+ mantissa, the preceding optional plus sign is prohibited and the
+ decimal point is required. Leading and trailing zeros are prohibited
+ subject to the following: number representations must be normalized
+ such that there is a single digit which is non-zero to the left of
+ the decimal point and at least a single digit to the right of the
+ decimal point unless the value being represented is zero. The
+ canonical representation for zero is 0.0E0.
+ xsd:double's value space is defined by the IEEE
+ double-precision 64-bit floating point type [IEEE-754-2008] whereas
+ the value space of JSON numbers is not
+ specified; when deserializing JSON-LD to RDF the mantissa is rounded to
+ 15 digits after the decimal point. In JavaScript, implementers
+ can use the following snippet of code to convert a double to
+ canonical lexical form:(value).toExponential(15).replace(/(\d)0*e\+?/,'$1E')
true and false are the strings
+ true and false.xsd:double with a value
+ of 2.0 will, e.g., result in an xsd:integer
+ with a value of 2 in canonical lexical form
+ when converted from RDF to JSON-LD and back to RDF. It is important
+ to highlight that in practice it might be impossible to losslessly
+ convert an xsd:integer to a number because
+ its value space is not limited. While the JSON specification [RFC7159]
+ does not limit the value space of numbers
+ either, concrete implementations typically do have a limited value
+ space.xsd:integer, xsd:double, or
+ xsd:boolean are converted to their JSON-native
+ counterparts. If the use native types flag is set to
+ false, all literals remain in their original string
+ representation.http://example.com/ would be serialized as http:\/\/example.com\/.
+ This is problematic as other JSON parsers might not understand those escaping characters.
+ There is no need to backslash-escape forward slashes in JSON-LD. To aid
+ interoperability between JSON-LD processors, forward slashes MUST NOT be
+ backslash-escaped.9. The Application Programming Interface §
+
+ 9.1 The
+
+ JsonLdProcessor Interface §JsonLdProcessor interface is the high-level programming structure
+ that developers use to access the JSON-LD transformation methods.JsonLdError with the corresponding error
+ code
+ and processing is stopped.documentLoader
+ option is specified, it is used to dereference remote documents and contexts.
+ The documentUrl
+ in the returned RemoteDocument
+ is used as base IRI and the
+ contextUrl
+ is used instead of looking at the HTTP Link Header directly. For the sake of simplicity, none of the algorithms
+ in this document mention this directly.[Constructor]
+interface JsonLdProcessor {
+ static Promise<JsonLdDictionary> compact(JsonLdInput input,
+ JsonLdContext context,
+ optional JsonLdOptions? options);
+ static Promise<sequence<JsonLdDictionary>> expand(JsonLdInput input,
+ optional JsonLdOptions? options);
+ static Promise<JsonLdDictionary> flatten(JsonLdInput input,
+ optional JsonLdContext? context,
+ optional JsonLdOptions? options);
+};
+
+ compact
+
+
+ expand
+ method using input and options.
+ @context member, set
+ context to that member's value, otherwise to context.base option from
+ options, if set;
+ otherwise, if the
+ compactToRelative option is
+ true, to the IRI of the currently being processed
+ document, if available; otherwise to null.null as property,
+ expanded input as element, and if passed, the
+ compactArrays flag in options.
+
+ input;
+ it can be specified by using a dictionary, an
+ IRI, or an array consisting of
+ dictionaries and IRIs.expand
+
+
+ application/json,
+ nor application/ld+json, nor any other media type using a
+ +json suffix as defined in [RFC6839], reject the promise passing an
+ loading document failed
+ error.null. If set, the
+ base option from options overrides the base IRI.expandContext option
+ has been passed, update the active context using the
+ Context Processing algorithm, passing the
+ expandContext
+ as local context. If
+ expandContext
+ is a dictionary having an @context member, pass that member's value instead.http://www.w3.org/ns/json-ld#context link relation
+ and a content type of application/json or any media type
+ with a +json suffix as defined in [RFC6839] except
+ application/ld+json, update the active context using the
+ Context Processing algorithm, passing the
+ context referenced in the HTTP Link Header as local context. The
+ HTTP Link Header is ignored for documents served as application/ld+json If
+ multiple HTTP Link Headers using the http://www.w3.org/ns/json-ld#context
+ link relation are found, the promise is rejected with a JsonLdError whose code is set to
+ multiple context link headers
+ and processing is terminated.loading document failed error.frameExpansion option is set, pass the frame expansion flag as true..
+
+ flatten
+
+
+ expand
+ method using input and options.
+ @context member, set
+ context to that member's value, otherwise to context.base option from
+ options, if set;
+ otherwise, if the
+ compactToRelative option is
+ true, to the IRI of the currently being processed
+ document, if available; otherwise to null.0)
+ to be used by the
+ Generate Blank Node Identifier algorithm.compactArrays flag in options
+ (which is internally passed to the
+ Compaction algorithm).
+
+ null is passed, the result will not be compacted
+ but kept in expanded form.dictionary JsonLdDictionary {
+};JsonLdDictionary is the definition of a dictionary
+ used to contain arbitrary key/value pairs which are the result of
+ parsing a JSON Object.
+
+ typedef (JsonLdDictionary or sequence<JsonLdDictionary> or USVString) JsonLdInput;JsonLdInput type is used to refer to an input value that
+ that may be a dictionary, an array of dictionaries or a string representing an
+ IRI which an be dereferenced to retrieve a valid JSON document.typedef (JsonLdDictionary or USVString or sequence<(JsonLdDictionary or USVString)>) JsonLdContext;JsonLdContext type is used to refer to a value that
+ that may be a dictionary, a string representing an
+ IRI, or an array of dictionaries
+ and strings.9.2 The JsonLdOptions Type §
+
+ JsonLdOptions type is used to pass various options to the
+ JsonLdProcessor methods.dictionary JsonLdOptions {
+ USVString? base;
+ boolean compactArrays = true;
+ boolean compactToRelative = true;
+ LoadDocumentCallback documentLoader = null;
+ (JsonLdDictionary? or USVString) expandContext = null;
+ boolean frameExpansion = false;
+ USVString processingMode = null;
+ boolean produceGeneralizedRdf = true;
+};
+ basecompactArraystrue, the JSON-LD processor replaces arrays with just
+ one element with that element during compaction. If set to false,
+ all arrays will remain arrays even if they have just one element.
+ compactToRelativebase option or document location when compacting.documentLoaderexpandContextframeExpansionprocessingModejson-ld-1.0 or json-ld-1.1, the
+ implementation must produce exactly the same results as the algorithms
+ defined in this specification.
+ If set to another value, the JSON-LD processor is allowed to extend
+ or modify the algorithms defined in this specification to enable
+ application-specific optimizations. The definition of such
+ optimizations is beyond the scope of this specification and thus
+ not defined. Consequently, different implementations may implement
+ different optimizations. Developers must not define modes beginning
+ with json-ld as they are reserved for future versions
+ of this specification.produceGeneralizedRdftrue, the JSON-LD processor may emit blank nodes for
+ triple predicates, otherwise they will be omitted.9.3 Remote Document and Context Retrieval §
+
+ 9.3.1 LoadDocumentCallback §
+
+ LoadDocumentCallback defines a callback that custom document loaders
+ have to implement to be used to retrieve remote documents and contexts.callback LoadDocumentCallback = Promise<USVString> (USVString url);
+
+
+ JsonLdError whose code is set to
+ loading document failed
+ or multiple context link headers
+ as described in the next section.9.3.2 RemoteDocument §
+
+ RemoteDocument type is used by a LoadDocumentCallback
+ to return information about a remote document or context.dictionary RemoteDocument {
+ USVString contextUrl = null;
+ USVString documentUrl;
+ any document;
+};
+
+ contextUrlhttp://www.w3.org/ns/json-ld#context link relation in the
+ response. If the response's content type is application/ld+json,
+ the HTTP Link Header is ignored. If multiple HTTP Link Headers using
+ the http://www.w3.org/ns/json-ld#context link relation are found,
+ the Promise of the LoadDocumentCallback is rejected with
+ a JsonLdError whose code is set to
+ multiple context link headers.documentUrldocument9.4 Error Handling §
+
+ 9.4.1 JsonLdError §
+
+ JsonLdError type is used to report processing errors.dictionary JsonLdError {
+ JsonLdErrorCode code;
+ USVString? message = null;
+};
+
+ codemessage9.4.2 JsonLdErrorCode §
+ JsonLdErrorCode represents the collection of valid JSON-LD error
+ codes.enum JsonLdErrorCode {
+ "colliding keywords",
+ "compaction to list of lists",
+ "conflicting indexes",
+ "cyclic IRI mapping",
+ "invalid @id value",
+ "invalid @index value",
+ "invalid @nest value",
+ "invalid @prefix value",
+ "invalid @reverse value",
+ "invalid @version value",
+ "invalid base IRI",
+ "invalid container mapping",
+ "invalid default language",
+ "invalid IRI mapping",
+ "invalid keyword alias",
+ "invalid language map value",
+ "invalid language mapping",
+ "invalid language-tagged string",
+ "invalid language-tagged value",
+ "invalid local context",
+ "invalid remote context",
+ "invalid reverse property",
+ "invalid reverse property map",
+ "invalid reverse property value",
+ "invalid scoped context",
+ "invalid set or list object",
+ "invalid term definition",
+ "invalid type mapping",
+ "invalid type value",
+ "invalid typed value",
+ "invalid value object",
+ "invalid value object value",
+ "invalid vocab mapping",
+ "keyword redefinition",
+ "list of lists",
+ "loading document failed",
+ "loading remote context failed",
+ "multiple context link headers",
+ "processing mode conflict",
+ "recursive context inclusion"
+};
+ colliding keywordscompaction to list of listsconflicting indexescyclic IRI mappinginvalid @id value@id member was encountered whose value was not a
+ string.invalid @index value@index member was encountered whose value was
+ not a string.invalid @nest value@nest has been found.invalid @prefix value@prefix has been found.invalid @reverse value@reverse member has been detected,
+ i.e., the value was not a dictionary.invalid @version value@version key was used in a context with
+ an out of range value.invalid base IRInull.invalid container mapping@container member was encountered whose value was
+ not one of the following strings:
+ @list, @set, or @index.invalid default languagenull and thus invalid.invalid IRI mappinginvalid keyword aliasinvalid language map valueinvalid language mapping@language member in a term definition
+ was encountered whose value was neither a string nor
+ null and thus invalid.invalid language-tagged stringinvalid language-tagged valuetrue, or false with an
+ associated language tag was detected.invalid local contextinvalid remote contextinvalid reverse propertyinvalid reverse property map@context
+ are allowed in reverse property maps.invalid reverse property valueinvalid scoped contextinvalid set or list objectinvalid term definitioninvalid type mapping@type member in a term definition
+ was encountered whose value could not be expanded to an
+ absolute IRI.invalid type value@type member has been detected,
+ i.e., the value was neither a string nor an array
+ of strings.invalid typed valueinvalid value objectinvalid value object value@value member of a
+ value object has been detected, i.e., it is neither
+ a scalar nor null.invalid vocab mappingnull.keyword redefinitionlist of listsloading document failedloading remote context failedmultiple context link headershttp://www.w3.org/ns/json-ld#context link relation
+ have been detected.processing mode conflictrecursive context inclusionA. IDL Index §
[Constructor]
+interface
JsonLdProcessor {
+ static Promise<JsonLdDictionary> compact(JsonLdInput input,
+ JsonLdContext context,
+ optional JsonLdOptions? options);
+ static Promise<sequence<JsonLdDictionary>> expand(JsonLdInput input,
+ optional JsonLdOptions? options);
+ static Promise<JsonLdDictionary> flatten(JsonLdInput input,
+ optional JsonLdContext? context,
+ optional JsonLdOptions? options);
+};
+dictionary JsonLdDictionary {
+};
+typedef (JsonLdDictionary or sequence<JsonLdDictionary> or USVString) JsonLdInput;
+typedef (JsonLdDictionary or USVString or sequence<(JsonLdDictionary or USVString)>) JsonLdContext;
+dictionary JsonLdOptions {
+ USVString? base;
+ boolean compactArrays = true;
+ boolean compactToRelative = true;
+ LoadDocumentCallback documentLoader = null;
+ (JsonLdDictionary? or USVString) expandContext = null;
+ boolean frameExpansion = false;
+ USVString processingMode = null;
+ boolean produceGeneralizedRdf = true;
+};
+callback LoadDocumentCallback = Promise<USVString> (USVString url);
+dictionary RemoteDocument {
+ USVString contextUrl = null;
+ USVString documentUrl;
+ any document;
+};
+dictionary JsonLdError {
+ JsonLdErrorCode code;
+ USVString? message = null;
+};
+enum JsonLdErrorCode {
+ "colliding keywords",
+ "compaction to list of lists",
+ "conflicting indexes",
+ "cyclic IRI mapping",
+ "invalid @id value",
+ "invalid @index value",
+ "invalid @nest value",
+ "invalid @prefix value",
+ "invalid @reverse value",
+ "invalid @version value",
+ "invalid base IRI",
+ "invalid container mapping",
+ "invalid default language",
+ "invalid IRI mapping",
+ "invalid keyword alias",
+ "invalid language map value",
+ "invalid language mapping",
+ "invalid language-tagged string",
+ "invalid language-tagged value",
+ "invalid local context",
+ "invalid remote context",
+ "invalid reverse property",
+ "invalid reverse property map",
+ "invalid reverse property value",
+ "invalid scoped context",
+ "invalid set or list object",
+ "invalid term definition",
+ "invalid type mapping",
+ "invalid type value",
+ "invalid typed value",
+ "invalid value object",
+ "invalid value object value",
+ "invalid vocab mapping",
+ "keyword redefinition",
+ "list of lists",
+ "loading document failed",
+ "loading remote context failed",
+ "multiple context link headers",
+ "processing mode conflict",
+ "recursive context inclusion"
+};
+B. Security Considerations §
+ C. Changes since 1.0 Recommendation of 16 January 2014 §
+
+@context property, which defines a context used for values of
+ a property identified with such a term. This context is used
+ in both the Expansion Algorithm and
+ Compaction Algorithm.@nest property, which identifies a term expanding to
+ @nest which is used for containing properties using the same
+ @nest mapping. When expanding, the values of a property
+ expanding to @nest are treated as if they were contained
+ within the enclosing node object directly.@container values within an expanded term definition may now
+ include @id and @type, corresponding to id maps and type maps.@none value, but
+ JSON-LD 1.0 only allowed string values. This has been updated
+ to allow (and ignore) @none values.@container in an expanded term definition
+ can also be an array containing any appropriate container
+ keyword along with @set (other than @list).
+ This allows a way to ensure that such property values will always
+ be expressed in array form.compactToRelative option to allow IRI compaction (section 6.3 IRI Compaction)
+ to document relative IRIs to be disabled.@prefix member with the value true. The 1.0 algorithm has
+ been updated to only consider terms that map to a value that ends with a URI
+ gen-delim character.@container to include @graph,
+ along with @id, @index and @set.
+ In the Expansion Algorithm, this is
+ used to create a named graph from either a node object, or
+ objects which are values of keys in an id map or index map.
+ the Compaction Algorithm allows
+ specific forms of graph objects to be compacted back to a set of node
+ objects, or maps of node objects.@none keyword, or an alias, for
+ values of maps for which there is no natural index. The Expansion Algorithm removes this indexing
+ transparently."") has been added as a possible value for @vocab in
+ a context. When this is set, vocabulary-relative IRIs, such as the
+ keys of node objects, are expanded or compacted relative
+ to the base IRI using string concatenation.D. Open Issues §
"indexkey":"@index"
+
+{
+ "@context": {
+ "labels":"@index",
+ "main_label":"http://example.org/my-schema#main_label",
+ "other_label":"http://example.org/my-schema#other_label",
+ "homepage":{ "@id":"http://example.org/my-schema#homepage", "@type":"@id"}
+ },
+ "@id":"http://example.org/myresource",
+ "homepage": "http://example.org",
+ "labels": {
+ "main_label": "This is the main label for my resource",
+ "other_label": "This is the other label"
+ }
+}<http://example.org/myresource> <http://example.org/my-schema#homepage> <http://example.org>.
+<http://example.org/myresource> <http://example.org/my-schema#main_label> "This is the main label for my resource".
+<http://example.org/myresource> <http://example.org/my-schema#other_label> "This is the other label".
+
+
{
+ "http://example.com/foo": "foo-value",
+ "http://example.com/bar": {
+ "@value": "bar-value",
+ "@language": "en"
+ },
+ "@context": {
+ "foo": "http://example.com/foo",
+ "bar": "http://example.com/bar"
+ }
+}
+
+{
+ "@graph": [{
+ "foo": ["foo-value"], <-- foo: array of strings
+ "bar": [{ <-- bar: array of objects
+ "@language": "en",
+ "@value": "bar-value"
+ }]
+ }],
+ "@context": {
+ "foo": "http://example.com/foo",
+ "bar": "http://example.com/bar"
+ }
+}
+
+{
+ "@graph": [{
+ "foo": [{ <-- both foo and bar:
+ "@value" : "foo-value" array of objects
+ }],
+ "bar": [{
+ "@language": "en",
+ "@value": "bar-value"
+ }]
+ }],
+ "@context": {
+ "foo": "http://example.com/foo",
+ "bar": "http://example.com/bar"
+ }
+}
+
+
+smaller example that might appear for real):# Bnode references across graph and lists
+PREFIX : <http://www.example.com/>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+
+:G {
+ # Written in short form it would be:
+ # :z :q ("cell-A" "cell-B")
+ # but we want to share the tail ("cell-B")
+
+ :z :q _:z0 .
+
+ _:z0 rdf:first "cell-A" .
+ _:z0 rdf:rest _:z1 .
+
+ _:z1 rdf:first "cell-B" .
+ _:z1 rdf:rest rdf:nil .
+}
+
+:G1 {
+ # This references the tail ("cell-B")
+ :x :p _:z1 .
+}
+
+
+each graph in turn and so does not see the cross graph sharing.
+"For each name and graph object in graph map: "
+is applied or not):{
+ "@graph" : [ {
+ "@graph" : [ {
+ "@id" : ":z",
+ ":q" : {
+ "@list" : [ "cell-A", "cell-B" ]
+ }
+ } ],
+ "@id" : ":G"
+ }, {
+ "@graph" : [ {
+ "@id" : ":x",
+ ":p" : {
+ "@id" : "_:b1"
+ }
+ } ],
+ "@id" : ":G1"
+ } ],
+ "@context" : {
+ "@base" : "http://www.example.com/",
+ "" : "http://www.example.com/",
+ "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ }
+}
+
+
+and its implicit bNodes don't have labels.
+This is a different dataset with no shared bNode.
+correctly serialized.{
+ "@language": "en",
+ "displayName": "foo"
+}{
+ "@context": {"@language": "en"},
+ "displayName": "foo"
+}{
+ "@context": {
+ "@label": "An Example Context",
+ "displayName": "@label",
+ },
+ "displayName": "A Simple Label"
+}_:c14n0 <http://www.w3.org/2000/01/rdf-schema#label> "A Simple Label" .
+Problem description §
+[ [3.1,51.06,30],
+ [3.1,51.06,20] ]Suggested solution §
+@values keyword, which can be used to describe the values of a @set or a @list container in more detail.@values, then the precise amount of objects within this array corresponds with the array in the graph in this order.@values, each value of the array in the graph is mapped according to this template.Example §
+{
+ "@context": {
+ "coordinates": {
+ "@id": "geojson:coordinates",
+ "@container" : "@list",
+ "@values" : {
+ "@type" : "geojson:Coordinate",
+ "@container" : "@set",
+ "@values" : [
+ {"@type" : "xsd:double", "@id":"geo:longitude"},
+ {"@type" : "xsd:double", "@id":"geo:latitude"}
+ ]
+ }
+ }
+ },
+ "@graph" : [{
+ "@id" : "ex:LineString1",
+ "coordinates" : [
+ [
+ 3.1057405471801753,
+ 51.064216229943476
+ ],
+ [
+ 3.1056976318359375,
+ 51.063434090307574
+ ]
+ ]
+ }]
+}ex:LineString1 geojson:coordinates _:b0 .
+_:b0 rdf:first _:b1 .
+_:b1 a geojson:Coordinate ;
+ geo:longitude "3.105740547180175E0"^^xsd:double ;
+ geo:latitude "5.106421622994348E1"^^xsd:double .
+_:b0 rdf:rest _:b2 .
+_:b2 rdf:first a geojson:Coordinate ;
+ geo:longitude "3.1056976318359375"^^xsd:double ;
+ geo:latitude "51.063434090307574"^^xsd:double .
+_:b2 rdf:rest rdf:nil .{
+ "@context": {
+ "type": "@type",
+ "profile": "@type"
+ },
+ "type": "cov:Coverage",
+ "profile": "cov:GridCoverage"
+}{
+ "@context": {
+ "type": {"@id": "rdf:type", "@type": "@id" },
+ "profile": {"@id": "rdf:type", "@type": "@id" }
+ },
+ "type": "cov:Coverage",
+ "profile": "cov:GridCoverage"
+}@type?@context and @graph only; obviously, this only will work for systems that can access key/values in order, and for systems that ensure that @context comes lexically before @graph in the output. Obviously, only implementations that can read and write JSON objects with key ordering intact will be able to take advantage of such streaming capability.stratified_doc[triple.subject][triple.predicate] or even better stratified[triple.graph][triple.subject][triple.predicate].@stratified parameter for expansion.Example §
+{
+ "@context": {
+ "dc": "http://purl.org/dc/elements/1.1/",
+ "ex": "http://example.org/vocab#",
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "ex:contains": {
+ "@type": "@id"
+ }
+ },
+ "@id": "http://example.org/graph/0",
+ "dc:creator": "Jane Doe",
+ "@graph": [
+ {
+ "@id": "http://example.org/library",
+ "@type": "ex:Library",
+ "ex:contains": "http://example.org/library/the-republic"
+ }
+ ]
+}stratified would therefore look like:{
+ "http://example.org/graph/0": {
+ "http://example.org/library": {
+ "@type": "http://example.org/vocab#Library",
+ "http://example.org/vocab#contains": {
+ "@id": "http://example.org/library/the-republic"
+ }
+ },
+ "http://example.org/library/the-republic": {}
+ },
+ "@graph": {
+ "http://example.org/graph/0": {
+ "http://purl.org/dc/elements/1.1/creator": "Jane Doe"
+ }
+ }
+}// Access a triple from the default graph
+var creator = stratified['@graph']['http://example.org/graph/0']['http://purl.org/dc/elements/1.1/creator'];
+// "Jane Doe"
+
+// Access a triple in a named graph
+var type = stratified['http://example.org/graph/0']['http://example.org/library']['@type'];
+// "http://example.org/vocab#Library"
+
+// Before submitting a document, mutate a property
+stratified['http://example.org/graph/0']['http://example.org/library/the-republic']['@type'] = 'http://example.org/vocab#Book';
+
+// Or using an immutable spread syntax approach
+var new_doc = {
+ ...stratified,
+ 'http://example.org/graph/0': {
+ ...stratified['http://example.org/graph/0'],
+ 'http://example.org/library/the-republic' : {
+ ...stratified['http://example.org/graph/0']['http://example.org/library/the-republic'],
+ '@type': 'http://example.org/vocab#Book'
+ }
+ }
+}"seeAlso": [
+ "http://example.org/reference1",
+ {"id": "http://example.org/reference2", "format": "text/html"}
+ ]
+
+"seeAlso": [
+ {"id": "http://example.org/reference1"},
+ {"id": "http://example.org/reference2", "format": "text/html"}
+ ]
+@container:@set functionality (AFAIU) is to ensure that the output is consistent in shape. Thus if there can ever be multiple values, the structure is always an array.
+
+@type As it's a keyword, we can only alias it (e.g. as type) but not define it to have @container:@set functionality. Meaning that there's a gotcha waiting to happen for ontologies that require or use multiple classes for a single resource instance. See playground@context Less useful, but @context will also compact to a single string/object when there might be multiple contexts. See playground@context modifying itself seems particularly strange, but the inconsistency for @type seems solvable if the restrictions in its definition were loosened?{
+ "@context": {
+ "@vocab" : "http://vocab.getty.edu/",
+ "a" : "http://vocab.getty.edu/aaaaaaaaaat/"
+ },
+ "@id" : "http://vocab.getty.edu/aaaaaaaaaat/5001065997",
+ "@type": "http://vocab.getty.edu/aaaaaaaaaat/datatype"
+}3 of the spec, because http://vocab.getty.edu/aaaaaaaaaat/5001065997 contains the value of @vocab, it gets compacted as aaaaaaaaaat/5001065997 without even looking at the prefixes. I think this is not reasonable, in this case a:5001065997 would look much nicer IMO.<http://example.com> <http://example.com/property> _:a .
+_:a a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+
+[ {
+ "@id" : "http://example.com",
+ "http://example.com/property" : [ {
+ "@list" : [ {
+ "@value" : "a"
+ }, {
+ "@value" : "b"
+ }, {
+ "@value" : "c"
+ } ]
+ } ]
+} ]<http://example.com> <http://example.com/property> <urn:a> .
+<urn:a> a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <urn:b> .
+<urn:b> a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <urn:c> .
+<urn:c> a <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" ;
+ <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
+
+urn:c. This leads to the same problem we were having when using blank node IDs.[ {
+ "@id" : "http://example.com",
+ "http://example.com/property" : [ {
+ "@id" : "urn:a"
+ } ]
+}, {
+ "@id" : "urn:a",
+ "@type" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#List" ],
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" : [ {
+ "@value" : "a"
+ } ],
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" : [ {
+ "@id" : "urn:b"
+ } ]
+}, {
+ "@id" : "urn:b",
+ "@type" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#List" ],
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" : [ {
+ "@value" : "b"
+ } ],
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" : [ {
+ "@list" : [ {
+ "@value" : "c"
+ } ]
+ } ]
+} ]{
+ "@context": "http://schema.org/",
+ "@id": "document",
+ "b": "text",
+ "a": "more text"
+
+}
+
+{
+ "@context": "http://schema.org/",
+ "@id": "document",
+ "b": {},
+ "a": {}
+}
+
+
+b and a (to be alphabetical), and not the order given in the frame. Framing is a really elegant way to specify the nesting order, but it would be nice for framing to also be able to dictate the ordering, so that the output data file really follows the exact structure of the given frame."@version": 1.1), semantic versioning would suggest that we use a major release number, rather than a minor number.2.1 or 3.0, which is odd given that the previous recommendation is 1.0."title": [ { "value": "Moby Dick", "lang": "en" },
+ { "value": "موبي ديك", "lang": "ar" "dir": "rtl"}
+ ]
+
+"title": [ { "@value": "Moby Dick", "@language": "en" },
+ { "@value": "موبي ديك", "@language": "ar" "dir": "rtl"}
+ ]
+
+dir term is not defined in the relevant @context so that, when generating the RDF output, that term is simply ignored. But that also means that there is no round-tripping, that term will disappear after expansion.
+
+@dir term, alongside @language. This means this term can be used in place of dir above, ie, it is a bona-fide part of a string representation, and would therefore be kept in the compaction/expansion steps, can also be used for framing.@dir is ignored when transforming into RDF. I.e., only the language tag would be used.
+3.1. Define a mechanism of "parametrized" standard datatypes that represent a (language,direction) pair. One would then get something like[] ex:title "موبي ديك"^^rdf:internationalText(ar,rtl) ;
+3.2. Go for a "generalized" RDF where strings can also appear as subjects (that has been a matter of dispute for a long time...). That would give the possibility to add such attribute to texts like directions
+3.3. Some other mechanisms that I cannot think about@dir value can be properly mapped onto an RDF representing the right choices (if such choices are worked out)@list for encoding schema:ItemList serializations, when the values are schema:ListItem and order is set through schema:position. ItemList can be used with text values as well, but this is already reasonably supported natively.{
+ "@context": {
+ "@vocab": "http://schema.org/",
+ "itemListElement": {"@container": "@listItem"}
+ },
+ "@type": "ItemList",
+ "@url": "http://en.wikipedia.org/wiki/Billboard_200",
+ "name": "Top music artists",
+ "description": "The artists with the most cumulative weeks at number one according to Billboard 200",
+ "itemListElement": [
+ {"@type": "MusicGroup", "name": "Beatles"},
+ {"@type": "MusicGroup", "name": "Elvis Presley"},
+ {"@type": "MusicGroup", "name": "Michael Jackson"},
+ {"@type": "MusicGroup", "name": "Garth Brooks" }
+ ][
+ {
+ "@id": "http://en.wikipedia.org/wiki/Billboard_200",
+ "@type": ["http://schema.org/ItemList"],
+ "http://schema.org/description": [{
+ "@value": "The artists with the most cumulative weeks at number one according to Billboard 200"
+ }],
+ "http://schema.org/itemListElement": [{
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Beatles"}]
+ }],
+ "http://schema.org/position": [{"@value": 1}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Elvis Presley"}]
+ }],
+ "http://schema.org/position": [{"@value": 2}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Michael Jackson"}]
+ }],
+ "http://schema.org/position": [{"@value": 3}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Garth Brooks"}]
+ }],
+ "http://schema.org/position": [{"@value": 3}]
+ }
+ ],
+ "http://schema.org/name": [{"@value": "Top music artists"}]
+}]@list.position, and ignore any nextItem or previousItem entries.position values are lost when compacting, and duplicate values may lead to undefined relative ordering.
+
+@graph handling and a bit of @version handlingprocessingMode API option. Due to practicalities of jsonld.js not having a full correct 1.0 only lib, it seems not worth the effort to try and deal with this any other way. There are edge cases where a 1.1 lib in 1.0 mode will produce different results than a 1.0 lib. My guess is that in practice this really doesn't matter. Or in any case, is not worth handling on the playground.E. Acknowledgements §
F. References §
F.1 Normative references §
F.2 Informative references §
+
+
JSON-LD 1.1 Framing
+ An Application Programming Interface for the JSON-LD Syntax
+ Final Community Group Report
+
+
+
+
+
+
+Abstract
+Status of This Document
Set of Documents
+ 1. Introduction §
+1.1 How to Read this Document §
+
+
+
+
+1.2 Contributing §
+
+
+
+
+1.3 Terminology §
+
+
+
+@context where
+ the value, or the @id of the value, is null
+ explicitly decouples a term's association with an IRI. A key-value pair in
+ the body of a JSON-LD document whose value is null has the
+ same meaning as if the key-value pair was not defined. If
+ @value, @list, or @set is set to
+ null in expanded form, then the entire JSON
+ object is ignored.
+_:._:.@default member.
+
+ @value, @list,
+ or @set keywords, or@graph and @context.@id key.@version member in a
+ context, or via explicit API option, other processing modes
+ can be accessed. This specification defines extensions for the
+ json-ld-1.1 processing mode.@type, and values of terms defined to be vocabulary relative
+ are resolved relative to the vocabulary mapping, not the base IRI.@value
+ member.@vocab key whose
+ value MUST be an absolute IRI null.1.3.1 Algorithm Terms §
+
+
+
+
+@graph member, or only if required to represent multiple node objects.1.4 Typographical conventions §
+
+
+
+ markupmarkup definition reference markup external definition referenceExamples are in light khaki boxes, with khaki left border, and with a
+numbered "Example" header in khaki. Examples are always informative.
+The content of the example is in monospace font and may be syntax colored.2. Features §
2.1 Framing §
{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library",
+ "contains": {
+ "@type": "Book",
+ "contains": {
+ "@type": "Chapter"
+ }
+ }
+}ex:Library at the top, with objects of
+ type ex:Book that were linked to the library object using
+ the ex:contains property embedded as property values. It also
+ places objects of type ex:Chapter within the referencing ex:Book object
+ as embedded values of the book object.{
+ "@context": {
+ "@vocab": "http://example.org/",
+ "contains": {"@type": "@id"}
+ },
+ "@graph": [{
+ "@id": "http://example.org/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"
+ }]
+}{
+ "@context": {"@vocab": "http://example.org/"},
+ "@graph": [{
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "contains": {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction"
+ },
+ "creator": "Plato",
+ "title": "The Republic"
+ }
+ }]
+}json-ld-1.1, or the omit graph flag is true,
+ the top-level @graph member may be omitted.{
+ "@context": {"@vocab": "http://example.org/"},
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "contains": {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction"
+ },
+ "creator": "Plato",
+ "title": "The Republic"
+ }
+}@type of Library, and a
+ contains property with another
+ frame used to match values of that property. The input document contains
+ exactly one such node object. The value of contains also has
+ a node object, which is then treated as a frame to match the set of subjects
+ which are contains values of the Library object, and so forth.2.2 Default content §
+ false, the framing algorithm
+ will add a property and value to the result. The @default property
+ in a node object or value object provides a default value to use in the resulting
+ output document. If there is no @default value, the property will be output
+ with a null value. (See section 2.3.3 Omit default flag
+ for ways to avoid this).{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library",
+ "description": "A great Library.",
+ "contains": {
+ "@type": "Book",
+ "description": {"@default": "A great book."},
+ "contains": {
+ "@type": "Chapter"
+ }
+ }
+}{
+ "@context": {"@vocab": "http://example.org/"},
+ "@graph": [{
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "contains": {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction"
+ },
+ "creator": "Plato",
+ "description": "A great book.",
+ "title": "The Republic"
+ },
+ "description": null
+ }]
+}2.3 Framing Flags §
+ 2.3.1 Object Embed Flag §
+
+ embed option.
+ Consider the following frame
+ based on the default @last value of the object embed flag:{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library"
+}@last
+ (in addition to the explicit inclusion flag being false),
+ non-listed properties are added two the output, and implicitly embedded
+ using a default empty frame. As a result, the same output used in the
+ Framed library objects above is generated.@embed property is added explicitly with a
+ value of @never, the values for Book and Chapter will be excluded.{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library",
+ "contains": {
+ "@type": "Book",
+ "@embed": "@never"
+ }
+}{
+ "@context": {"@vocab": "http://example.org/"},
+ "@graph": [{
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/library/the-republic"
+ }
+ }]
+}2.3.2 Explicit inclusion flag §
+ false, which means that properties
+ present in an input node object that are not in the associated frame will be
+ included in the output object.
+ The initial value for the explicit inclusion flag is set using the
+ explicit option.
+ If true, only properties present in
+ the input frame will be placed into the output.{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library",
+ "description": {},
+ "contains": {
+ "@type": "Book",
+ "@explicit": true,
+ "title": {},
+ "contains": {
+ "@type": "Chapter"
+ }
+ }
+}{
+ "@context": {"@vocab": "http://example.org/"},
+ "@graph": [{
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "contains": {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction"
+ },
+ "creator": "Plato",
+ "title": "The Republic"
+ }
+ }]
+}2.3.3 Omit default flag §
+ omitDefault option.
+ See section 2.2 Default content for a further discussion.2.3.4 Omit graph flag §
+ @graph, or not.
+ The initial value for the omit graph flag is set using the
+ omitGraph option, or based on
+ the processing mode; if processing mode is json-ld-1.0, the output
+ always includes a @graph member, otherwise, the @graph member is used only
+ to describe multiple node objects, consistent with compaction.
+ See section 4.2.2 Framing Algorithm for a further discussion.2.3.5 Require all flag §
+ @type and other
+ properties, a match is made when any property value in the
+ object matches the node pattern in the frame object if
+ the value of the require all flag is false (the
+ default). If the flag value is true, then all
+ properties in the frame object must be present in the node
+ object for the node to match.2.4 Reverse Framing §
+ {
+ "@context": {
+ "@vocab": "http://example.org/",
+ "within": {"@reverse": "contains"}
+ },
+ "@type": "Chapter",
+ "within": {
+ "@type": "Book",
+ "within": {
+ "@type": "Library"
+ }
+ }
+}{
+ "@context": {
+ "@vocab": "http://example.org/",
+ "within": {"@reverse": "contains"}
+ },
+ "@graph": [{
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction",
+ "within": {
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "contains": {"@id": "http://example.org/library/the-republic#introduction"},
+ "creator": "Plato",
+ "title": "The Republic",
+ "within": {
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "contains": {"@id": "http://example.org/library/the-republic"}
+ }
+ }
+ }]
+}2.5 Framing Named Graphs §
+ @graph, which allows information from named graphs
+ contained within a JSON-LD document to be exposed within it's proper
+ graph context. By default, framing uses a merged graph, composed of all
+ the node objects across all graphs within the input. By using @graph
+ within a frame, the output document can include information specifically
+ from named graphs contained within the input document.http://example.org/graphs/books:{
+ "@context": {"@vocab": "http://example.org/"},
+ "@type": "Library",
+ "contains": {
+ "@id": "http://example.org/graphs/books",
+ "@graph": {
+ "@type": "Book"
+ }
+ }
+}[{
+ "@context": {"@vocab": "http://example.org/"},
+ "@id": "http://example.org/graphs/books",
+ "@graph": [{
+ "@id": "http://example.org/library/the-republic",
+ "@type": "http://example.org/Book",
+ "http://example.org/contains": {
+ "@id": "http://example.org/library/the-republic#introduction"
+ },
+ "http://example.org/creator": "Plato",
+ "http://example.org/title": "The Republic"
+ }, {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "http://example.org/Chapter",
+ "http://example.org/description": "An introductory chapter on The Republic.",
+ "http://example.org/title": "The Introduction"
+ }]
+}, {
+ "@context": {"@vocab": "http://example.org/"},
+ "@id": "http://example.org/library",
+ "@type": "http://example.org/Library",
+ "http://example.org/contains": {"@id": "http://example.org/graphs/books"},
+ "http://example.org/name": "Library"
+}]{
+ "@context": {"@vocab": "http://example.org/"},
+ "@graph": [{
+ "@id": "http://example.org/library",
+ "@type": "Library",
+ "name": "Library",
+ "contains": {
+ "@id": "http://example.org/graphs/books",
+ "@graph": [{
+ "@id": "http://example.org/library/the-republic",
+ "@type": "Book",
+ "creator": "Plato",
+ "title": "The Republic",
+ "contains": {
+ "@id": "http://example.org/library/the-republic#introduction",
+ "@type": "Chapter",
+ "description": "An introductory chapter on The Republic.",
+ "title": "The Introduction"
+ }
+ }]
+ }
+ }]
+}3. Conformance §
4. Framing Algorithms §
+
+4.1 Syntax Tokens and Keywords §
+
+
+
+ @default@embed@embed as the following:
+
+
+ @always@last@embed nor object embed flag
+ is not specified.
+ @nevertrue@last).false@never).@embed is invalid and indicates that an
+ invalid @embed value
+ error has been detected and processing is aborted.@explicit@nullnull
+ should be returned, which would otherwise be removed when
+ Compacting.@omitDefault@requireAll4.2 Framing §
+4.2.1 Framing Requirements §
+
+
+@default MAY include the value @null,
+ or an array containing only @null, in addition to other values
+ allowed in the grammar for values of keys expanding to absolute IRIs.
+ Processors MUST preserve this value when expanding. All other key/value pairs of
+ a default object MUST be ignored.@id and @type may also be an empty dictionary, or an array
+ containing only an empty dictionary.
+ Processors MUST preserve this value when expanding.@graph key at the top level.
+ Nodes with a subject that is also a named graph, where
+ the frame object contains @graph, extend framing
+ to node objects from the associated named graph.4.2.2 Framing Algorithm §
+
+invalid frame
+ error has been detected and processing is aborted.
+ Need more specifics as to what constitutes a valid frame.frameDefault option
+ is present with the value true, set graph name to @default.
+ Otherwise, create merged node map using the Merge Node Maps algorithm
+ with graph map and add merged node map as the value of @merged
+ in graph map and set graph name to @merged.true,
+ the explicit inclusion flag set to false,
+ the require all flag set to true,
+ the omit default flag set to false,
+ graph map, graph name,
+ along with map of flattened subjects
+ set to the property associated with graph name in graph map, and
+ graph stack set to an empty array. The initial values of the
+ object embed flag, require all flag, and omit default flag
+ MUST be overridden by values set in options.
+ Also initialize results as an empty array.null as active property.null,
+ and if it is a dictionary, it MUST NOT be null.
+
+
+@embed, @explicit, and @requireAll in frame.
+
+ @id and id.@never or if a
+ circular reference would be created by an embed,
+ add output to parent
+ and do not perform additional processing for this node.@last,
+ remove any existing embedded node from parent associate with
+ graph name in state.
+ Requires sorting of subjects. We could consider @sample, to embed
+ just the first matched node. With sorting, we could also consider @first.@last or @always
+
+
+
+
+ @graph,
+ set recurse to true, unless graph name in state is @merged
+ and set subframe to a new empty dictionary.@graph in frame,
+ or a new empty dictionary, if it does not exist, and
+ set recurse to true, unless id
+ is @merged or @default.true:
+
+
+ @graph as active property.
+
+
+ true,
+ processors MUST NOT add any values for property to output, and the following
+ steps are skipped.
+
+ @list, then each
+ listitem in the list is processed in sequence and added to a new list dictionary
+ in output:
+
+
+ @id from listitem
+ as the sole member of a new subjects array,
+ the first value from @list in frame as frame,
+ list as parent, and @list as active property.
+ If frame does not exist, create a new frame using a new dictionary
+ with properties for @embed, @explicit and @requireAll
+ taken from embed, explicit and requireAll.
+ Could this use the list array, and null for active property?@list in list.@id from item
+ as the sole member of a new subjects array,
+ the first value from property in frame as frame,
+ output as parent, and property as active property.
+ If frame does not exist, create a new frame using a new dictionary
+ with properties for @embed, @explicit and @requireAll
+ taken from embed, explicit and requireAll.
+
+ @omitDefault with a value of true,
+ or does not contain @omitDefault and the value of
+ the omit default flag is true.@preserve and
+ a value that is a copy of the value of @default in
+ frame if it exists, or the string @null
+ otherwise.@reverse, then
+ for each reverse property and sub frame that are the values of @reverse in frame:
+
+
+ @reverse property in output with a new dictionary reverse dict as its value.@id of id:
+
+
+ null as active property,
+ and the array value of reverse property in reverse dict as parent.json-ld-1.1,
+ remove the @id member of each node object where the
+ member value is a blank node identifier which appears only once
+ in any property value within result.compact
+ method using results, context, and
+ options.false and
+ compacted results does not have a top-level @graph member, or its value is
+ not an array, modify compacted results to place the non @context properties
+ of compacted results into a dictionary contained within the array value of
+ @graph. If the omit graph flag is true, a
+ top-level @graph member is used only to contain multiple node objects.@preserve with the value from the key-pair.
+ If the value from the key-pair is @null, replace the value with null.
+ If, after replacement, an array contains a single array value, replace the array with that value.
+ If, after replacement, an array contains only the value null remove the value, leaving
+ an empty array.4.2.3 Frame Matching Algorithm §
+
+ @type,
+ or @id,
+ or if it matches given one of several different properties (or all properties, if the
+ require all flag is present.).
+
+[] (match none)[frame object] (node pattern)[IRI+]@type and @id,
+ which allows a match on any of the listed IRIs.[value object] (value pattern)@value, @type, and @language
+ may also be an array of one or more string values.{} (wildcard)@id, then
+ a particular @type (or lack of @type), then by matching on any or all
+ of a set of properties, if neither @id, nor @type are in the frame.
+
+@id property value
+ which is also a value of the @id property in frame.
+ Otherwise, node does not match if frame has a non-empty
+ @id property, other than an empty dictionary.
+ Otherwise, frame must not have a @id property; continue to the next step.
+ @id property; thus the "@id": [] pattern would
+ never match any node object. the "@id": [{}] pattern would
+ match any node object and is equivalent to not specifying a
+ @id property in frame at allkeyword properties.
+
+ @type:
+
+
+ @type property in frame includes any IRI in values.@type property in frame is .wildcard@type property in frame is .match none@default with any value,
+ and any other property in node has a non-default match., and further matching is aborted.match none.wildcardvalue pattern (value pattern):
+ property matching is determined using the Value matching algorithm.
+
+ 4.2.4 Value Pattern Matching Algorithm §
+
+ and match none
+ patterns on wildcard@value, @type, and
+ @language, in addition to allowing a specific value to match a
+ set of values defined using the array form for each value
+ object property.value pattern (pattern) and value object (value) as parameters.
+ Value matches pattern using the following algorithm:
+
+@value, @type, and @language in value, or null if none exists.@value, @type, and @language in value pattern, or null if none exists., or:
+ wildcard
+
+ , andwildcard, or null, or t1 is wildcardnull and t2 is null or , andmatch none, or null, or l1 is wildcardnull and l2 is null or .match none5. The Application Programming Interface §
+
+ 5.1 JsonLdProcessor §
+
+ [Constructor]
+interface JsonLdProcessor {
+ static Promise<JsonLdDictionary> frame(JsonLdInput input,
+ (JsonLdDictionary or USVString) frame,
+ optional JsonLdOptions? options);
+};JsonLdProcessor interface
+ frame method
+ Frames
+ the given input using frame
+ according to the steps in the Framing
+ Algorithm:
+
+
+ expand
+ method using
+ frame and
+ options with
+ expandContext set to null
+ and the frameExpansion option set to true.
+ @context
+ from frame, if it exists, or to
+ a new empty context, otherwise.null.@graph set the frameDefault
+ option to options with the
+ value true.
+
+
+ input; either
+ in the form of an dictionary or as IRI.5.2 Error Handling §
+ JsonLdFramingError type is used to report processing errors.dictionary
JsonLdFramingError {
+ JsonLdFramingErrorCode code;
+ USVString? message = null;
+};
+
+enum JsonLdFramingErrorCode {
+ "invalid frame",
+ "invalid @embed value"
+};
+
+
+ codemessageJsonLdFramingErrorCode represents the collection of valid JSON-LD Framing error
+ codes.
+ invalid @embed value@embed is not one recognized for the object embed flag.
+ invalid frame5.3 Data Structures §
+ 5.3.1 JsonLdContext §
+ 5.3.2 JsonLdOptions §
+ JsonLdOptions type is used to pass various options to the
+ JsonLdProcessor methods.dictionary
JsonLdOptions {
+ (JsonLdEmbed or boolean) embed = "@last";
+ boolean explicit = false;
+ boolean omitDefault = false;
+ boolean omitGraph;
+ boolean requireAll = false;
+ boolean frameDefault = false;
+};
+
+enum JsonLdEmbed {
+ "@always",
+ "@last",
+ "@never"
+};
+
+ embedtrue sets the flag to
+ @last, while an value of false sets the flag
+ to @never.explicitframeDefaultomitDefaultomitGraphfalse if processing mode if json-ld-1.0, true otherwise.requireAllJsonLdEmbed enumerates the values of the embed option:
+
+ @always@last@embed nor object embed flag
+ is not specified.@neverA. IANA Considerations §
application/ld-frame+json §
+
+
+
+application/json MIME media type.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.
+
+ B. Security Considerations §
+ C. IDL Index §
[Constructor]
+interface
JsonLdProcessor {
+ static Promise<JsonLdDictionary> frame(JsonLdInput input,
+ (JsonLdDictionary or USVString) frame,
+ optional JsonLdOptions? options);
+};
+dictionary JsonLdFramingError {
+ JsonLdFramingErrorCode code;
+ USVString? message = null;
+};
+enum JsonLdFramingErrorCode {
+ "invalid frame",
+ "invalid @embed value"
+};
+dictionary JsonLdOptions {
+ (JsonLdEmbed or boolean) embed = "@last";
+ boolean explicit = false;
+ boolean omitDefault = false;
+ boolean omitGraph;
+ boolean requireAll = false;
+ boolean frameDefault = false;
+};
+enum JsonLdEmbed {
+ "@always",
+ "@last",
+ "@never"
+};
+D. Changes since 1.0 Draft of 30 August 2012 §
+
+@embed) can take on different
+ values to better control object embedding. and wildcard
+ can be used for type and property values.match none@value, @type, and @language
+ can use and wildcard
+ and may also use a set of specific strings to match (e.g., a set of specific
+ languages).match none@reverse.@id to allow for matching
+ specific objects in a frame.json-ld-1.1,
+ @id members who's value is a blank node identifier
+ used only for that @id are removed.@link and in-memory object linking.omitDefault API option and/or
+ the current processing mode.E. Open Issues §
{
+ "@context": "http://schema.org/",
+ "@id": "document",
+ "b": "text",
+ "a": "more text"
+
+}
+
+{
+ "@context": "http://schema.org/",
+ "@id": "document",
+ "b": {},
+ "a": {}
+}
+
+
+b and a (to be alphabetical), and not the order given in the frame. Framing is a really elegant way to specify the nesting order, but it would be nice for framing to also be able to dictate the ordering, so that the output data file really follows the exact structure of the given frame.
+Cannot declare a const variable twice: 'e'.
+
+@id property value which is also a value of the @id property in frame.{
+ "@context": "http://schema.org",
+ "@type": "Person",
+ "alumniOf": {
+ "@id": "_:univ",
+ "@type": "CollegeOrUniversity"
+ },
+ "worksFor": { "@id": "_:univ" }
+}@reverse property in a frame be removed from its resource to avoid a necessarily circular reference?
+Z is Y
+Z in X{
+ "id": "X",
+ "includes": ["Y"],
+ "uses": [{"id": "Z", "is": "Y"}]
+}
+
+in property is still present in Z.F. Acknowledgements §
G. References §
G.1 Normative references §
G.2 Informative references §
+
+
JSON-LD 1.1
+ A JSON-based Serialization for Linked Data
+ Final Community Group Report
+
+
+
+
+
+
+Abstract
+ Status of This Document
Set of Documents
+ 1. Introduction §
+
+
+ 1.1 How to Read this Document §
+
+
+ 1.2 Contributing §
+
+
+
+
+ 1.3 Terminology §
+
+
+
+@context where
+ the value, or the @id of the value, is null
+ explicitly decouples a term's association with an IRI. A key-value pair in
+ the body of a JSON-LD document whose value is null has the
+ same meaning as if the key-value pair was not defined. If
+ @value, @list, or @set is set to
+ null in expanded form, then the entire JSON
+ object is ignored.
+_:._:.@language key whose
+ value MUST be a string representing a [BCP47] language code or null.@graph member, and may also have
+ @id, and @index members.
+ A simple graph object is a
+ graph object which does not have an @id member. Note
+ that node objects may have a @graph member, but are
+ not considered graph objects if they include any other properties.
+ A top-level object consisting of @graph is also not a graph object.@container set to @id, who's keys are
+ interpreted as IRIs representing the @id
+ of the associated node object; value MUST be a node object.
+ If the value contains a property expanding to @id, it's value MUST
+ be equivalent to the referencing key.@container is set to @graph.@container set to @index, whose values MUST be any of the following types:
+ string,
+ number,
+ true,
+ false,
+ null,
+ node object,
+ value object,
+ list object,
+ set object, or
+ an array of zero or more of the above possibilities.
+ @container set to @language, whose keys MUST be strings representing
+ [BCP47] language codes and the values MUST be any of the following types:
+ null,
+ string, or
+ an array of zero or more of the above possibilities.
+ @list
+ member.@context keyword.
+
+ @value, @list,
+ or @set keywords, or@graph and @context.@version member in a
+ context, or via explicit API option, other processing modes
+ can be accessed. This specification defines extensions for the
+ json-ld-1.1 processing mode.@type, and values of terms defined to be vocabulary relative
+ are resolved relative to the vocabulary mapping, not the base IRI.@set
+ member.@container set to @type, who's keys are
+ interpreted as IRIs representing the @type
+ of the associated node object;
+ value MUST be a node object, or array of node objects.
+ If the value contains a property expanding to @type, it's values
+ are merged with the map value when expanding.@value
+ member.@vocab key whose
+ value MUST be an absolute IRI null.1.4 Typographical conventions §
+
+
+
+ markupmarkup definition reference markup external definition referenceExamples are in light khaki boxes, with khaki left border, and with a
+numbered "Example" header in khaki. Examples are always informative.
+The content of the example is in monospace font and may be syntax colored.1.5 Design Goals and Rationale §
+
+@context
+ and @id) to use the basic functionality in JSON-LD.1.6 Data Model Overview §
1.7 Syntax Tokens and Keywords §
+
+
+
+ :@base@container@context@context keyword is described in detail in
+ section 3.1 The Context.@graph@id@index@language@list@nest@none@prefix@reverse@set@type@value@versionjson-ld-1.1.
+ @vocab@type with a common prefix
+ IRI. This keyword is described in section 4.3 Default Vocabulary.2. Conformance §
+
+dc:http://purl.org/dc/terms/cred:https://w3id.org/credentials#foaf:http://xmlns.com/foaf/0.1/provhttp://www.w3.org/ns/prov#rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#schema:http://schema.org/xsd:http://www.w3.org/2001/XMLSchema#3. Basic Concepts §
{
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/",
+ "image": "http://manu.sporny.org/images/manu.png"
+}name is "Manu Sporny"
+ and that the homepage property contains the URL of that person's homepage.
+ A machine doesn't have such an intuitive understanding and sometimes,
+ even for humans, it is difficult to resolve ambiguities in such representations. This problem
+ can be solved by using unambiguous identifiers to denote the different concepts instead of
+ tokens such as "name", "homepage", etc.name and homepage, to expand to IRIs
+ so that developers don't accidentally step on each other's terms. Furthermore, developers and
+ machines are able to use this IRI (by using a web browser, for instance) to go to
+ the term and get a definition of what the term means. This process is known as IRI
+ dereferencing.{
+ "http://schema.org/name": "Manu Sporny",
+ "http://schema.org/url": { "@id": "http://manu.sporny.org/" }, ← The '@id' keyword means 'This value is an identifier that is an IRI'
+ "http://schema.org/image": { "@id": "http://manu.sporny.org/images/manu.png" }
+}@id keyword. While this is a valid JSON-LD
+ document that is very specific about its data, the document is also overly verbose and difficult
+ to work with for human developers. To address this issue, JSON-LD introduces the notion
+ of a context as described in the next section.3.1 The Context §
{
+ "@context": {
+ "name": "http://schema.org/name", ← This means that 'name' is shorthand for 'http://schema.org/name'
+ "image": {
+ "@id": "http://schema.org/image", ← This means that 'image' is shorthand for 'http://schema.org/image'
+ "@type": "@id" ← This means that a string value associated with 'image' should be interpreted as an identifier that is an IRI
+ },
+ "homepage": {
+ "@id": "http://schema.org/url", ← This means that 'homepage' is shorthand for 'http://schema.org/url'
+ "@type": "@id" ← This means that a string value associated with 'homepage' should be interpreted as an identifier that is an IRI
+ }
+ }
+}image and homepage, if they are
+ strings, are to be interpreted as
+ IRIs. Expanded term definitions
+ also allow terms to be used for index maps
+ and to specify whether array values are to be
+ interpreted as sets or lists.
+ Expanded term definitions may
+ be defined using absolute or
+ compact IRIs as keys, which is
+ mainly used to associate type or language information with an
+ absolute or compact IRI.https://json-ld.org/contexts/person.jsonld,
+ it can be referenced by adding a single line and allows a JSON-LD document to
+ be expressed much more concisely as shown in the example below:{
+ "@context": "https://json-ld.org/contexts/person.jsonld",
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/",
+ "image": "http://manu.sporny.org/images/manu.png"
+}homepage and image property
+ can be interpreted as an IRI ("@type": "@id",
+ see section 3.2 IRIs for more details). This information allows developers
+ to re-use each other's data without having to agree to how their data will interoperate
+ on a site-by-site basis. External JSON-LD context documents may contain extra
+ information located outside of the @context key, such as
+ documentation about the terms declared in the
+ document. Information contained outside of the @context value
+ is ignored when the document is used as an external JSON-LD context document.{
+ "@context": {
+ "name": "http://schema.org/name",
+ "image": {
+ "@id": "http://schema.org/image",
+ "@type": "@id"
+ },
+ "homepage": {
+ "@id": "http://schema.org/url",
+ "@type": "@id"
+ }
+ },
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/",
+ "image": "http://manu.sporny.org/images/manu.png"
+}3.2 IRIs §
@type,
+ and values of properties with a term definition
+ that defines them as being relative to the vocabulary mapping,
+ may have the form of a relative IRI, but are resolved using the
+ vocabulary mapping, and not the base IRI.@id member:{
+ ...
+ "homepage": { "@id": "http://example.com/" }
+ ...
+}http://example.com/about/, the relative IRI
+ ../ would expand to http://example.com/ (for more
+ information on where relative IRIs can be
+ used, please refer to section 6. JSON-LD Grammar).{
+ ...
+ "homepage": { "@id": "../" }
+ ...
+}{
+ ...
+ "http://schema.org/name": "Manu Sporny",
+ ...
+}http://schema.org/name
+ is interpreted as an absolute IRI.{
+ "@context": {
+ "name": "http://schema.org/name"
+ },
+ "name": "Manu Sporny",
+ "status": "trollin'"
+}status
+ in the example above, are not Linked Data and thus ignored when processed.@context for
+ a particular term or property IRI, an IRI is generated:{
+ "@context": {
+ ...
+ "homepage": {
+ "@id": "http://schema.org/url",
+ "@type": "@id"
+ }
+ ...
+ },
+ ...
+ "homepage": "http://manu.sporny.org/"
+ ...
+}http://manu.sporny.org/
+ is expressed as a JSON string, the type coercion
+ rules will transform the value into an IRI when processing the data.
+ See section 4.6 Type Coercion for more
+ details about this feature.
+
+
+ @id or @type.@type key that is
+ set to a value of @id or @vocab.3.3 Node Identifiers §
@id
+ keyword:{
+ "@context": {
+ ...
+ "name": "http://schema.org/name"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ ...
+}http://me.markus-lanthaler.com/.3.4 Specifying the Type §
@type
+ keyword. In Linked Data, types are uniquely
+ identified with an IRI.{
+ ...
+ "@id": "http://example.org/places#BrewEats",
+ "@type": "http://schema.org/Restaurant",
+ ...
+}{
+ ...
+ "@id": "http://example.org/places#BrewEats",
+ "@type": [ "http://schema.org/Restaurant", "http://schema.org/Brewery" ],
+ ...
+}@type key may also be a term defined in the active context:{
+ "@context": {
+ ...
+ "Restaurant": "http://schema.org/Restaurant",
+ "Brewery": "http://schema.org/Brewery"
+ },
+ "@id": "http://example.org/places#BrewEats",
+ "@type": [ "Restaurant", "Brewery" ],
+ ...
+}@type
+ keyword is not only used to specify the type of a
+ node but also to express typed values
+ (as described in section 4.5 Typed Values) and to
+ type coerce values (as described in
+ section 4.6 Type Coercion). Specifically, @type
+ cannot be used in a context to define a node's
+ type. For a detailed description of the differences, please refer to
+ section 4.5 Typed Values.4. Advanced Concepts §
+
+4.1 JSON-LD 1.1 Processing Mode §
json-ld-1.1.
+ This may be set using the @version member in a context
+ set to the value 1.1 as a number, or through an API option.{
+ "@context": {
+ "@version": 1.1,
+ ...
+ },
+ ...
+}context encountered when processing a
+ document which contains @version determines the processing mode,
+ unless it is defined explicitly through an API option.4.2 Base IRI §
@base keyword.http://example.com/document.jsonld,
+ relative IRIs would resolve against that IRI:{
+ "@context": {
+ "label": "http://www.w3.org/2000/01/rdf-schema#label"
+ },
+ "@id": "",
+ "label": "Just a simple document"
+}@id, which resolves to the document base.
+ However, if the document is moved to a different location, the IRI would change.
+ To prevent this without having to use an absolute IRI, a context
+ may define an @base mapping, to overwrite the base IRI for the document.{
+ "@context": {
+ "@base": "http://example.com/document.jsonld",
+ "label": "http://www.w3.org/2000/01/rdf-schema#label"
+ },
+ "@id": "",
+ "label": "Just a simple document"
+}@base to null will prevent
+ relative IRIs to be expanded to
+ absolute IRIs.@base will be ignored if used in
+ external contexts.4.3 Default Vocabulary §
@vocab keyword allows an author to set a common prefix which
+ is used as the vocabulary mapping and is used
+ for all properties and types that do not match a term and are neither
+ a compact IRI nor an absolute IRI (i.e., they do
+ not contain a colon).{
+ "@context": {
+ "@vocab": "http://schema.org/"
+ },
+ "@id": "http://example.org/places#BrewEats",
+ "@type": "Restaurant",
+ "name": "Brew Eats"
+ ...
+}@vocab is used but certain keys in an
+ object should not be expanded using
+ the vocabulary IRI, a term can be explicitly set
+ to null in the context. For instance, in the
+ example below the databaseId member would not expand to an
+ IRI causing the property to be dropped when expanding.{
+ "@context": {
+ "@vocab": "http://schema.org/",
+ "databaseId": null
+ },
+ "@id": "http://example.org/places#BrewEats",
+ "@type": "Restaurant",
+ "name": "Brew Eats",
+ "databaseId": "23987520"
+}4.3.1 Using the Document Base as the Default Vocabulary §
+ json-ld-1.1, the vocabulary mapping in the active
+ context can be set to the empty string "", which causes terms which
+ are expanded relative to the vocabulary, such as the keys of node
+ objects, to use the base IRI to create absolute
+ IRIs.{
+ "@context": {
+ "@base": "http://example/document",
+ "@vocab": ""
+ },
+ "@id": "http://example.org/places#BrewEats",
+ "@type": "#Restaurant",
+ "#name": "Brew Eats"
+ ...
+}http://example/document, it would expand as follows:[{
+ "@id": "http://example.org/places#BrewEats",
+ "@type": ["http://example/document#Restaurant"],
+ "http://example/document#name": [{"@value": "Brew Eats"}]
+}]4.4 Compact IRIs §
:).
+ The prefix is a term taken from the
+ active context and is a short string identifying a
+ particular IRI in a JSON-LD document. For example, the
+ prefix foaf may be used as a short hand for the
+ Friend-of-a-Friend vocabulary, which is identified using the IRI
+ http://xmlns.com/foaf/0.1/. A developer may append
+ any of the FOAF vocabulary terms to the end of the prefix to specify a short-hand
+ version of the absolute IRI for the vocabulary term. For example,
+ foaf:name would be expanded to the IRI
+ http://xmlns.com/foaf/0.1/name.{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ ...
+ },
+ "@type": "foaf:Person",
+ "foaf:name": "Dave Longley",
+ ...
+}foaf:name expands to the IRI
+ http://xmlns.com/foaf/0.1/name and foaf:Person expands
+ to http://xmlns.com/foaf/0.1/Person.prefix:suffix
+ combination, the prefix matches a term defined within the
+ active context, and the suffix does not begin with two
+ slashes (//). The compact IRI is expanded by
+ concatenating the IRI mapped to the prefix to the (possibly empty)
+ suffix. If the prefix is not defined in the active context,
+ or the suffix begins with two slashes (such as in http://example.com),
+ the value is interpreted as absolute IRI instead. If the prefix is an
+ underscore (_), the value is interpreted as blank node identifier
+ instead.{
+ "@context": {
+ "@version": 1.1,
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "foaf": "http://xmlns.com/foaf/0.1/",
+ "foaf:homepage": { "@type": "@id" },
+ "picture": { "@id": "foaf:depiction", "@type": "@id" }
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "@type": "foaf:Person",
+ "foaf:name": "Markus Lanthaler",
+ "foaf:homepage": "http://www.markus-lanthaler.com/",
+ "picture": "http://twitter.com/account/profile_image/markuslanthaler"
+}/,
+ # and others, see [RFC3986]).
+ The previous specification allows any term to be chosen as
+ a compact IRI prefix, which led to a poor experience.@prefix member with the value true.json-ld-1.1, terms will be used as compact IRI prefixes
+ when compacting only if their expanded term definition contains
+ a @prefix member with the value true, or if it has a
+ a simple term definition where the value ends with a URI gen-delim character
+ (e.g, /, # and others, see [RFC3986]).{
+ "@context": {
+ "compact-iris": {"@id": "http://example.com/compact-iris-", "@prefix": true},
+ "property": "http://example.com/property"
+ },
+ "property": {
+ "@id": "compact-iris:are-considered",
+ "property": "@prefix does not require a gen-delim"
+ }
+}@id does not end in a
+ gen-delim character. Adding
+ "@prefix": true allows it to be used as the prefix portion of
+ the compact IRI compact-iris:are-considered.4.5 Typed Values §
+
+
+@type keyword when defining
+ a term within an @context section.@type keyword to associate a
+type with a particular term in the @context:{
+ "@context": {
+ "modified": {
+ "@id": "http://purl.org/dc/terms/modified",
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+ }
+ },
+ ...
+ "@id": "http://example.com/docs/1",
+ "modified": "2010-05-29T14:17:39+02:00",
+ ...
+}@context. A JSON-LD processor will interpret the example above
+ as follows:
+
+
+
+
+
+Subject
+ Property
+ Value
+ Value Type
+
+
+
+http://example.com/docs/1
+ http://purl.org/dc/terms/modified
+ 2010-05-29T14:17:39+02:00
+ xsd:dateTime
+{
+ "@context": {
+ "modified": {
+ "@id": "http://purl.org/dc/terms/modified"
+ }
+ },
+ ...
+ "modified": {
+ "@value": "2010-05-29T14:17:39+02:00",
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+ }
+ ...
+}2010-05-29T14:17:39+02:00 with the type
+ http://www.w3.org/2001/XMLSchema#dateTime. Note that it is
+ also possible to use a term or a compact IRI to
+ express the value of a type.@type keyword is also used to associate a type
+ with a node. The concept of a node type and
+ a value type are different.{
+ ...
+ "@id": "http://example.org/posts#TripToWestVirginia",
+ "@type": "http://schema.org/BlogPosting", ← This is a node type
+ "modified": {
+ "@value": "2010-05-29T14:17:39+02:00",
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime" ← This is a value type
+ }
+ ...
+}@type associates a node type
+ (http://schema.org/BlogPosting) with the node,
+ which is expressed using the @id keyword.
+ The second use of @type associates a value type
+ (http://www.w3.org/2001/XMLSchema#dateTime) with the
+ value expressed using the @value keyword. As a
+ general rule, when @value and @type are used in
+ the same JSON object, the @type
+ keyword is expressing a value type.
+ Otherwise, the @type keyword is expressing a
+ node type. The example above expresses the following data:
+
+
+
+
+
+Subject
+ Property
+ Value
+ Value Type
+
+
+http://example.org/posts#TripToWestVirginia
+ rdf:type
+ schema:BlogPosting
+ -
+
+
+
+http://example.org/posts#TripToWestVirginia
+ dc:modified
+ 2010-05-29T14:17:39+02:00
+ xsd:dateTime
+4.6 Type Coercion §
@type key. The value of this key expands to an IRI.
+ Alternatively, the keyword @id or @vocab may be used
+ as value to indicate that within the body of a JSON-LD document, a string value of a
+ term coerced to @id or @vocab is to be interpreted as an
+ IRI. The difference between @id and @vocab is how values are expanded
+ to absolute IRIs. @vocab first tries to expand the value
+ by interpreting it as term. If no matching term is found in the
+ active context, it tries to expand it as compact IRI or absolute IRI
+ if there's a colon in the value; otherwise, it will expand the value using the
+ active context's vocabulary mapping, if present.
+ Values coerced to @id in contrast are expanded as
+ compact IRI or absolute IRI if a colon is present; otherwise, they are interpreted
+ as relative IRI.@type key may be defined within the same context. This means that one may specify a
+ term like xsd and then use xsd:integer within the same
+ context definition.{
+ "@context": {
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "age": {
+ "@id": "http://xmlns.com/foaf/0.1/age",
+ "@type": "xsd:integer"
+ },
+ "homepage": {
+ "@id": "http://xmlns.com/foaf/0.1/homepage",
+ "@type": "@id"
+ }
+ },
+ "@id": "http://example.com/people#john",
+ "name": "John Smith",
+ "age": "41",
+ "homepage": [
+ "http://personal.example.org/",
+ "http://work.example.com/jsmith/"
+ ]
+}
+
+
+
+
+
+Subject
+ Property
+ Value
+ Value Type
+
+
+http://example.com/people#john
+ foaf:name
+ John Smith
+
+
+
+http://example.com/people#john
+ foaf:age
+ 41
+ xsd:integer
+
+
+http://example.com/people#john
+ foaf:homepage
+ http://personal.example.org/
+ IRI
+
+
+
+http://work.example.com/jsmith/
+ IRI
+{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/",
+ "foaf:age": {
+ "@id": "http://xmlns.com/foaf/0.1/age",
+ "@type": "xsd:integer"
+ },
+ "http://xmlns.com/foaf/0.1/homepage": {
+ "@type": "@id"
+ }
+ },
+ "foaf:name": "John Smith",
+ "foaf:age": "41",
+ "http://xmlns.com/foaf/0.1/homepage": [
+ "http://personal.example.org/",
+ "http://work.example.com/jsmith/"
+ ]
+}@id definition in the term definition is optional.
+ If it does exist, the compact IRI or IRI representing
+ the term will always be expanded to IRI defined by the @id
+ key—regardless of whether a prefix is defined or not.foaf:age
+ in the active context and not for the corresponding, expanded
+ IRI http://xmlns.com/foaf/0.1/age.dog and cat both expanded to http://example.com/vocab#animal.
+ Doing this could be useful for establishing different type coercion or language specification rules. It also allows a compact IRI (or even an
+ absolute IRI) to be defined as something else entirely. For example, one could specify that
+ the term http://example.org/zoo should expand to
+ http://example.org/river, but this usage is discouraged because it would lead to a
+ great deal of confusion among developers attempting to understand the JSON-LD document.4.7 Embedding §
[{
+ "@context": {
+ "@vocab": "http://schema.org/",
+ "knows": {"@type": "@id"}
+ },
+ "name": "Manu Sporny",
+ "@type": "Person",
+ "knows": "http://foaf.me/gkellogg#me"
+}, {
+ "@id": "http://foaf.me/gkellogg#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg"
+}]knows property defined to treat string values as identifiers.
+ Embedding allows the node object for Gregg to be embedded as a value
+ of the knows property:{
+ "@context": {
+ "@vocab": "http://schema.org/"
+ },
+ "name": "Manu Sporny",
+ "knows": {
+ "@id": "http://foaf.me/gkellogg#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg"
+ }
+}knows property
+ is not required, as the value is not a string.4.8 Advanced Context Usage §
[
+ {
+ "@context": "http://example.org/contexts/person.jsonld",
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/",
+ "depiction": "http://twitter.com/account/profile_image/manusporny"
+ },
+ {
+ "@context": "http://example.org/contexts/place.jsonld",
+ "name": "The Empire State Building",
+ "description": "The Empire State Building is a 102-story landmark in New York City.",
+ "geo": {
+ "latitude": "40.75",
+ "longitude": "73.98"
+ }
+ }
+]{
+ "@context": {
+ "name": "http://example.com/person#name",
+ "details": "http://example.com/person#details"
+ },
+ "name": "Markus Lanthaler",
+ ...
+ "details": {
+ "@context": {
+ "name": "http://example.com/organization#name"
+ },
+ "name": "Graz University of Technology"
+ }
+}name term is overridden
+ in the more deeply nested details structure. Note that this is
+ rarely a good authoring practice and is typically used when working with
+ legacy applications that depend on a specific structure of the
+ JSON object. If a term is redefined within a
+ context, all previous rules associated with the previous definition are
+ removed. If a term is redefined to null,
+ the term is effectively removed from the list of
+ terms defined in the active context.null effectively resets the active context
+ to an empty context. The following example specifies an external context
+ and then layers an embedded context on top of the external context:{
+ "@context": [
+ "https://json-ld.org/contexts/person.jsonld",
+ {
+ "pic": "http://xmlns.com/foaf/0.1/depiction"
+ }
+ ],
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/",
+ "pic": "http://twitter.com/account/profile_image/manusporny"
+}@ character are to be avoided as they
+ might be used as keyword in future versions
+ of JSON-LD. Terms starting with an @ character that are not
+ JSON-LD 1.1 keywords are treated as any other term, i.e.,
+ they are ignored unless mapped to an IRI. Furthermore, the use of
+ empty terms ("") is not allowed as
+ not all programming languages are able to handle empty JSON keys.4.9 Interpreting JSON as JSON-LD §
+
+ application/json
+ media type or a media type with a +json suffix as defined in
+ [RFC6839].
+
+
+ rel="http://www.w3.org/ns/json-ld#context", andtype="application/ld+json".@context subtree within that object is added to the top-level
+ JSON object of the referencing document. If an array
+ is at the top-level of the referencing document and its items are
+ JSON objects, the @context
+ subtree is added to all array items. All extra information located outside
+ of the @context subtree in the referenced document MUST be
+ discarded. Effectively this means that the active context is
+ initialized with the referenced external context. A response MUST NOT
+ contain more than one HTTP Link Header [RFC5988] using the
+ http://www.w3.org/ns/json-ld#context link relation.GET /ordinary-json-document.json HTTP/1.1
+Host: example.com
+Accept: application/ld+json,application/json,*/*;q=0.1
+
+====================================
+
+HTTP/1.1 200 OK
+...
+Content-Type: application/json
+Link: <https://json-ld.org/contexts/person.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
+
+{
+ "name": "Markus Lanthaler",
+ "homepage": "http://www.markus-lanthaler.com/",
+ "image": "http://twitter.com/account/profile_image/markuslanthaler"
+}
application/ld+json
+ media type MUST have all context information, including references to external
+ contexts, within the body of the document. Contexts linked via a
+ http://www.w3.org/ns/json-ld#context HTTP Link Header MUST be
+ ignored for such documents.4.10 String Internationalization §
@language key in the context:{
+ "@context": {
+ ...
+ "@language": "ja"
+ },
+ "name": "花澄",
+ "occupation": "科学者"
+}ja language
+ code with the two strings 花澄 and 科学者.
+ Languages codes are defined in [BCP47]. The default language applies to all
+ string values that are not type coerced.@language can
+ be set to null in a local context as follows:{
+ "@context": {
+ ...
+ "@language": "ja"
+ },
+ "name": "花澄",
+ "details": {
+ "@context": {
+ "@language": null
+ },
+ "occupation": "Ninja"
+ }
+}{
+ "@context": {
+ ...
+ "ex": "http://example.com/vocab/",
+ "@language": "ja",
+ "name": { "@id": "ex:name", "@language": null },
+ "occupation": { "@id": "ex:occupation" },
+ "occupation_en": { "@id": "ex:occupation", "@language": "en" },
+ "occupation_cs": { "@id": "ex:occupation", "@language": "cs" }
+ },
+ "name": "Yagyū Muneyoshi",
+ "occupation": "忍者",
+ "occupation_en": "Ninja",
+ "occupation_cs": "Nindža",
+ ...
+}ja, Ninja with the language code
+ en, and Nindža with the language code cs.
+ The value of name, Yagyū Muneyoshi wouldn't be
+ associated with any language code since @language was reset to
+ null in the expanded term definition.{
+ "@context": {
+ ...
+ "occupation": { "@id": "ex:occupation", "@container": "@language" }
+ },
+ "name": "Yagyū Muneyoshi",
+ "occupation": {
+ "ja": "忍者",
+ "en": "Ninja",
+ "cs": "Nindža"
+ }
+ ...
+}property.language pattern. For example, to access the occupation
+ in English, a developer would use the following code snippet:
+ obj.occupation.en.{
+ "@context": {
+ ...
+ "@language": "ja"
+ },
+ "name": "花澄",
+ "occupation": {
+ "@value": "Scientist",
+ "@language": "en"
+ }
+}@language tag or setting it to null when expressing
+ it using a value object:{
+ "@context": {
+ ...
+ "@language": "ja"
+ },
+ "name": {
+ "@value": "Frank"
+ },
+ "occupation": {
+ "@value": "Ninja",
+ "@language": "en"
+ },
+ "speciality": "手裏剣"
+}4.11 IRI Expansion within a Context §
xsd namespace when defining typed values:{
+ "@context": {
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "age": {
+ "@id": "http://xmlns.com/foaf/0.1/age",
+ "@type": "xsd:integer"
+ },
+ "homepage": {
+ "@id": "http://xmlns.com/foaf/0.1/homepage",
+ "@type": "@id"
+ }
+ },
+ ...
+}xsd term is defined
+ and used as a prefix for the @type coercion
+ of the age property.{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/",
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "name": "foaf:name",
+ "age": {
+ "@id": "foaf:age",
+ "@type": "xsd:integer"
+ },
+ "homepage": {
+ "@id": "foaf:homepage",
+ "@type": "@id"
+ }
+ },
+ ...
+}{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/",
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "name": "foaf:name",
+ "foaf:age": {
+ "@type": "xsd:integer"
+ },
+ "foaf:homepage": {
+ "@type": "@id"
+ }
+ },
+ ...
+}foaf:age declares both the
+IRI for the term (using short-form) as well as the
+@type associated with the term. In the second
+approach, only the @type associated with the term is
+specified. The full IRI for
+foaf:homepage is determined by looking up the foaf
+prefix in the
+context.
+{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/",
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
+ "name": "foaf:name",
+ "foaf:age": {
+ "@id": "foaf:age",
+ "@type": "xsd:integer"
+ },
+ "http://xmlns.com/foaf/0.1/homepage": {
+ "@type": "@id"
+ }
+ },
+ ...
+}foaf:homepage
+ will not use the { "@type": "@id" } declaration because
+ foaf:homepage is not the same as http://xmlns.com/foaf/0.1/homepage.
+ That is, terms are looked up in a context using
+ direct string comparison before the prefix lookup mechanism is applied.foaf:name expanding to
+ http://example.org/unrelated#species), such usage is strongly
+ discouraged.{
+ "@context": {
+ "term1": "term2:foo",
+ "term2": "term1:bar"
+ },
+ ...
+}4.12 Sets and Lists §
{
+ ...
+ "@id": "http://example.org/people#joebob",
+ "foaf:nick": [ "joe", "bob", "JB" ],
+ ...
+}
+
+
+
+
+
+Subject
+ Property
+ Value
+
+
+http://example.org/people#joebob
+ foaf:nick
+ joe
+
+
+http://example.org/people#joebob
+ foaf:nick
+ bob
+
+
+
+http://example.org/people#joebob
+ foaf:nick
+ JB
+{
+ "@id": "http://example.org/articles/8",
+ "dc:title": [
+ {
+ "@value": "Das Kapital",
+ "@language": "de"
+ },
+ {
+ "@value": "Capital",
+ "@language": "en"
+ }
+ ]
+}
+
+
+
+
+
+Subject
+ Property
+ Value
+ Language
+
+
+http://example.org/articles/8
+ dc:title
+ Das Kapital
+ de
+
+
+
+http://example.org/articles/8
+ dc:title
+ Capital
+ en
+{
+ "@id": "http://example.org/people#michael",
+ "dc:name": [
+ "Michael",
+ {"@value": "Mike"},
+ {"@value": "Miguel", "@language": "es"},
+ { "@id": "https://www.wikidata.org/wiki/Q4927524" },
+ 42
+ ]
+}
+
+
+
+
+
+Subject
+ Property
+ Value
+ Language
+ Value Type
+
+
+http://example.org/people#michael
+ dc:name
+ Michael
+
+
+
+
+http://example.org/people#michael
+ dc:name
+ Mike
+
+
+
+
+http://example.org/people#michael
+ dc:name
+ Miguel
+ es
+
+
+
+http://example.org/people#michael
+ dc:name
+ https://www.wikidata.org/wiki/Q4927524
+
+
+
+
+
+http://example.org/people#michael
+ dc:name
+ 42
+
+ xsd:integer
+@list keyword as follows:{
+ ...
+ "@id": "http://example.org/people#joebob",
+ "foaf:nick": {
+ "@list": [ "joe", "bob", "jaybee" ]
+ },
+ ...
+}@container
+ to @list in the context:{
+ "@context": {
+ ...
+ "nick": {
+ "@id": "http://xmlns.com/foaf/0.1/nick",
+ "@container": "@list"
+ }
+ },
+ ...
+ "@id": "http://example.org/people#joebob",
+ "nick": [ "joe", "bob", "jaybee" ],
+ ...
+}@list is used to describe ordered lists,
+ the @set keyword is used to describe unordered sets.
+ The use of @set in the body of a JSON-LD document
+ is optimized away when processing the document, as it is just syntactic
+ sugar. However, @set is helpful when used within the context
+ of a document.
+ Values of terms associated with an @set or @list container
+ are always represented in the form of an array,
+ even if there is just a single value that would otherwise be optimized to
+ a non-array form in compact form (see
+ section 4.26 Compacted Document Form). This makes post-processing of
+ JSON-LD documents easier as the data is always in array form, even if the
+ array only contains a single value.4.13 Reverse Properties §
[
+ {
+ "@id": "#homer",
+ "http://example.com/vocab#name": "Homer"
+ }, {
+ "@id": "#bart",
+ "http://example.com/vocab#name": "Bart",
+ "http://example.com/vocab#parent": { "@id": "#homer" }
+ }, {
+ "@id": "#lisa",
+ "http://example.com/vocab#name": "Lisa",
+ "http://example.com/vocab#parent": { "@id": "#homer" }
+ }
+]@reverse
+ keyword:{
+ "@id": "#homer",
+ "http://example.com/vocab#name": "Homer",
+ "@reverse": {
+ "http://example.com/vocab#parent": [
+ {
+ "@id": "#bart",
+ "http://example.com/vocab#name": "Bart"
+ }, {
+ "@id": "#lisa",
+ "http://example.com/vocab#name": "Lisa"
+ }
+ ]
+ }
+}@reverse keyword can also be used in
+ expanded term definitions
+ to create reverse properties as shown in the following example:{
+ "@context": { "name": "http://example.com/vocab#name",
+ "children": { "@reverse": "http://example.com/vocab#parent" }
+ },
+ "@id": "#homer",
+ "name": "Homer",
+ "children": [
+ {
+ "@id": "#bart",
+ "name": "Bart"
+ }, {
+ "@id": "#lisa",
+ "name": "Lisa"
+ }
+ ]
+}4.14 Scoped Contexts §
@context
+ property, which defines a context (an embedded context) for values of properties defined using that term. This allows
+ values to use term definitions, base IRI,
+ vocabulary mapping or default language which is different from the
+ node object they are contained in, as if the
+ context was specified within the value itself.{
+ "@context": {
+ "@version": 1.1,
+ "name": "http://schema.org/name",
+ "interest": {
+ "@id": "http://xmlns.com/foaf/0.1/interest",
+ "@context": {"@vocab": "http://xmlns.com/foaf/0.1/"}
+ }
+ },
+ "name": "Manu Sporny",
+ "interest": {
+ "@id": "https://www.w3.org/TR/json-ld/",
+ "name": "JSON-LD",
+ "topic": "Linking Data"
+ }
+}[{
+ "http://schema.org/name": [{"@value": "Manu Sporny"}],
+ "http://xmlns.com/foaf/0.1/interest": [{
+ "@id": "https://www.w3.org/TR/json-ld/",
+ "http://schema.org/name": [{"@value": "JSON-LD"}],
+ "http://xmlns.com/foaf/0.1/topic": [{"@value": "Linking Data"}]
+ }]
+}]@type:{
+ "@context": {
+ "@version": 1.1,
+ "name": "http://schema.org/name",
+ "interest": "http://xmlns.com/foaf/0.1/interest",
+ "Document": {
+ "@id": "http://xmlns.com/foaf/0.1/Document",
+ "@context": {"@vocab": "http://xmlns.com/foaf/0.1/"}
+ }
+ },
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "interest": {
+ "@id": "https://www.w3.org/TR/json-ld/",
+ "@type": "Document",
+ "name": "JSON-LD",
+ "topic": "Linking Data"
+ }
+}@type is useful when common properties are used to
+ relate things of different types, where the vocabularies in use within
+ different entities calls for different context scoping. For example,
+ hasPart/partOf may be common terms used in a document, but mean
+ different things depending on the context.@type is considered
+ (ordering them lexographically) where that value is also a term in
+ the active context having its own embedded context. If so, that
+ embedded context is applied to the active context. When compacting, if
+ a term is chosen to represent an IRI used as a value of @type where that
+ term definition also has an embedded context, it is then applied to the
+ active context to affect further compaction.@type are unordered, so if multiple
+ types are listed, the order that scoped contexts are applied is based on
+ lexicographical ordering.json-ld-1.1.4.15 Named Graphs §
@graph
+ keyword. A developer may also name data expressed using the
+ @graph keyword by pairing it with an
+ @id keyword as shown in the following example:{
+ "@context": {
+ "generatedAt": {
+ "@id": "http://www.w3.org/ns/prov#generatedAtTime",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ },
+ "Person": "http://xmlns.com/foaf/0.1/Person",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "_:graph",
+ "generatedAt": "2012-04-09",
+ "@graph": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ }, {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+ ]
+}_:graph. That
+ graph is composed of the statements about Manu and Gregg. Metadata about
+ the graph itself is expressed via the generatedAt property,
+ which specifies when the graph was generated. An alternative view of the
+ information above is represented in table form below:
+
+
+
+
+
+ Graph
+ Subject
+ Property
+ Value
+ Value Type
+
+
+
+ _:graph
+ prov:generatedAtTime
+ 2012-04-09
+ xsd:date
+
+
+ _:graph
+ http://manu.sporny.org/about#manu
+ xsd:type
+ foaf:Person
+
+
+
+ _:graph
+ http://manu.sporny.org/about#manu
+ foaf:name
+ Manu Sporny
+
+
+
+ _:graph
+ http://manu.sporny.org/about#manu
+ foaf:knows
+ http://greggkellogg.net/foaf#me
+
+
+
+ _:graph
+ http://greggkellogg.net/foaf#me
+ xsd:type
+ foaf:Person
+
+
+
+ _:graph
+ http://greggkellogg.net/foaf#me
+ foaf:name
+ Gregg Kellogg
+
+
+
+
+ _:graph
+ http://greggkellogg.net/foaf#me
+ foaf:knows
+ http://manu.sporny.org/about#manu
+
+ @graph and
+ optionally @context (properties that are not mapped to an
+ IRI or a keyword are ignored),
+ @graph is considered to express the otherwise implicit
+ default graph. This mechanism can be useful when a number
+ of nodes exist at the document's top level that
+ share the same context, which is, e.g., the case when a
+ document is flattened. The
+ @graph keyword collects such nodes in an array
+ and allows the use of a shared context.{
+ "@context": {...},
+ "@graph": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "foaf:Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ }, {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "foaf:Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+ ]
+}@context within each node object:[
+ {
+ "@context": {...},
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "foaf:Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ },
+ {
+ "@context": {...},
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "foaf:Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+]4.15.1 Graph Containers §
+ @graph keyword.@graph as the
+ value of @container. This indicates that values of this
+ term should be considered to be named graphs, where the
+ graph name is an automatically assigned blank node identifier
+ creating an implicitly named graph. When expanded, these become
+ simple graph objects.{
+ "@context": {
+ "@version": 1.1,
+ "generatedAt": {
+ "@id": "http://www.w3.org/ns/prov#generatedAtTime",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ },
+ "Person": "http://xmlns.com/foaf/0.1/Person",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows",
+ "claim": {
+ "@id": "https://w3id.org/credentials#claim",
+ "@container": "@graph"
+ }
+ },
+ "generatedAt": "2012-04-09",
+ "claim": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ }, {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+ ]
+}_:claim. That
+ graph is composed of the statements about Manu and Gregg. Metadata about
+ the graph itself is expressed via the generatedAt property,
+ which specifies when the graph was generated. An alternative view of the
+ information above is represented in table form below:
+
+
+
+
+
+ Graph
+ Subject
+ Property
+ Value
+ Value Type
+
+
+
+ _:metadata
+ prov:generatedAtTime
+ 2012-04-09
+ xsd:date
+
+
+
+ _:metadata
+ cred:claim
+ _:claim
+
+
+
+ _:claim
+ http://manu.sporny.org/about#manu
+ xsd:type
+ foaf:Person
+
+
+
+ _:claim
+ http://manu.sporny.org/about#manu
+ foaf:name
+ Manu Sporny
+
+
+
+ _:claim
+ http://manu.sporny.org/about#manu
+ foaf:knows
+ http://greggkellogg.net/foaf#me
+
+
+
+ _:claim
+ http://greggkellogg.net/foaf#me
+ xsd:type
+ foaf:Person
+
+
+
+ _:claim
+ http://greggkellogg.net/foaf#me
+ foaf:name
+ Gregg Kellogg
+
+
+
+
+ _:claim
+ http://greggkellogg.net/foaf#me
+ foaf:knows
+ http://manu.sporny.org/about#manu
+
+ [{
+ "http://www.w3.org/ns/prov#generatedAtTime": [{
+ "@value": "2012-04-09",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ }],
+ "https://w3id.org/credentials#claim": [{
+ "@graph": [{
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/knows": [{
+ "@value": "http://greggkellogg.net/foaf#me"
+ }],
+ "http://xmlns.com/foaf/0.1/name": [{
+ "@value": "Manu Sporny"
+ }]
+ }, {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/knows": [{
+ "@value": "http://manu.sporny.org/about#manu"
+ }],
+ "http://xmlns.com/foaf/0.1/name": [{
+ "@value": "Gregg Kellogg"
+ }]
+ }]
+ }]
+}]json-ld-1.1.4.16 Identifying Blank Nodes §
@id. However, some graph topologies
+ may require identifiers to be serializable. Graphs containing loops, e.g., cannot
+ be serialized using embedding alone, @id must be used to connect the nodes.
+ In these situations, one can use blank node identifiers,
+ which look like IRIs using an underscore (_)
+ as scheme. This allows one to reference the node locally within the document, but
+ makes it impossible to reference the node from an external document. The
+ blank node identifier is scoped to the document in which it is used.{
+ ...
+ "@id": "_:n1",
+ "name": "Secret Agent 1",
+ "knows": {
+ "name": "Secret Agent 2",
+ "knows": { "@id": "_:n1" }
+ }
+}4.17 Aliasing Keywords §
@context, may be aliased to application-specific
+ keywords. This feature allows legacy JSON content to be utilized
+ by JSON-LD by re-using JSON keys that already exist in legacy documents.
+ This feature also allows developers to design domain-specific implementations
+ using only the JSON-LD context.{
+ "@context": {
+ "url": "@id",
+ "a": "@type",
+ "name": "http://xmlns.com/foaf/0.1/name"
+ },
+ "url": "http://example.com/about#gregg",
+ "a": "http://xmlns.com/foaf/0.1/Person",
+ "name": "Gregg Kellogg"
+}@id and @type
+ keywords have been given the aliases
+ url and a, respectively.4.18 Data Indexing §
@index keyword with a
+ @container declaration in the context:{
+ "@context": {
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": "@index"
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "en": {
+ "@id": "http://example.com/posts/1/en",
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "de": {
+ "@id": "http://example.com/posts/1/de",
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }
+ }
+}obj.post.de.
+
+
+
+
+
+ Subject
+ Property
+ Value
+
+
+ http://example.com/
+ rdf:type
+ schema:Blog
+
+
+ http://example.com/
+ schema:name
+ World Financial News
+
+
+ http://example.com/
+ schema:blogPost
+ http://example.com/posts/1/en
+
+
+ http://example.com/
+ schema:blogPost
+ http://example.com/posts/1/de
+
+
+ http://example.com/posts/1/en
+ schema:articleBody
+ World commodities were up today with heavy trading of crude oil...
+
+
+ http://example.com/posts/1/en
+ schema:wordCount
+ 1539
+
+
+ http://example.com/posts/1/de
+ schema:articleBody
+ Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...
+
+
+
+ http://example.com/posts/1/de
+ schema:wordCount
+ 1204
+ @container can also
+ be an array containing both @index and @set.
+ When compacting, this ensures that a JSON-LD Processor will use
+ the array form for all values of indexes.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": ["@index", "@set"]
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "en": [{
+ "@id": "http://example.com/posts/1/en",
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ }],
+ "de": [{
+ "@id": "http://example.com/posts/1/de",
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }]
+ }
+}json-ld-1.1,
+ the special index @none is used for indexing
+ data which does not have an associated index, which is useful to maintain
+ a normalized representation.{
+ "@context": {
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": "@index"
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "en": {
+ "@id": "http://example.com/posts/1/en",
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "de": {
+ "@id": "http://example.com/posts/1/de",
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ },
+ "@none": {
+ "body": "Unindexed description",
+ "words": 20
+ }
+ }
+}4.19 Named Graph Indexing §
+
+ @graph
+ container type, introduced in section 4.15.1 Graph Containers
+ in addition to @index, an object value of such a property is
+ treated as a key-value map where the keys do not map to IRIs, but
+ are taken from an @index property associated with named graphs
+ which are their values. When expanded, these must be simple graph objects{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": ["@graph", "@index"]
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "en": {
+ "@id": "http://example.com/posts/1/en",
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "de": {
+ "@id": "http://example.com/posts/1/de",
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }
+ }
+}[{
+ "@id": "http://example.com/",
+ "@type": ["http://schema.org/Blog"],
+ "http://schema.org/blogPost": [{
+ "@graph": [{
+ "@id": "http://example.com/posts/1/de",
+ "http://schema.org/articleBody": [{
+ "@value": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl..."
+ }],
+ "http://schema.org/wordCount": [{"@value": 1204}]
+ }],
+ "@index": "de"
+ }, {
+ "@graph": [{
+ "@id": "http://example.com/posts/1/en",
+ "http://schema.org/articleBody": [{
+ "@value": "World commodities were up today with heavy trading of crude oil..."
+ }],
+ "http://schema.org/wordCount": [{"@value": 1539}]
+ }],
+ "@index": "en"
+ }],
+ "http://schema.org/name": [{"@value": "World Financial News"}]
+}]
+
+
+
+
+
+ Graph
+ Subject
+ Property
+ Value
+ Value Type
+
+
+
+ http://example.com/
+ rdf:type
+ schema:Blog
+
+
+
+
+ http://example.com/
+ schema:name
+ World Financial News
+
+
+
+
+ http://example.com/
+ schema:blogPost
+ _:b1
+
+
+
+
+ http://example.com/
+ schema:blogPost
+ _:b2
+
+
+
+ _:b1
+ http://example.com/posts/1/de
+ schema:wordCount
+ 1204
+ xsd:integer
+
+
+ _:b1
+ http://example.com/posts/1/de
+ schema:articleBody
+ Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...
+
+
+
+ _:b2
+ http://example.com/posts/1/en
+ schema:wordCount
+ 1539
+ xsd:integer
+
+
+
+ _:b2
+ http://example.com/posts/1/en
+ schema:articleBody
+ World commodities were up today with heavy trading of crude oil...
+
+ @graph, a container may also
+ include @set to ensure that key values are always contained in an array.json-ld-1.1,
+ the special index @none is used for indexing
+ graphs which does not have an @index key, which is useful to maintain
+ a normalized representation. Note, however, that
+ compacting a document where multiple unidentified named graphs are
+ compacted using the @none index will result in the content
+ of those graphs being merged. To prevent this, give each graph a distinct
+ @index key.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": ["@graph", "@index"]
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "en": {
+ "@id": "http://example.com/posts/1/en",
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "@none": {
+ "@id": "http://example.com/posts/1/de",
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }
+ }
+}[{
+ "@id": "http://example.com/",
+ "@type": ["http://schema.org/Blog"],
+ "http://schema.org/blogPost": [{
+ "@graph": [{
+ "@id": "http://example.com/posts/1/de",
+ "http://schema.org/articleBody": [{
+ "@value": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl..."
+ }],
+ "http://schema.org/wordCount": [{"@value": 1204}]
+ }]
+ }, {
+ "@graph": [{
+ "@id": "http://example.com/posts/1/en",
+ "http://schema.org/articleBody": [{
+ "@value": "World commodities were up today with heavy trading of crude oil..."
+ }],
+ "http://schema.org/wordCount": [{"@value": 1539}]
+ }],
+ "@index": "en"
+ }],
+ "http://schema.org/name": [{"@value": "World Financial News"}]
+}]4.20 Language Indexing §
@language keyword with a
+ @container declaration in the context:{
+ "@context": {
+ "vocab": "http://example.com/vocab/",
+ "label": {
+ "@id": "vocab:label",
+ "@container": "@language"
+ }
+ },
+ "@id": "http://example.com/queen",
+ "label": {
+ "en": "The Queen",
+ "de": [ "Die Königin", "Ihre Majestät" ]
+ }
+}obj.label.de.@container can also
+ be an array containing both @language and @set.
+ When compacting, this ensures that a JSON-LD Processor will use
+ the array form for all values of language tags.{
+ "@context": {
+ "vocab": "http://example.com/vocab/",
+ "label": {
+ "@id": "vocab:label",
+ "@container": ["@language", "@set"]
+ }
+ },
+ "@id": "http://example.com/queen",
+ "label": {
+ "en": ["The Queen"],
+ "de": [ "Die Königin", "Ihre Majestät" ]
+ }
+}json-ld-1.1,
+ the special index @none is used for indexing
+ data which does not have a language, which is useful to maintain
+ a normalized representation.{
+ "@context": {
+ "vocab": "http://example.com/vocab/",
+ "label": {
+ "@id": "vocab:label",
+ "@container": "@language"
+ }
+ },
+ "@id": "http://example.com/queen",
+ "label": {
+ "en": "The Queen",
+ "de": [ "Die Königin", "Ihre Majestät" ],
+ "@none": "The Queen"
+ }
+}4.21 Node Identifier Indexing §
@id keyword with a
+ @container declaration in the context:{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": "@id"
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "http://example.com/posts/1/en": {
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "http://example.com/posts/1/de": {
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }
+ }
+}post term has
+ been marked as an id map. The http://example.com/posts/1/en and
+ http://example.com/posts/1/de keys will be interpreted
+ as the @id property of the node object value.@container can also
+ be an array containing both @id and @set.
+ When compacting, this ensures that a JSON-LD processor will use
+ the array form for all values of node identifiers.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": ["@id", "@set"]
+ }
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "http://example.com/posts/1/en": [{
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ }],
+ "http://example.com/posts/1/de": [{
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ }]
+ }
+}@none is used for indexing
+ node objects which do not have an @id, which is useful to maintain
+ a normalized representation. The @none index may also be
+ a term which expands to @none, such as the term none
+ used in the example below.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "body": "schema:articleBody",
+ "words": "schema:wordCount",
+ "post": {
+ "@id": "schema:blogPost",
+ "@container": "@id"
+ },
+ "none": "@none"
+ },
+ "@id": "http://example.com/",
+ "@type": "schema:Blog",
+ "name": "World Financial News",
+ "post": {
+ "http://example.com/posts/1/en": {
+ "body": "World commodities were up today with heavy trading of crude oil...",
+ "words": 1539
+ },
+ "http://example.com/posts/1/de": {
+ "body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
+ "words": 1204
+ },
+ "none": {
+ "body": "Description for object within an @id",
+ "words": 20
+ }
+ }
+}json-ld-1.1.4.22 Named Graph Indexing by Identifier §
+
+ @graph
+ container type, introduced in section 4.15.1 Graph Containers
+ in addition to @id, an object value of such a property is
+ treated as a key-value map where the keys represent the identifiers of named graphs
+ which are their values.{
+ "@context": {
+ "@version": 1.1,
+ "generatedAt": {
+ "@id": "http://www.w3.org/ns/prov#generatedAtTime",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ },
+ "Person": "http://xmlns.com/foaf/0.1/Person",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows",
+ "graphMap": {
+ "@id": "http://example.org/graphMap",
+ "@container": ["@graph", "@id"]
+ }
+ },
+ "@id": "_:graph",
+ "generatedAt": "2012-04-09",
+ "graphMap": {
+ "_:manu": {
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ },
+ "_:gregg": {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }
+ }
+}[{
+ "@id": "_:graph",
+ "http://example.org/graphMap": [{
+ "@id": "_:gregg",
+ "@graph": [{
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/knows": [{"@value": "http://manu.sporny.org/about#manu"}],
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}]
+ }]
+ }, {
+ "@id": "_:manu",
+ "@graph": [{
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": [
+ "http://xmlns.com/foaf/0.1/Person"
+ ],
+ "http://xmlns.com/foaf/0.1/knows": [
+ {
+ "@value": "http://greggkellogg.net/foaf#me"
+ }
+ ],
+ "http://xmlns.com/foaf/0.1/name": [
+ {
+ "@value": "Manu Sporny"
+ }
+ ]
+ }]
+ }],
+ "http://www.w3.org/ns/prov#generatedAtTime": [{
+ "@value": "2012-04-09",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ }]
+}]
+
+
+
+
+
+ Graph
+ Subject
+ Property
+ Value
+ Value Type
+
+
+
+ _:graph
+ prov:generatedAtTime
+ 2012-04-09
+ xsd:date
+
+
+
+ _:graph
+ http://example.org/graphMap
+ http://manu.sporny.org/about#manu
+
+
+
+
+ _:graph
+ http://example.org/graphMap
+ http://greggkellogg.net/foaf#me
+
+
+
+ _:manu
+ http://manu.sporny.org/about#manu
+ xsd:type
+ foaf:Person
+
+
+
+ _:manu
+ http://manu.sporny.org/about#manu
+ foaf:name
+ Manu Sporny
+
+
+
+ _:manu
+ http://manu.sporny.org/about#manu
+ foaf:knows
+ http://greggkellogg.net/foaf#me
+
+
+
+ _:gregg
+ http://greggkellogg.net/foaf#me
+ xsd:type
+ foaf:Person
+
+
+
+ _:gregg
+ http://greggkellogg.net/foaf#me
+ foaf:name
+ Gregg Kellogg
+
+
+
+
+ _:gregg
+ http://greggkellogg.net/foaf#me
+ foaf:knows
+ http://manu.sporny.org/about#manu
+
+ @graph, a container may also
+ include @set to ensure that key values are always contained in an array.@none is used for indexing
+ named graphs which do not have an @id, which is useful to maintain
+ a normalized representation. The @none index may also be
+ a term which expands to @none.
+ Note, however, that if multiple graphs are represented without
+ an @id, they will be merged on expansion. To prevent this,
+ use @none judiciously, and consider giving graphs
+ their own distinct identifier.{
+ "@context": {
+ "@version": 1.1,
+ "generatedAt": {
+ "@id": "http://www.w3.org/ns/prov#generatedAtTime",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ },
+ "Person": "http://xmlns.com/foaf/0.1/Person",
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows",
+ "graphMap": {
+ "@id": "http://example.org/graphMap",
+ "@container": ["@graph", "@id"]
+ }
+ },
+ "@id": "_:graph",
+ "generatedAt": "2012-04-09",
+ "graphMap": {
+ "@none": [{
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "Person",
+ "name": "Manu Sporny",
+ "knows": "http://greggkellogg.net/foaf#me"
+ }, {
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "Person",
+ "name": "Gregg Kellogg",
+ "knows": "http://manu.sporny.org/about#manu"
+ }]
+ }
+}json-ld-1.1.4.23 Node Type Indexing §
@type
+ of specific node objects.
+ In JSON-LD such data can be specified by associating the
+ @type keyword with a
+ @container declaration in the context:{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "affiliation": {
+ "@id": "schema:affiliation",
+ "@container": "@type"
+ }
+ },
+ "name": "Manu Sporny",
+ "affiliation": {
+ "schema:Corporation": {
+ "@id": "https://digitalbazaar.com/",
+ "name": "Digital Bazaar"
+ },
+ "schema:ProfessionalService": {
+ "@id": "https://spec-ops.io",
+ "name": "Spec-Ops"
+ }
+ }
+}affiliation term has
+ been marked as an type map. The schema:Corporation and
+ schema:ProfessionalService keys will be interpreted
+ as the @type property of the node object value.@container can also
+ be an array containing both @type and @set.
+ When compacting, this ensures that a JSON-LD processor will use
+ the array form for all values of types.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "affiliation": {
+ "@id": "schema:affiliation",
+ "@container": ["@type", "@set"]
+ }
+ },
+ "name": "Manu Sporny",
+ "affiliation": {
+ "schema:Corporation": [{
+ "@id": "https://digitalbazaar.com/",
+ "name": "Digital Bazaar"
+ }],
+ "schema:ProfessionalService": [{
+ "@id": "https://spec-ops.io",
+ "name": "Spec-Ops"
+ }]
+ }
+}@none is used for indexing
+ node objects which do not have an @type, which is useful to maintain
+ a normalized representation. The @none index may also be
+ a term which expands to @none, such as the term none
+ used in the example below.{
+ "@context": {
+ "@version": 1.1,
+ "schema": "http://schema.org/",
+ "name": "schema:name",
+ "affiliation": {
+ "@id": "schema:affiliation",
+ "@container": "@type"
+ },
+ "none": "@none"
+ },
+ "name": "Manu Sporny",
+ "affiliation": {
+ "schema:Corporation": {
+ "@id": "https://digitalbazaar.com/",
+ "name": "Digital Bazaar"
+ },
+ "schema:ProfessionalService": {
+ "@id": "https://spec-ops.io",
+ "name": "Spec-Ops"
+ },
+ "none": {
+ "@id": "http://greggkellogg.net/",
+ "name": "Gregg Kellogg"
+ }
+ }
+}@type, a container may also
+ include @set to ensure that key values are always contained in an array.json-ld-1.1.4.24 Nested Properties §
{
+ "@context": {
+ "@version": 1.1,
+ "skos": "http://www.w3.org/2004/02/skos/core#",
+ "labels": "@nest",
+ "main_label": {"@id": "skos:prefLabel"},
+ "other_label": {"@id": "skos:altLabel"},
+ "homepage": {"@id": "http://schema.org/description", "@type": "@id"}
+ },
+ "@id": "http://example.org/myresource",
+ "homepage": "http://example.org",
+ "labels": {
+ "main_label": "This is the main label for my resource",
+ "other_label": "This is the other label"
+ }
+}@nest,
+ a JSON-LD processor will ignore the nesting created by using the
+ labels property and process the contents as if it were declared
+ directly within containing object. In this case, the labels
+ property is semantically meaningless. Defining it as equivalent to
+ @nest causes it to be ignored when expanding, making it
+ equivalent to the following:{
+ "@context": {
+ "skos": "http://www.w3.org/2004/02/skos/core#",
+ "main_label": {"@id": "skos:prefLabel"},
+ "other_label": {"@id": "skos:altLabel"},
+ "homepage": {"@id": "http://schema.org/description", "@type": "@id"}
+ },
+ "@id": "http://example.org/myresource",
+ "homepage": "http://example.org",
+ "main_label": "This is the main label for my resource",
+ "other_label": "This is the other label"
+}@nest property to
+ reference a term aliased to @nest which causes such
+ values to be nested under that aliased term.{
+ "@context": {
+ "@version": 1.1,
+ "skos": "http://www.w3.org/2004/02/skos/core#",
+ "labels": "@nest",
+ "main_label": {"@id": "skos:prefLabel", "@nest": "labels"},
+ "other_label": {"@id": "skos:altLabel", "@nest": "labels"},
+ "homepage": {"@id": "http://schema.org/description", "@type": "@id"}
+ },
+ "@id": "http://example.org/myresource",
+ "homepage": "http://example.org",
+ "labels": {
+ "main_label": "This is the main label for my resource",
+ "other_label": "This is the other label"
+ }
+}json-ld-1.1.4.25 Expanded Document Form §
@context such that all IRIs, types, and values
+ are expanded so that the @context is no longer necessary.{
+ "@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/"
+}[
+ {
+ "http://xmlns.com/foaf/0.1/name": [
+ { "@value": "Manu Sporny" }
+ ],
+ "http://xmlns.com/foaf/0.1/homepage": [
+ { "@id": "http://manu.sporny.org/" }
+ ]
+ }
+]profile parameter which can be used to signal or request
+ expanded document form. The profile URI identifying expanded document
+ form is http://www.w3.org/ns/json-ld#expanded.4.26 Compacted Document Form §
[
+ {
+ "http://xmlns.com/foaf/0.1/name": [ "Manu Sporny" ],
+ "http://xmlns.com/foaf/0.1/homepage": [
+ {
+ "@id": "http://manu.sporny.org/"
+ }
+ ]
+ }
+]{
+ "@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"
+ }
+ },
+ "name": "Manu Sporny",
+ "homepage": "http://manu.sporny.org/"
+}profile parameter which can be used to signal or request
+ compacted document form. The profile URI identifying compacted document
+ form is http://www.w3.org/ns/json-ld#compacted.4.27 Flattened Document Form §
{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "name": "Manu Sporny"
+ }, {
+ "name": "Dave Longley"
+ }
+ ]
+}{
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@graph": [
+ {
+ "@id": "_:b0",
+ "name": "Dave Longley"
+ }, {
+ "@id": "http://manu.sporny.org/about#manu",
+ "name": "Manu Sporny"
+ }, {
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ { "@id": "http://manu.sporny.org/about#manu" },
+ { "@id": "_:b0" }
+ ]
+ }
+ ]
+}profile parameter which can be used to signal or request
+ flattened document form. The profile URI identifying flattened document
+ form is http://www.w3.org/ns/json-ld#flattened. It can be
+ combined with the profile URI identifying
+ expanded document form or
+ compacted document from.4.28 Embedding JSON-LD in HTML Documents §
type attribute set to
+ application/ld+json.<script type="application/ld+json">
+{
+ "@context": "https://json-ld.org/contexts/person.jsonld",
+ "@id": "http://dbpedia.org/resource/John_Lennon",
+ "name": "John Lennon",
+ "born": "1940-10-09",
+ "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
+}
+</script>
5. Data Model §
+
+
+
+
+ {
+ "@id": "http://example.org/1"
+}@id.
+ A document may have nodes which are unrelated, as long as one or more
+ properties are defined, or the node is referenced from another node object.
+ _:.xsd:string), a number
+ (numbers with a non-zero fractional part, i.e., the result of a modulo‑1 operation,
+ are interpreted as typed values with type xsd:double, all other
+ numbers are interpreted as typed values
+ with type xsd:integer), true or false (which are interpreted as
+ typed values with type xsd:boolean),
+ or a language-tagged string.
6. JSON-LD Grammar §
+
+ @context and/or @graph,
+ or an array or zero or more node objects.id as an alias for @id,
+ that alias may be legitimately used as a substitution for @id.
+ Note that keyword aliases are not expanded during context
+ processing.6.1 Terms §
+
+ :)
+ and SHOULD be restricted to the form of
+ isegment-nz-nc
+ as defined in [RFC3987].@ character as future versions of JSON-LD may introduce
+ additional keywords. Furthermore, the term MUST NOT
+ be an empty string ("") as not all programming languages
+ are able to handle empty JSON keys.6.2 Node Objects §
+
+
+
+
+ @graph and @context,@value, @list,
+ or @set keywords, and
+
+
+ @context,@id,@graph,@nest,@type,@reverse, or@index@context
+ key, its value MUST be null, an absolute IRI,
+ a relative IRI, a context definition, or
+ an array composed of any of these.@id key,
+ its value MUST be an absolute IRI, a relative IRI,
+ or a compact IRI (including
+ blank node identifiers).
+ See section 3.3 Node Identifiers,
+ section 4.4 Compact IRIs, and
+ section 4.16 Identifying Blank Nodes for further discussion on
+ @id values.@graph
+ key, its value MUST be
+ a node object or
+ an array of zero or more node objects.
+ If the node object contains an @id keyword,
+ its value is used as the graph name of a named graph.
+ See section 4.15 Named Graphs for further discussion on
+ @graph values. As a special case, if a JSON object
+ contains no keys other than @graph and @context, and the
+ JSON object is the root of the JSON-LD document, the
+ JSON object is not treated as a node object; this
+ is used as a way of defining node objects
+ that may not form a connected graph. This allows a
+ context to be defined which is shared by all of the constituent
+ node objects.@type
+ key, its value MUST be either an absolute IRI, a
+ relative IRI, a compact IRI
+ (including blank node identifiers),
+ a term defined in the active context expanding into an absolute IRI, or
+ an array of any of these.
+ See section 3.4 Specifying the Type for further discussion on
+ @type values.@reverse key,
+ its value MUST be a JSON object containing members representing reverse
+ properties. Each value of such a reverse property MUST be an absolute IRI,
+ a relative IRI, a compact IRI, a blank node identifier,
+ a node object or an array containing a combination of these.@index key,
+ its value MUST be a string. See
+ section 4.18 Data Indexing for further discussion
+ on @index values.@nest key,
+ its value MUST be an JSON object or an array of JSON objects
+ which MUST NOT include a value object. See
+ section 6.10 Property Nesting for further discussion
+ on @nest values.
+
+ 6.3 Graph Objects §
+
+ @graph,
+ @index, @id
+ and @context, or an alias of one of these keywords.@context
+ key, its value MUST be null, an absolute IRI,
+ a relative IRI, a context definition, or
+ an array composed of any of these.@id key,
+ its value is used as the identifier (graph name) of a named graph, and
+ MUST be an absolute IRI, a relative IRI,
+ or a compact IRI (including
+ blank node identifiers).
+ See section 3.3 Node Identifiers,
+ section 4.4 Compact IRIs, and
+ section 4.16 Identifying Blank Nodes for further discussion on
+ @id values.@id member is also a
+ simple graph object and represents a named graph without an
+ explicit identifier, although in the data model it still has a
+ graph name, which is an implicitly allocated
+ blank node identifier.@graph key MUST be
+ a node object or
+ an array of zero or more node objects.
+ See section 4.15 Named Graphs for further discussion on
+ @graph values..6.4 Value Objects §
+
+ @value key. It MAY also contain an @type,
+ an @language, an @index, or an @context key but MUST NOT contain
+ both an @type and an @language key at the same time.
+ A value object MUST NOT contain any other keys that expand to an
+ absolute IRI or keyword.@value key MUST be either a
+ string, a number, true,
+ false or null.@type key MUST be a
+ term, a compact IRI,
+ an absolute IRI, a string which can be turned
+ into an absolute IRI using the vocabulary mapping, or null.@language key MUST have the
+ lexical form described in [BCP47], or be null.@index key MUST be a
+ string.6.5 Lists and Sets §
+
+ @set keyword, when used in the body of a JSON-LD document,
+ represents just syntactic sugar which is optimized away when processing the document.
+ However, it is very helpful when used within the context of a document. Values
+ of terms associated with an @set or @list container
+ will always be represented in the form of an array when a document
+ is processed—even if there is just a single value that would otherwise be optimized to
+ a non-array form in compact document form.
+ This simplifies post-processing of the data as the data is always in a
+ deterministic form.@list, @context, and @index.@set, @context, and @index.
+ Please note that the @index key will be ignored when being processed.@list and @set
+ MUST be one of the following types:
+
+
+ 6.6 Language Maps §
+
+ @container set to @language,
+
+ or an array containing both @language and @set
+ . The keys of a
+ language map MUST be strings representing
+ [BCP47] language codes, the keyword @none,
+ or a term which expands to @none,
+ and the values MUST be any of the following types:6.7 Index Maps §
+
+ @container set to @index,
+
+ or an array containing both @index and @set
+ .
+ The values of the members of an index map MUST be one
+ of the following types:
+
+
+ @container
+ set to an array containing both @graph and
+ @index, and optionally including @set. The
+ value consists of the node objects contained within the named
+ graph which is named using the referencing key, which can be
+ represented as a simple graph object.6.8 Id Maps §
+
+ @container set to @id,
+ or an array containing both @id and @set.
+ The keys of an id map MUST be IRIs
+ (relative IRI, compact IRI (including blank node identifiers), or absolute IRI),
+ the keyword @none,
+ or a term which expands to @none,
+ and the values MUST be node objects.@id, it's value MUST
+ be equivalent to the referencing key. Otherwise, the property from the value is used as
+ the @id of the node object value when expanding.@container
+ set to an array containing both @graph and @id,
+ and optionally including @set. The value consists of the
+ node objects contained within the named graph
+ which is named using the referencing key.6.9 Type Maps §
+
+ @container set to @type,
+ or an array containing both @type and @set.
+ The keys of a type map MUST be IRIs
+ (relative IRI, compact IRI (including blank node identifiers), or absolute IRI),
+ the keyword @none,
+ or a term which expands to @none,
+ and the values MUST be node objects.@type, and it's value
+ is contains the referencing key after suitable expansion of both the referencing key
+ and the value, then the node object already contains the type. Otherwise, the property from the value is
+ added as a @type of the node object value when expanding.6.10 Property Nesting §
+
+ 6.11 Context Definitions §
+
+ @language, @base,
+ @vocab, or @version.@language key,
+ its value MUST have the lexical form described in [BCP47] or be null.@base key,
+ its value MUST be an absolute IRI, a relative IRI,
+ or null.@vocab key,
+ its value MUST be a absolute IRI, a compact IRI,
+ a blank node identifier,
+ an empty string (""),
+ a term, or null.@version key,
+ its value MUST be a number with the value 1.1.@id,
+ @reverse,
+ @type,
+ @language,
+ @context,
+ @prefix, or
+ @container. An
+ expanded term definition SHOULD NOT contain any other keys.@vocab mapping, the expanded term definition MUST
+ include the @id key.@id
+ keyword, its value MUST be null, an absolute IRI,
+ a blank node identifier, a compact IRI, a term,
+ or a keyword.@reverse member,
+ it MUST NOT have @id or @nest members at the same time,
+ its value MUST be an absolute IRI,
+ a blank node identifier, a compact IRI, or a term. If an
+ @container member exists, its value MUST be null,
+ @set, or @index.@type
+ keyword, its value MUST be an absolute IRI, a
+ compact IRI, a term, null, or one of the
+ keywords @id or @vocab.@language keyword,
+ its value MUST have the lexical form described in [BCP47] or be null.@container
+ keyword, its value MUST be either
+ @list,
+ @set,
+ @language,
+ @index,
+ @id,
+ @graph,
+ @type, or be
+ null
+
+ or an array containing exactly any one of those keywords, or a
+ combination of @set and any of @index,
+ @id, @graph, @type,
+ @language in any order
+ .
+ @container may also be an array
+ containing @graph along with either @id or
+ @index and also optionally including @set.
+ If the value
+ is @language, when the term is used outside of the
+ @context, the associated value MUST be a language map.
+ If the value is @index, when the term is used outside of
+ the @context, the associated value MUST be an
+ index map.@context member,
+ it MUST be a valid context definition.@nest
+ keyword, its value MUST be either @nest, or a term
+ which expands to @nest.@prefix
+ keyword, its value MUST be true or false.7. Relationship to RDF §
+
+
+
+
+
+
+
+ 7.1 Serializing/Deserializing RDF §
+
+
+ {
+ "@context": {
+ "name": "http://xmlns.com/foaf/0.1/name",
+ "knows": "http://xmlns.com/foaf/0.1/knows"
+ },
+ "@id": "http://me.markus-lanthaler.com/",
+ "name": "Markus Lanthaler",
+ "knows": [
+ {
+ "@id": "http://manu.sporny.org/about#manu",
+ "name": "Manu Sporny"
+ }, {
+ "name": "Dave Longley"
+ }
+ ]
+}[
+ {
+ "@id": "_:b0",
+ "http://xmlns.com/foaf/0.1/name": "Dave Longley"
+ }, {
+ "@id": "http://manu.sporny.org/about#manu",
+ "http://xmlns.com/foaf/0.1/name": "Manu Sporny"
+ }, {
+ "@id": "http://me.markus-lanthaler.com/",
+ "http://xmlns.com/foaf/0.1/name": "Markus Lanthaler",
+ "http://xmlns.com/foaf/0.1/knows": [
+ { "@id": "http://manu.sporny.org/about#manu" },
+ { "@id": "_:b0" }
+ ]
+ }
+]@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+_:b0 foaf:name "Dave Longley" .
+
+<http://manu.sporny.org/about#manu> foaf:name "Manu Sporny" .
+
+<http://me.markus-lanthaler.com/> foaf:name "Markus Lanthaler" ;
+ foaf:knows <http://manu.sporny.org/about#manu>, _:b0 .A. Changes since 1.0 Recommendation of 16 January 2014 §
+
+@version member which is used to set the processing mode.@context property, which defines a context used for values of
+ a property identified with such a term.@container values within an expanded term definition may now
+ include @id, @graph and @type, corresponding to id maps and type maps.@nest property, which identifies a term expanding to
+ @nest which is used for containing properties using the same
+ @nest mapping. When expanding, the values of a property
+ expanding to @nest are treated as if they were contained
+ within the enclosing node object directly.@none value, but
+ JSON-LD 1.0 only allowed string values. This has been updated
+ to allow (and ignore) @null values.@container in an expanded term definition
+ can also be an array containing any appropriate container
+ keyword along with @set (other than @list).
+ This allows a way to ensure that such property values will always
+ be expressed in array form.@prefix member with the value true. The 1.0 algorithm has
+ been updated to only consider terms that map to a value that ends with a URI
+ gen-delim character.@container set to @graph are interpreted as
+ implicitly named graphs, where the associated graph name is
+ assigned from a new blank node identifier. Other combinations
+ include ["@container", "@id"], ["@container", "@index"] each also
+ may include "@set", which create maps from the
+ graph identifier or index value similar to index maps
+ and id maps."") has been added as a possible value for @vocab in
+ a context. When this is set, vocabulary-relative IRIs, such as the
+ keys of node objects, are expanded or compacted relative
+ to the base IRI using string concatenation.B. Open Issues §
"indexkey":"@index"
+
+{
+ "@context": {
+ "labels":"@index",
+ "main_label":"http://example.org/my-schema#main_label",
+ "other_label":"http://example.org/my-schema#other_label",
+ "homepage":{ "@id":"http://example.org/my-schema#homepage", "@type":"@id"}
+ },
+ "@id":"http://example.org/myresource",
+ "homepage": "http://example.org",
+ "labels": {
+ "main_label": "This is the main label for my resource",
+ "other_label": "This is the other label"
+ }
+}<http://example.org/myresource> <http://example.org/my-schema#homepage> <http://example.org>.
+<http://example.org/myresource> <http://example.org/my-schema#main_label> "This is the main label for my resource".
+<http://example.org/myresource> <http://example.org/my-schema#other_label> "This is the other label".
+{
+ "@language": "en",
+ "displayName": "foo"
+}{
+ "@context": {"@language": "en"},
+ "displayName": "foo"
+}{
+ "@context": {
+ "@label": "An Example Context",
+ "displayName": "@label",
+ },
+ "displayName": "A Simple Label"
+}_:c14n0 <http://www.w3.org/2000/01/rdf-schema#label> "A Simple Label" .
+Problem description §
+[ [3.1,51.06,30],
+ [3.1,51.06,20] ]Suggested solution §
+@values keyword, which can be used to describe the values of a @set or a @list container in more detail.@values, then the precise amount of objects within this array corresponds with the array in the graph in this order.@values, each value of the array in the graph is mapped according to this template.Example §
+{
+ "@context": {
+ "coordinates": {
+ "@id": "geojson:coordinates",
+ "@container" : "@list",
+ "@values" : {
+ "@type" : "geojson:Coordinate",
+ "@container" : "@set",
+ "@values" : [
+ {"@type" : "xsd:double", "@id":"geo:longitude"},
+ {"@type" : "xsd:double", "@id":"geo:latitude"}
+ ]
+ }
+ }
+ },
+ "@graph" : [{
+ "@id" : "ex:LineString1",
+ "coordinates" : [
+ [
+ 3.1057405471801753,
+ 51.064216229943476
+ ],
+ [
+ 3.1056976318359375,
+ 51.063434090307574
+ ]
+ ]
+ }]
+}ex:LineString1 geojson:coordinates _:b0 .
+_:b0 rdf:first _:b1 .
+_:b1 a geojson:Coordinate ;
+ geo:longitude "3.105740547180175E0"^^xsd:double ;
+ geo:latitude "5.106421622994348E1"^^xsd:double .
+_:b0 rdf:rest _:b2 .
+_:b2 rdf:first a geojson:Coordinate ;
+ geo:longitude "3.1056976318359375"^^xsd:double ;
+ geo:latitude "51.063434090307574"^^xsd:double .
+_:b2 rdf:rest rdf:nil .Accept: text/turtle or another appropriate serialisation.@identified as such, @language tags, RDF data-types, e.g. xsd:dateTime's and prefix URI's. Basically I want to use JSON-LD as a means to augment RDF with JSON, and perhaps even give JSON developers hooks into documentation on certain keys, e.g. answering the question what does the dimension key mean, by letting them dereference it?
+they also provide means in http headers to specify the variant which applies to the given document in terms of a link to a context and/or a media type profile.
+is this now included somewhere in 1.1 document?
+are there plans to provide for this?
+
+ duri:<timestamp>:<embeddedURI>
+
+ tdb:<timestamp>:<embeddedURI>
+
+"@version": 1.1), semantic versioning would suggest that we use a major release number, rather than a minor number.2.1 or 3.0, which is odd given that the previous recommendation is 1.0."title": [ { "value": "Moby Dick", "lang": "en" },
+ { "value": "موبي ديك", "lang": "ar" "dir": "rtl"}
+ ]
+
+"title": [ { "@value": "Moby Dick", "@language": "en" },
+ { "@value": "موبي ديك", "@language": "ar" "dir": "rtl"}
+ ]
+
+dir term is not defined in the relevant @context so that, when generating the RDF output, that term is simply ignored. But that also means that there is no round-tripping, that term will disappear after expansion.
+
+@dir term, alongside @language. This means this term can be used in place of dir above, ie, it is a bona-fide part of a string representation, and would therefore be kept in the compaction/expansion steps, can also be used for framing.@dir is ignored when transforming into RDF. I.e., only the language tag would be used.
+3.1. Define a mechanism of "parametrized" standard datatypes that represent a (language,direction) pair. One would then get something like[] ex:title "موبي ديك"^^rdf:internationalText(ar,rtl) ;
+3.2. Go for a "generalized" RDF where strings can also appear as subjects (that has been a matter of dispute for a long time...). That would give the possibility to add such attribute to texts like directions
+3.3. Some other mechanisms that I cannot think about@dir value can be properly mapped onto an RDF representing the right choices (if such choices are worked out)
+
+@value, @language and @type. Meaning that for text with embedded mark up, it is impossible to have both language and format (the datatype given in @type) ... neither of which can be reliably introspected from the value.{
+ "description": {
+ "@value":"<p>Some <b>description</b></p>",
+ "@type": "rdf:XMLLiteral",
+ "@language" : "en-latn"
+ }
+}
+
+
+Door-Opened-By: #583'pfrazee-social-media-feed-item'.pfrazee-social-media-feed-item.
+
+@list for encoding schema:ItemList serializations, when the values are schema:ListItem and order is set through schema:position. ItemList can be used with text values as well, but this is already reasonably supported natively.{
+ "@context": {
+ "@vocab": "http://schema.org/",
+ "itemListElement": {"@container": "@listItem"}
+ },
+ "@type": "ItemList",
+ "@url": "http://en.wikipedia.org/wiki/Billboard_200",
+ "name": "Top music artists",
+ "description": "The artists with the most cumulative weeks at number one according to Billboard 200",
+ "itemListElement": [
+ {"@type": "MusicGroup", "name": "Beatles"},
+ {"@type": "MusicGroup", "name": "Elvis Presley"},
+ {"@type": "MusicGroup", "name": "Michael Jackson"},
+ {"@type": "MusicGroup", "name": "Garth Brooks" }
+ ][
+ {
+ "@id": "http://en.wikipedia.org/wiki/Billboard_200",
+ "@type": ["http://schema.org/ItemList"],
+ "http://schema.org/description": [{
+ "@value": "The artists with the most cumulative weeks at number one according to Billboard 200"
+ }],
+ "http://schema.org/itemListElement": [{
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Beatles"}]
+ }],
+ "http://schema.org/position": [{"@value": 1}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Elvis Presley"}]
+ }],
+ "http://schema.org/position": [{"@value": 2}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Michael Jackson"}]
+ }],
+ "http://schema.org/position": [{"@value": 3}]
+ }, {
+ "@type": ["http://schema.org/ListItem"],
+ "http://schema.org/item": [{
+ "@type": ["http://schema.org/MusicGroup"],
+ "http://schema.org/name": [{"@value": "Garth Brooks"}]
+ }],
+ "http://schema.org/position": [{"@value": 3}]
+ }
+ ],
+ "http://schema.org/name": [{"@value": "Top music artists"}]
+}]@list.position, and ignore any nextItem or previousItem entries.position values are lost when compacting, and duplicate values may lead to undefined relative ordering.@url keyword, where they likely meant @id.{
+ "@context": "http://schema.org",
+ "@type": "ItemList",
+ "@url": "http://en.wikipedia.org/wiki/Billboard_200",
+ "name": "Top music artists",
+ "description": "The artists with the most cumulative weeks at number one according to Billboard 200",
+ "itemListElement": [
+ {
+ "@type": "ListItem",
+ "position": 1,
+ "item": {
+ "@type": "MusicGroup",
+ "name": "Beatles"
+ }
+ },
+ {
+ "@type": "ListItem",
+ "position": 2,
+ "item": {
+ "@type": "MusicGroup",
+ "name": "Elvis Presley"
+ }
+ },
+ {
+ "@type": "ListItem",
+ "position": 3,
+ "item": {
+ "@type": "MusicGroup",
+ "name": "Michael Jackson"
+ }
+ },
+ {
+ "@type": "ListItem",
+ "position": 3,
+ "item": {
+ "@type": "MusicGroup",
+ "name": "Garth Brooks"
+ }
+ }
+ ]
+}@vocab as http://schema.org/@url. This creates a potential forward-compatibility issue if new keywords are introduced, as they are in 1.1. We might want to describe normative or suggested behavior if a processor encounters a string which could hold a keyword, but holds something else starting with @.C. Relationship to Other Linked Data Formats §
C.1 Turtle §
C.1.1 Prefix definitions §
+
+ @prefix declaration:@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://manu.sporny.org/about#manu> a foaf:Person;
+ foaf:name "Manu Sporny";
+ foaf:homepage <http://manu.sporny.org/> .{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "foaf:Person",
+ "foaf:name": "Manu Sporny",
+ "foaf:homepage": { "@id": "http://manu.sporny.org/" }
+}C.1.2 Embedding §
+
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://manu.sporny.org/about#manu>
+ a foaf:Person;
+ foaf:name "Manu Sporny";
+ foaf:knows [ a foaf:Person; foaf:name "Gregg Kellogg" ] .{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@id": "http://manu.sporny.org/about#manu",
+ "@type": "foaf:Person",
+ "foaf:name": "Manu Sporny",
+ "foaf:knows": {
+ "@type": "foaf:Person",
+ "foaf:name": "Gregg Kellogg"
+ }
+}C.1.3 Conversion of native data types §
+
+ xsd:integer-typed literals, numbers with fractions
+ to xsd:double-typed literals and the two boolean values
+ true and false to a xsd:boolean-typed
+ literal. All typed literals are in canonical lexical form.{
+ "@context": {
+ "ex": "http://example.com/vocab#"
+ },
+ "@id": "http://example.com/",
+ "ex:numbers": [ 14, 2.78 ],
+ "ex:booleans": [ true, false ]
+}@prefix ex: <http://example.com/vocab#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+<http://example.com/>
+ ex:numbers "14"^^xsd:integer, "2.78E0"^^xsd:double ;
+ ex:booleans "true"^^xsd:boolean, "false"^^xsd:boolean .C.1.4 Lists §
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://example.org/people#joebob> a foaf:Person;
+ foaf:name "Joe Bob";
+ foaf:nick ( "joe" "bob" "jaybee" ) .{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@id": "http://example.org/people#joebob",
+ "@type": "foaf:Person",
+ "foaf:name": "Joe Bob",
+ "foaf:nick": {
+ "@list": [ "joe", "bob", "jaybee" ]
+ }
+}C.2 RDFa §
<div prefix="foaf: http://xmlns.com/foaf/0.1/">
+ <ul>
+ <li typeof="foaf:Person">
+ <a property="foaf:homepage" href="http://example.com/bob/">
+ <span property="foaf:name">Bob</span>
+ </a>
+ </li>
+ <li typeof="foaf:Person">
+ <a property="foaf:homepage" href="http://example.com/eve/">
+ <span property="foaf:name">Eve</span>
+ </a>
+ </li>
+ <li typeof="foaf:Person">
+ <a property="foaf:homepage" href="http://example.com/manu/">
+ <span property="foaf:name">Manu</span>
+ </a>
+ </li>
+ </ul>
+</div>
{
+ "@context": {
+ "foaf": "http://xmlns.com/foaf/0.1/"
+ },
+ "@graph": [
+ {
+ "@type": "foaf:Person",
+ "foaf:homepage": "http://example.com/bob/",
+ "foaf:name": "Bob"
+ }, {
+ "@type": "foaf:Person",
+ "foaf:homepage": "http://example.com/eve/",
+ "foaf:name": "Eve"
+ }, {
+ "@type": "foaf:Person",
+ "foaf:homepage": "http://example.com/manu/",
+ "foaf:name": "Manu"
+ }
+ ]
+}C.3 Microformats §
<div class="vcard">
+ <a class="url fn" href="http://tantek.com/">Tantek Çelik</a>
+</div>url and fn
+ properties. Also note that the Microformat to JSON-LD processor has
+ generated the proper URL type for http://tantek.com/.{
+ "@context": {
+ "vcard": "http://microformats.org/profile/hcard#vcard",
+ "url": {
+ "@id": "http://microformats.org/profile/hcard#url",
+ "@type": "@id"
+ },
+ "fn": "http://microformats.org/profile/hcard#fn"
+ },
+ "@type": "vcard",
+ "url": "http://tantek.com/",
+ "fn": "Tantek Çelik"
+}C.4 Microdata §
<dl itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Work"
+ itemid="http://purl.oreilly.com/works/45U8QJGZSQKDH8N">
+ <dt>Title</dt>
+ <dd><cite itemprop="http://purl.org/dc/terms/title">Just a Geek</cite></dd>
+ <dt>By</dt>
+ <dd><span itemprop="http://purl.org/dc/terms/creator">Wil Wheaton</span></dd>
+ <dt>Format</dt>
+ <dd itemprop="http://purl.org/vocab/frbr/core#realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596007683.BOOK">
+ <link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/BOOK">
+ Print
+ </dd>
+ <dd itemprop="http://purl.org/vocab/frbr/core#realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596802189.EBOOK">
+ <link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/EBOOK">
+ Ebook
+ </dd>
+</dl>[
+ {
+ "@id": "http://purl.oreilly.com/works/45U8QJGZSQKDH8N",
+ "@type": "http://purl.org/vocab/frbr/core#Work",
+ "http://purl.org/dc/terms/title": "Just a Geek",
+ "http://purl.org/dc/terms/creator": "Whil Wheaton",
+ "http://purl.org/vocab/frbr/core#realization":
+ [
+ "http://purl.oreilly.com/products/9780596007683.BOOK",
+ "http://purl.oreilly.com/products/9780596802189.EBOOK"
+ ]
+ }, {
+ "@id": "http://purl.oreilly.com/products/9780596007683.BOOK",
+ "@type": "http://purl.org/vocab/frbr/core#Expression",
+ "http://purl.org/dc/terms/type": "http://purl.oreilly.com/product-types/BOOK"
+ }, {
+ "@id": "http://purl.oreilly.com/products/9780596802189.EBOOK",
+ "@type": "http://purl.org/vocab/frbr/core#Expression",
+ "http://purl.org/dc/terms/type": "http://purl.oreilly.com/product-types/EBOOK"
+ }
+]D. IANA Considerations §
+
+ application/ld+json §
+
+
+
+
+
+ profileprofile parameter MAY be used by
+ clients to express their preferences in the content negotiation process.
+ If the profile parameter is given, a server SHOULD return a document that
+ honors the profiles in the list which are recognized by the server.
+ It is RECOMMENDED that profile URIs are dereferenceable and provide
+ useful documentation at that URI. For more information and background
+ please refer to [RFC6906].profile parameter.
+ To request or specify expanded JSON-LD document form,
+ the URI http://www.w3.org/ns/json-ld#expanded SHOULD be used.
+ To request or specify compacted JSON-LD document form,
+ the URI http://www.w3.org/ns/json-ld#compacted SHOULD be used.
+ To request or specify flattened JSON-LD document form,
+ the URI http://www.w3.org/ns/json-ld#flattened SHOULD be used.
+ Please note that, according [HTTP11], the value of the profile
+ parameter has to be enclosed in quotes (") because it contains
+ special characters and, if multiple profiles are combined, whitespace.eval()
+ function to be parsed. An (invalid) document may contain code that,
+ when executed, could lead to unexpected side effects compromising
+ the security of a system.
+
+ E. Security Considerations §
+ F. Acknowledgements §
G. References §
G.1 Normative references §
G.2 Informative references §
PDDmTfJ
zEbl!=$!-7R=j!SYS7L@+a^8@=jAnM6+vrQXXbhJzr-)wKd{^vZnH4b
I-qZb$%DTf{N-jH4F2*po^Fi0r*lY6>f>X*`pX*}H&HbrNRs-9ZH%vg
zlYR|HgI;KpbBjI(cDhD(BHh_(z2#jo&-C=Nx1Kn5Vx+#)S8=2jqk)?)!cEQE7|7{g
cC8zqn`jcCCAGZD`*WHKz1G@?~2#9n50H^6c`~Uy|
literal 0
HcmV?d00001
diff --git a/spec/CG-FINAL/json-ld/20180507/linked-data-graph.png b/spec/CG-FINAL/json-ld/20180507/linked-data-graph.png
new file mode 100644
index 0000000000000000000000000000000000000000..f1c0d76d0cd617f0dae2d89ce05fec32e36e7a61
GIT binary patch
literal 27844
zcmbTdbyQo?w>6qVu@*{kX>oTgZp9snOK}ZFin|qxySp_w!KJvn2lwJu-2FTK-TU6S
zW4!U*KVC8*2Xc~aYtOajT62dgD@vigA$$V@fzV{6#Z^EcxEA0C4H*vjkE$Yn5AZ_Z
zB%$S`YG>}`YUE%B`fO@vY(^?$V`O2bVrFFOZa-)y00LQ?%ZPtgb6fnIDQr#IpS5N&
z&i>~nPEYjBSjWDLyZX**^U*x;$V6(o?J-AldV^0nTk
z=&tVR9ZKOrm+Ac6c%FFep9$!b_}bBOpen Issues
-
diff --git a/spec/latest/json-ld-framing/index.html b/spec/latest/json-ld-framing/index.html
index b9d8785da..699f7f11f 100644
--- a/spec/latest/json-ld-framing/index.html
+++ b/spec/latest/json-ld-framing/index.html
@@ -807,7 +807,7 @@ Framing Named Graphs
be obtained by the specification's algorithms.Open Issues
-
Set of Documents
JSON for Linking Data W3C Community Group:
To understand the basics in this specification you must first be familiar with JSON, which is detailed in [RFC7159]. You must also understand the - JSON-LD syntax defined in the JSON-LD 1.1 Syntax specification [JSON-LD11CG], which is the base syntax used by all + JSON-LD syntax defined in the JSON-LD 1.1 Syntax specification [JSON-LD11CG], 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 [ECMASCRIPT-6.0] and @@ -1379,7 +1379,7 @@
@container set to @language, whose keys MUST be strings representing
@@ -1544,7 +1544,7 @@ null,
and element is set to the JSON-LD input.
If not passed, the frame expansion flag is set to false.
@@ -4742,7 +4742,7 @@ This section is non-normative.
Framing is used to shape the data in a JSON-LD document, using an example frame document which is used to both match the - flattened + flattened data and show an example of how the resulting data should be shaped. Matching is performed by using properties present in in the frame to find objects in the data that share common values. Matching can be done @@ -1803,7 +1803,7 @@
Framing can be controlled using API options, +
Framing can be controlled using API options, or by adding framing keywords within the frame as described in section 4.1 Syntax Tokens and Keywords.
@@ -2153,7 +2153,7 @@@nullnull
should be returned, which would otherwise be removed when
- Compacting.@omitDefaultJSON-LD Framing extends the error interface and codes defined in - the JSON-LD 1.1 API [JSON-LD11CG-API]. + the JSON-LD 1.1 API [JSON-LD11CG-API].
codeThe JsonLdContext type is used to refer to a value that +
The JsonLdContext type is used to refer to a value that that may be a dictionary, a string representing an IRI, or an array of dictionaries and strings.
-See JsonLdContext definition in the JSON-LD 1.1 API [JSON-LD11CG-API].
+See JsonLdContext definition in the JSON-LD 1.1 API [JSON-LD11CG-API].
The JsonLdOptions type is used to pass various options to the
+
The JsonLdOptions type is used to pass various options to the
JsonLdProcessor methods.
dictionary JsonLdOptions {
+ dictionary JsonLdOptions {
(JsonLdEmbed or boolean) embed = "@last";
boolean explicit = false;
boolean omitDefault = false;
@@ -2723,7 +2723,7 @@ 5.3.2 JsonLdOptions&nbs
@never-
Always use a node reference when serializing matching values.
-
See JsonLdOptions definition in the JSON-LD 1.1 API [JSON-LD11CG-API].
+ See JsonLdOptions definition in the JSON-LD 1.1 API [JSON-LD11CG-API].
@@ -2803,7 +2803,7 @@ application/ld-frame+json JsonLdProcessor {
static Promise<JsonLdDictionary> frame(JsonLdInput input,
(JsonLdDictionary or USVString) frame,
- optional JsonLdOptions? options);
+ optional JsonLdOptions? options);
};
dictionary JsonLdFramingError {
JsonLdFramingErrorCode code;
@@ -2813,7 +2813,7 @@ application/ld-frame+json "invalid frame",
"invalid @embed value"
};
-
dictionary JsonLdOptions {
+dictionary JsonLdOptions {
(JsonLdEmbed or boolean) embed = "@last";
boolean explicit = false;
boolean omitDefault = false;
@@ -2950,8 +2950,8 @@ application/ld-frame+json G. References §
G.1 Normative references §
- [BCP47]
- Tags for Identifying Languages. A. Phillips; M. Davis. IETF. September 2009. IETF Best Current Practice. URL: https://tools.ietf.org/html/bcp47
- [JSON-LD]
- JSON-LD 1.0. Manu Sporny; Gregg Kellogg; Markus Lanthaler. W3C. 16 January 2014. W3C Recommendation. URL: https://www.w3.org/TR/json-ld/
-
- [JSON-LD11CG]
- JSON-LD 1.1. Gregg Kellogg. W3C. CG Draft. URL: https://json-ld.org/spec/latest/json-ld/
-
- [JSON-LD11CG-API]
- JSON-LD 1.1 Processing Algorithms and API. Gregg Kellogg. W3C. CG Draft. URL: https://json-ld.org/spec/latest/json-ld-api/
+
- [JSON-LD11CG]
- JSON-LD 1.1. Gregg Kellogg. W3C. CG Final. URL: https://json-ld.org/spec/CG-FINAL/json-ld/20180507/
+
- [JSON-LD11CG-API]
- JSON-LD 1.1 Processing Algorithms and API. Gregg Kellogg. W3C. CG Final. URL: https://json-ld.org/spec/CG-FINAL/json-ld-api/20180507/
- [RDF-CONCEPTS]
- Resource Description Framework (RDF): Concepts and Abstract Syntax. Graham Klyne; Jeremy Carroll. W3C. 10 February 2004. W3C Recommendation. URL: https://www.w3.org/TR/rdf-concepts/
- [RFC2119]
- Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
- [RFC3987]
- Internationalized Resource Identifiers (IRIs). M. Duerst; M. Suignard. IETF. January 2005. Proposed Standard. URL: https://tools.ietf.org/html/rfc3987
@@ -2959,7 +2959,7 @@
application/ld-frame+json [WEBIDL]- Web IDL. Cameron McCormack; Boris Zbarsky; Tobie Langel. W3C. 15 December 2016. W3C Editor's Draft. URL: https://heycam.github.io/webidl/
G.2 Informative references §
- [ECMASCRIPT-6.0]
- ECMA-262 6th Edition, The ECMAScript 2015 Language Specification. Allen Wirfs-Brock. Ecma International. June 2015. Standard. URL: http://www.ecma-international.org/ecma-262/6.0/index.html
- [JSON-LD-TESTS]
- JSON-LD 1.1 Test Suite. Gregg Kellogg. Linking Data in JSON Community Group. URL: https://json-ld.org/test-suite/
-
- [JSON-LD11CG-FRAMING]
- JSON-LD 1.1 Framing. Gregg Kellogg. W3C. CG Draft. URL: https://json-ld.org/spec/latest/json-ld-framing/
+
- [JSON-LD11CG-FRAMING]
- JSON-LD 1.1 Framing. Gregg Kellogg. W3C. CG Final. URL: https://json-ld.org/spec/CG-FINAL/json-ld-framing/20180507/
- [RDF-SCHEMA]
- RDF Schema 1.1. Dan Brickley; Ramanathan Guha. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf-schema/
- [RDF11-CONCEPTS]
- RDF 1.1 Concepts and Abstract Syntax. Richard Cyganiak; David Wood; Markus Lanthaler. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf11-concepts/