From 7cfeb303558593e9efa20df5a02d9b2f7ce42ffa Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 28 Aug 2022 11:47:57 -0700 Subject: [PATCH] Updates to recommended YAML serialization suggested by @pchampin. --- spec/index.html | 59 ++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/spec/index.html b/spec/index.html index 62c7112..18bbcb3 100644 --- a/spec/index.html +++ b/spec/index.html @@ -573,7 +573,7 @@

Encoding

Comments

Comments in YAML-LD documents are treated as white space. - This behavior is consistent with other Linked Data serializations like [[TURTLE]]. + This behavior is consistent with other Linked Data serializations like [[?TURTLE]]. See Interoperability considerations of [[I-D.ietf-httpapi-yaml-mediatypes]] for more details.

@@ -1025,6 +1025,8 @@

Conversion to YAML

to YAML begins by preparing an empty representation graph which will be rooted with either a YAML mapping or YAML sequence. +

+

Although outside of the scope of this specification, processors MAY use YAML directives, including TAG directives, and @@ -1032,29 +1034,19 @@

Conversion to YAML

as appropriate for best results. Specifically, if the {{JsonLdOptions/extendedYAML}} API flag is `true`, the document SHOULD use the `%YAML` directive with - version set to at least `1.2` - and a `%TAG` directive appropriate for each - `RDF literal`. + version set to at least `1.2`. + To improve readability and reduce document size, + the document MAY use a `%TAG` directive appropriate for + RDF literals contained within the representation.

-
-

A concrete proposal in that direction would be to use a tag at the - top-level of any "idiomatic" YAML-LD document, applying to the whole - object/array that makes the document.

- -

It might also include a version - to identify the specification that it relates to, allowing - for version announcement that could be used for future-proofing.

- -

E.g.

- -
-      !yaml-ld
-      $context: http://schema.org/
-      $type: Person
-      name: Pierre-Antoine Champin
-      
-
+

+ The use of `%TAG` directives in YAML-LD is similar to the use + of the `PREFIX` directive in [[?Turtle]] + or the general use of terms as prefixes to create + Compact IRIs in [[JSON-LD11]]: + they not change the meaning of the encoded scalars. +

Conversion to YAML
       hopefully become unnecessary as implementations are updated.
     

+
+

A concrete proposal in that direction would be to use a tag at the + top-level of any "idiomatic" YAML-LD document, applying to the whole + object/array that makes the document.

+ +

It might also include a version + to identify the specification that it relates to, allowing + for version announcement that could be used for future-proofing.

+ +

E.g.

+ +
+      !yaml-ld
+      $context: http://schema.org/
+      $type: Person
+      name: Pierre-Antoine Champin
+      
+
+ +

See for an example of serializing the extended internal representation.

+

Converting From the Internal Representation

@@ -1694,7 +1707,7 @@

FAQ

Moreover [[JSON]] (and hence [[JSON-LD11]]) does not support comments, and other Linked Data serialization formats - that support comments (such as [[TURTLE]]) + that support comments (such as [[?TURTLE]]) do not provide a means to preserve them when processing and serializing the document in other formats.