From ee6bf586723b509a239dbf44de45acd664dd4ef8 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
+Alternate versions of the vocabulary definition exist in
+JSON-LD.
+
+This document, and the associated documents in alternative formats, defines the YAML-LD Convenience Context.
+This context defines terms that can be used in place of JSON-LD keywords
+to simplify serialization of documents in YAML-LD, within the limitations
+of using aliases of keywords in JSON-LD algorithms.
+
- [[JSON-LD]] is a JSON-based format to serialize Linked Data.
+ [[JSON-LD11]] is a JSON-based format to serialize Linked Data.
In recent years, [[YAML]] has emerged as a more concise format
to represent information that had previously been serialized as [[JSON]],
including API specifications, data schemas, and Linked Data.
@@ -313,14 +313,16 @@ The YAML-LD Convenience Context
+
+
+
+Introduction
+Context Definition
+Introduction
Terminology
conforming to the [[JSON]] grammar.
- The term JSON-LD document is imported from [[JSON-LD]]. + The term JSON-LD document is imported from [[JSON-LD11]].
The term - internal representation - is imported from [[JSON-LD-API]]. + internal representation + is imported from [[JSON-LD11-API]]. + The term documentLoader + is imported from [[JSON-LD11-API]]
The terms @@ -408,23 +410,21 @@
A YAML-LD document complies with this specification if it follows the normative statements from this specification and - can be interpreted as [[JSON-LD]] after transformation into the internal representation. + can be interpreted as [[JSON-LD11]] after transformation into the internal representation. For convenience, normative statements for documents are often phrased as statements on the properties of the document.
A YAML-LD document complies with the YAML-LD-JSON profile of this specification if it follows the normative statements from this specification and can be transformed into a JSON-LD representation, then back to a conforming YAML-LD document, without loss of semantic information. -
- - +- To ease writing and collaborating on [[JSON-LD]] documents, it is becoming common practice + To ease writing and collaborating on [[JSON-LD11]] documents, it is becoming common practice to serialize them as [[YAML]]. This requires a registered media type, not only to enable content negotiation of linked data documents in YAML, but also to define the expected behavior of @@ -515,12 +515,91 @@
FIXME.
+ +As JSON-LD keywords cannot be represented in YAML without being quoted, + publishers may find it useful to declare term aliases for these + keywords.
+ ++ For convenience, a convenience context is available + at `https://www.w3.org/ns/yaml-ld/v1`, which pre-defines these aliases: +
+ ++ ++ +
The convenience context contains an alias to every JSON-LD keyword which the JSON-LD 1.1
+ specification permits aliasing — which means all the keywords except @context
. The reserved `@` character is
+ replaced by `$`, which is not reserved and therefore does not require quoting. Consider
+
+ reformatted using the convenience context:
This allows YAML-LD to be created with minimal use of map quoted keys (Note that the `@context` keyword cannot be aliased):
+ ++ ++
@@ -528,7 +607,7 @@
Since anchor names are a serialization detail, such anchors @@ -623,7 +702,7 @@
In order to reduce the demand for loading static documents, + implementations SHOULD maintain a locally cached version of the following + documents the be satisfied by the default documentLoader.
+ +- Follow JSON-LD best practices + Follow JSON-LD best practices …in order to achieve a greater level of reusability, performance, and human friendliness among YAML-LD aware - systems. The [[json-ld-bp]] document is as relevant to YAML-LD as it is to [[JSON-LD]]. + systems. The [[json-ld-bp]] document is as relevant to YAML-LD as it is to [[JSON-LD11]].
- Do not force users to author contexts + Do not force users to author contexts Instead, provide pre-built contexts that the user can reference by URL for a majority of common use cases.
@@ -1190,25 +1280,25 @@YAML-LD is intended to simplify the authoring of Linked Data for a wide range of domain experts; its target audience is not comprised solely of IT professionals. [[YAML]] is chosen as a medium to minimize syntactic noise, - and to keep the authored documents concise and clear. [[JSON-LD]] (and hence YAML-LD) Context comprises a special + and to keep the authored documents concise and clear. [[JSON-LD11]] (and hence YAML-LD) Context comprises a special language of its own. A requirement to author such a context would make the domain expert's job much harder — which we, as system architects and developers, should try to avoid.
- Use a default context + Use a default context
If most, or all, of a user's documents are based on one particular context, try to make it the default in order to rescue the user from copy-pasting the same technical incantation from one document to another.For instance, according to [[json-ld-api]], the `expand()` method of a JSON-LD processor accepts an +
For instance, according to [[JSON-LD11-API]], the `expand()` method of a JSON-LD processor accepts an `expandContext` argument which can be used to provide a default system context.
- Alias JSON-LD keywords + Alias JSON-LD keywords If possible, map JSON-LD keywords containing the `@` character to keywords that do not contain it.
@@ -1247,54 +1337,13 @@- Use YAML-LD Convenience Context + Use YAML-LD Convenience Context
YAML-LD users may use a JSON-LD context provided as part of this specification, henceforth known as the - convenience context, which defines a standardized mapping of every `@`-keyword to a `$`-keyword, except `@context`. + convenience context, which defines a standardized mapping of every `@`-keyword to a `$`-keyword, except `@context`.
The convenience context contains an alias to every JSON-LD keyword which the JSON-LD 1.1
- specification permits aliasing — which means all the keywords except @context
. The reserved `@` character is
- replaced by `$`, which is not reserved and therefore does not require quoting. Consider
+
Consider reformatted using the convenience context:
@@ -1320,6 +1369,7 @@The applicability of this context depends on the domain and is left to the architect's best judgement.
+
Comments
Comments in YAML-LD documents are treated as white space. @@ -538,7 +617,7 @@
Comments