Skip to content

Commit

Permalink
#94 Section about the Data Model in FAQ seemingly reiterates what i…
Browse files Browse the repository at this point in the history
…s said in the `Cycles` chapter
  • Loading branch information
anatoly-scherbakov committed Jun 25, 2023
1 parent 1460c08 commit d8e74ab
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1078,71 +1078,6 @@ <h3>application/ld+yaml</h3>
</section>
</section>

<section id="faq" class="informative" data-format="markdown">
<p class="ednote">REMOVE THIS SECTION BEFORE PUBLICATION.</p>

<h3>FAQ</h3>

#### Why does YAML-LD not extend the JSON-LD data model ?

<div class="ednote">
[[JSON]] only represents simple trees while [[YAML]] can support
rooted, directed graphs with references and cycles.

The above structures cannot be preserved when serializing
to JSON-LD and - with respect to cycles - the serialization
will fail.

Programming languages such as Java and Python already support
<a>YAML representation graphs</a>, but these implementations may behave
differently.
In the following example, `&value` references the value
of the keyword `value`.

<pre class="example yaml"
data-transform="updateExample"
data-content-type="application/ld+yaml"
title="YAML-LD with references">
<!--
value: &value 100
valve1:
temperature: &temp100C
value: *value
unit: degC
valve2:
temperature: *temp100C
-->
</pre>

Processing this entry in Python, I get the following
structure that preserve the references to
mutable objects (e.g., the `temperature` dict)
but not to scalars (e.g., the `value` keyword).

<pre class="example python"
data-transform="updateExample"
data-result-for="YAML-LD with references"
data-content-type="text/x-python"
title="Result of parsing YAML-LD with references to Python">
<!--
temperature = { "value": 100, "unit": "degC" }
document = {
"value": 100,
"valve1": { "temperature": temperature },
"valve2": { "temperature": temperature }
}
-->
</pre>

Since all these implementations pre-date this
specification, some more interoperable choices include the following:

* forbidding cycles in <a>YAML-LD documents</a>
* considering all references in YAML-LD as static,
i.e., a shorthand way to repeat specific patterns

</div>
</section>
<section id="best-practices" class="informative">
<h2>Best Practices</h2>

Expand Down

0 comments on commit d8e74ab

Please sign in to comment.