--- a/spec/latest/json-ld-api/index.html Tue Dec 04 21:43:52 2012 +0100
+++ b/spec/latest/json-ld-api/index.html Tue Dec 04 21:52:39 2012 +0100
@@ -1495,512 +1495,508 @@
</section>
-<section>
-<h2>RDF Conversion</h2>
-
-<p>A JSON-LD document MAY be converted between other RDF-compatible document
- formats using the algorithms specified in this section.</p>
-
-<p>The JSON-LD Processing Model describes processing rules for extracting RDF
- from a JSON-LD document, and for transforming an array of <a>Quad</a> retrieved by processing
- another serialization format into JSON-LD. Note that many uses of JSON-LD may not require
- generation of RDF.</p>
-
-<p>The processing algorithms described in this section are provided in
- order to demonstrate how one might implement a JSON-LD to RDF processor.
- Conformant implementations are only required to produce the same type and
- number of quads during the output process and are not required to
- implement the algorithm exactly as described.</p>
-
-<section class="informative">
- <h4>Overview</h4>
- <p>
- JSON-LD is intended to have an easy to parse grammar that closely models existing
- practice in using JSON for describing object representations. This allows the use
- of existing libraries for parsing JSON.
- </p>
- <p>
- As with other grammars used for describing <tref>Linked Data</tref>, a key
- concept is that of a <tref>node</tref> in a <tref>JSON-LD graph</tref>.
- Nodes may be of three basic types.
- The first is the <ldtref>IRI</ldtref>, which is used to refer to
- <tref title="node">nodes</tref> in other <tref title="JSON-LD graph">JSON-LD graphs</tref>.
- The second is the
- <tref>blank node</tref>, which are nodes for which an external name does not
- exist, or is not known. The third is a <tref>Literal</tref>, which express
- values such as strings, dates and other information having a lexical
- form, possibly including an explicit language or datatype.
- </p>
- <p>Data described with JSON-LD may be considered to be a graph made
- up of <tref>subject</tref> and <tref>object</tref>
- <tref title="node">nodes</tref> related via a <tref>property</tref>
- <tref>node</tref>. Specific implementations may also choose to operate
- on the document as a normal JSON description of objects having
- attributes. Both approaches are valid ways to interact with JSON-LD
- documents.</p>
-</section>
-
-<section class="informative">
- <h4>Parsing Examples</h4>
-
- <p>The following examples show simple transformations of JSON-LD documents to Turtle [[TURTLE-TR]].</p>
-
- <p>The first example uses a simple document containing a simple FOAF profile:</p>
-
-<pre class="example" data-transform="updateExample">
-<!--
-{
- "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
- "@id": "http://greggkellogg.net/foaf#me",
- "@type": "foaf:Person",
- "foaf:name": "Gregg Kellogg",
- "foaf:knows": {
- "@type": "foaf:Person",
- "foaf:name": "Manu Sporny"
- }
-}
--->
-</pre>
-
- <p>This translates fairly directly to a similar Turtle document:</p>
-
-<pre class="example" data-transform="updateExample">
-<!--
-@prefix foaf: <http://xmlns.com/foaf/0.1/>.
-
-<http://greggkellogg.net/foaf#me> a foaf:Person;
- foaf:name "Gregg Kellogg";
- foaf:knows [ a foaf:Person; foaf:name "Manu Sporny"].
--->
-</pre>
-
- <p>The actual parsing steps first require that the JSON-LD document be expanded,
- to eliminate the <code>@context</code>:</p>
+ <section>
+ <h2>RDF Conversion</h2>
-<pre class="example" data-transform="updateExample">
-<!--
-[{
- "@id": "http://greggkellogg.net/foaf#me",
- "@type": ["http://xmlns.com/foaf/0.1/Person"],
- "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
- "http://xmlns.com/foaf/0.1/knows": [{
- "@type": ["http://xmlns.com/foaf/0.1/Person"],
- "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
- }]
-}]
--->
-</pre>
-
- <p>The process of translating this to RDF then operates over each
- <tref>node object</tref> to find a subject,
- each <tref>property</tref> to find an <tref>RDF predicate</tref>,
- and each value of that property to find an <tref>object</tref>.
- In this case, each property has just a single object:
- <code>foaf:name</code> identifies a <tref>literal</tref>, and
- <code>foaf:knows</code> identifies a second <tref>node object</tref>
- similar to Turtle's <code>blankNodePropertyList</code>.</p>
-
- <p>After expansion, JSON-LD <tref title="number">numbers</tref>,
- <tref title="true">booleans</tref>, <tref title="typed literal">typed literals</tref>,
- <tref title="language-tagged string">language-tagged-strings</tref>,
- and <tref title="iri">IRIs</tref> become explicit, and can be directly
- transformed into their RDF representations.</p>
-
-<pre class="example" data-transform="updateExample">
-<!--
-[{
- "@id": "http://greggkellogg.net/foaf#me",
- "@type": ["http://xmlns.com/foaf/0.1/Person"],
- "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
- ****"http://xmlns.com/foaf/0.1/currentProject": [{"@id": "http://json-ld.org/"}],
- "http://xmlns.com/foaf/0.1/birthday": [{
- "@value": "1957-02-27",
- "@type": "http://www.w3.org/2001/XMLSchema#date"
- }],****
- "http://xmlns.com/foaf/0.1/knows": [{
- "@type": ["http://xmlns.com/foaf/0.1/Person"],
- "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
- }]
-}]
--->
-</pre>
-
- <p>Translates to:</p>
+ <p>A JSON-LD document MAY be converted between other RDF-compatible document
+ formats using the algorithms specified in this section.</p>
-<pre class="example" data-transform="updateExample">
-<!--
-@prefix foaf: <http://xmlns.com/foaf/0.1/>.
-@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
-
-<http://greggkellogg.net/foaf#me> a foaf:Person;
- foaf:name "Gregg Kellogg";
- ****foaf:currentProject <http://json-ld.org/>;
- foaf:birthday "1957-02-27"^^xsd:date;****
- foaf:knows [ a foaf:Person; foaf:name "Manu Sporny"].
--->
-</pre>
-
-</section>
-
-<section>
- <h3>Convert to RDF Algorithm</h3>
- <p>
- The algorithm below is designed for in-memory implementations with random access to <tref>JSON object</tref> elements.
- </p>
- <p>
- A conforming JSON-LD processor implementing RDF conversion MUST implement a
- processing algorithm that results in the same set of RDF <tref title="quad">Quads</tref> that the following
- algorithm generates:
- </p>
+ <p>The JSON-LD Processing Model describes processing rules for extracting RDF
+ from a JSON-LD document, and for transforming an array of <a>Quad</a> retrieved by processing
+ another serialization format into JSON-LD. Note that many uses of JSON-LD may not require
+ generation of RDF.</p>
- <p>The algorithm takes four input variables: a <em>element</em> to be converted, an
- <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>.
- To begin, the <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>
- are set to <tref>null</tref>, and <em>element</em> is
- set to the result of performing the <a href="#expansion-algorithm">Expansion Algorithm</a> on
- the <tref>JSON-LD input</tref> which is expected to be a a well-formed JSON-LD document as defined in [[!JSON-LD]].
- This removes any existing context to allow the given context to be cleanly applied.</p>
+ <p>The processing algorithms described in this section are provided in
+ order to demonstrate how one might implement a JSON-LD to RDF processor.
+ Conformant implementations are only required to produce the same type and
+ number of quads during the output process and are not required to
+ implement the algorithm exactly as described.</p>
- <ol class="algorithm">
- <li id="processing-step-associative">
- If <em>element</em> is a <tref>JSON object</tref>, perform the following steps:
+ <section class="informative">
+ <h4>Overview</h4>
+ <p>JSON-LD is intended to have an easy to parse grammar that closely models existing
+ practice in using JSON for describing object representations. This allows the use
+ of existing libraries for parsing JSON.</p>
+
+ <p>As with other grammars used for describing <tref>Linked Data</tref>, a key
+ concept is that of a <tref>node</tref> in a <tref>JSON-LD graph</tref>.
+ Nodes may be of three basic types. The first is the <ldtref>IRI</ldtref>,
+ which is used to refer to
+ <tref title="node">nodes</tref> in other <tref title="JSON-LD graph">JSON-LD graphs</tref>.
+ The second is the <tref>blank node</tref>, which are nodes for which an external name does not
+ exist, or is not known. The third is a <tref>Literal</tref>, which express
+ values such as strings, dates and other information having a lexical
+ form, possibly including an explicit language or datatype.</p>
+
+ <p>Data described with JSON-LD may be considered to be a graph made
+ up of <tref>subject</tref> and <tref>object</tref>
+ <tref title="node">nodes</tref> related via a <tref>property</tref>
+ <tref>node</tref>. Specific implementations may also choose to operate
+ on the document as a normal JSON description of objects having
+ attributes. Both approaches are valid ways to interact with JSON-LD
+ documents.</p>
+ </section>
+
+ <section class="informative">
+ <h4>Parsing Examples</h4>
+
+ <p>The following examples show simple transformations of JSON-LD documents to Turtle [[TURTLE-TR]].</p>
+
+ <p>The first example uses a simple document containing a simple FOAF profile:</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ {
+ "@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": "foaf:Person",
+ "foaf:name": "Gregg Kellogg",
+ "foaf:knows": {
+ "@type": "foaf:Person",
+ "foaf:name": "Manu Sporny"
+ }
+ }
+ -->
+ </pre>
+
+ <p>This translates fairly directly to a similar Turtle document:</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ @prefix foaf: <http://xmlns.com/foaf/0.1/>.
+
+ <http://greggkellogg.net/foaf#me> a foaf:Person;
+ foaf:name "Gregg Kellogg";
+ foaf:knows [ a foaf:Person; foaf:name "Manu Sporny"].
+ -->
+ </pre>
+
+ <p>The actual parsing steps first require that the JSON-LD document be expanded,
+ to eliminate the <code>@context</code>:</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ [{
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
+ "http://xmlns.com/foaf/0.1/knows": [{
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
+ }]
+ }]
+ -->
+ </pre>
+
+ <p>The process of translating this to RDF then operates over each
+ <tref>node object</tref> to find a subject,
+ each <tref>property</tref> to find an <tref>RDF predicate</tref>,
+ and each value of that property to find an <tref>object</tref>.
+ In this case, each property has just a single object:
+ <code>foaf:name</code> identifies a <tref>literal</tref>, and
+ <code>foaf:knows</code> identifies a second <tref>node object</tref>
+ similar to Turtle's <code>blankNodePropertyList</code>.</p>
+
+ <p>After expansion, JSON-LD <tref title="number">numbers</tref>,
+ <tref title="true">booleans</tref>, <tref title="typed literal">typed literals</tref>,
+ <tref title="language-tagged string">language-tagged-strings</tref>,
+ and <tref title="iri">IRIs</tref> become explicit, and can be directly
+ transformed into their RDF representations.</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ [{
+ "@id": "http://greggkellogg.net/foaf#me",
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
+ ****"http://xmlns.com/foaf/0.1/currentProject": [{"@id": "http://json-ld.org/"}],
+ "http://xmlns.com/foaf/0.1/birthday": [{
+ "@value": "1957-02-27",
+ "@type": "http://www.w3.org/2001/XMLSchema#date"
+ }],****
+ "http://xmlns.com/foaf/0.1/knows": [{
+ "@type": ["http://xmlns.com/foaf/0.1/Person"],
+ "http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
+ }]
+ }]
+ -->
+ </pre>
+
+ <p>Translates to:</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ @prefix foaf: <http://xmlns.com/foaf/0.1/>.
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
+
+ <http://greggkellogg.net/foaf#me> a foaf:Person;
+ foaf:name "Gregg Kellogg";
+ ****foaf:currentProject <http://json-ld.org/>;
+ foaf:birthday "1957-02-27"^^xsd:date;****
+ foaf:knows [ a foaf:Person; foaf:name "Manu Sporny"].
+ -->
+ </pre>
+
+ </section>
+
+ <section>
+ <h3>Convert to RDF Algorithm</h3>
+ <p>
+ The algorithm below is designed for in-memory implementations with random access to <tref>JSON object</tref> elements.
+ </p>
+ <p>
+ A conforming JSON-LD processor implementing RDF conversion MUST implement a
+ processing algorithm that results in the same set of RDF <tref title="quad">Quads</tref> that the following
+ algorithm generates:
+ </p>
+
+ <p>The algorithm takes four input variables: a <em>element</em> to be converted, an
+ <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>.
+ To begin, the <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>
+ are set to <tref>null</tref>, and <em>element</em> is
+ set to the result of performing the <a href="#expansion-algorithm">Expansion Algorithm</a> on
+ the <tref>JSON-LD input</tref> which is expected to be a a well-formed JSON-LD document as defined in [[!JSON-LD]].
+ This removes any existing context to allow the given context to be cleanly applied.</p>
+
<ol class="algorithm">
- <li>Set <tref>active object</tref> to <tref>null</tref>.</li>
- <li>
- If <em>element</em> has a <code>@value</code> property:
+ <li id="processing-step-associative">
+ If <em>element</em> is a <tref>JSON object</tref>, perform the following steps:
<ol class="algorithm">
- <li>If the value of <code>@value</code> is a <tref>number</tref>, set the
- <tref>active object</tref> to a <tref>typed literal</tref> using a <tref>canonical lexical form</tref>
- of the value as defined in the section <a href="#data-round-tripping">Data Round Tripping</a>.
- Set datatype to the value of the <code>@type</code> property if it exists, otherwise
- either <code>xsd:integer</code> or <code>xsd:double</code>, depending
- on if the value contains a fractional and/or an exponential component.</li>
- <li>Otherwise, if the value of <code>@value</code> is <strong>true</strong> or <strong>false</strong>,
- set the <tref>active object</tref> to a <tref>typed literal</tref> created from the
- <tref>canonical lexical form</tref> of the value. Set datatype to the value of the <code>@type</code>
- property if it exists, otherwise <code>xsd:boolean</code>.</li>
+ <li>Set <tref>active object</tref> to <tref>null</tref>.</li>
<li>
- Otherwise, if <em>element</em> contains a <code>@type</code> property, set the
- <tref>active object</tref> to a <tref>typed literal</tref>.
+ If <em>element</em> has a <code>@value</code> property:
+ <ol class="algorithm">
+ <li>If the value of <code>@value</code> is a <tref>number</tref>, set the
+ <tref>active object</tref> to a <tref>typed literal</tref> using a <tref>canonical lexical form</tref>
+ of the value as defined in the section <a href="#data-round-tripping">Data Round Tripping</a>.
+ Set datatype to the value of the <code>@type</code> property if it exists, otherwise
+ either <code>xsd:integer</code> or <code>xsd:double</code>, depending
+ on if the value contains a fractional and/or an exponential component.</li>
+ <li>Otherwise, if the value of <code>@value</code> is <strong>true</strong> or <strong>false</strong>,
+ set the <tref>active object</tref> to a <tref>typed literal</tref> created from the
+ <tref>canonical lexical form</tref> of the value. Set datatype to the value of the <code>@type</code>
+ property if it exists, otherwise <code>xsd:boolean</code>.</li>
+ <li>
+ Otherwise, if <em>element</em> contains a <code>@type</code> property, set the
+ <tref>active object</tref> to a <tref>typed literal</tref>.
+ </li>
+ <li>
+ Otherwise, if <em>element</em> contains a <code>@language</code> property, set the
+ <tref>active object</tref> to a <tref>language-tagged string</tref>.
+ </li>
+ <li>
+ Otherwise, set the <tref>active object</tref> to a <tref>typed literal</tref>
+ using <code>xsd:string</code> as the datatype.
+ </li>
+ </ol>
</li>
<li>
- Otherwise, if <em>element</em> contains a <code>@language</code> property, set the
- <tref>active object</tref> to a <tref>language-tagged string</tref>.
+ If <em>element</em> has a <code>@list</code> property the value MUST be an <tref>array</tref>.
+ Process its value as a list as described in <a href="#list-conversion">List Conversion</a> using
+ the return value as the <tref>active object</tref>
+ </li>
+ <li>If <tref>active object</tref> is not <tref>null</tref>:
+ <ol class="algorithm">
+ <li>If neither <tref>active subject</tref> nor <tref>active property</tref> are <tref>null</tref>,
+ generate a <a>Quad</a>
+ representing <tref>active subject</tref>, <tref>active property</tref>,
+ <tref>active object</tref>, and <tref>graph name</tref>.</li>
+ <li>Return <tref>active object</tref>.</li>
+ </ol>
+ </li>
+ <li id="processing-step-subject">If <em>element</em> has a <code>@id</code> property,
+ the value MUST be a <tref>string</tref>, set the <tref>active subject</tref> to the previously
+ <tref>expanded value</tref> (either a <tref>blank node</tref> or an <ldtref>IRI</ldtref>).</li>
+ <li>
+ Otherwise, if <em>element</em> does not have a <code>@id</code> property, set the <tref>active
+ subject</tref> to newly generated <tref>blank node</tref>.</li>
+ <li>
+ Process each <em>property</em> and <em>value</em> in <em>element</em>, ordered by
+ <em>property</em>, as follows:
+ <ol class="algorithm">
+ <li>
+ If <em>property</em> is <code>@type</code>, set the <tref>active property</tref>
+ to <code>rdf:type</code>.
+ </li>
+ <li>Otherwise, if <em>property</em> is <code>@graph</code>,
+ process <em>value</em> algorithm recursively, using <tref>active subject</tref> as <tref>graph name</tref>
+ and null values for <tref>active subject</tref> and <tref>active property</tref> and then
+ proceed to next property.</li>
+ <li>Otherwise, if <em>property</em> is a <tref>keyword</tref>, skip this step.</li>
+ <li>Otherwise, set <tref>active property</tref> to the <tref>expanded IRI form</tref> of <em>property</em>.</li>
+ <li>Process <em>value</em> recursively using this algorithm, passing copies of
+ <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>.
+ </li>
+ </ol>
</li>
<li>
- Otherwise, set the <tref>active object</tref> to a <tref>typed literal</tref>
- using <code>xsd:string</code> as the datatype.
+ Set <tref>active object</tref> to <tref>active subject</tref>.
</li>
</ol>
</li>
- <li>
- If <em>element</em> has a <code>@list</code> property the value MUST be an <tref>array</tref>.
- Process its value as a list as described in <a href="#list-conversion">List Conversion</a> using
- the return value as the <tref>active object</tref>
+
+ <li>Otherwise, if <em>element</em> is an <tref>array</tref>, process each value in the <tref>array</tref>
+ as follows, process <em>element</em> recursively using this algorithm, using copies of
+ <tref>active subject</tref>, <tref>active property</tref>, and <tref>graph name</tref>.</li>
+
+ <li>Otherwise, if <em>element</em> is a <tref>string</tref>, then the <tref>active property</tref>
+ must be <code>rdf:type</code> so set the <tref>active object</tref> to an <ldtref>IRI</ldtref>.</li>
+
+ <li>If any of these steps created an <tref>active object</tref> and neither <tref>active subject</tref>
+ nor <tref>active property</tref> are <tref>null</tref>, generate a <a>Quad</a> using
+ <tref>active subject</tref>,<tref>active property</tref>, <tref>active object</tref> and
+ <tref>graph name</tref>.
</li>
- <li>If <tref>active object</tref> is not <tref>null</tref>:
- <ol class="algorithm">
- <li>If neither <tref>active subject</tref> nor <tref>active property</tref> are <tref>null</tref>,
- generate a <a>Quad</a>
- representing <tref>active subject</tref>, <tref>active property</tref>,
- <tref>active object</tref>, and <tref>graph name</tref>.</li>
- <li>Return <tref>active object</tref>.</li>
- </ol>
- </li>
- <li id="processing-step-subject">If <em>element</em> has a <code>@id</code> property,
- the value MUST be a <tref>string</tref>, set the <tref>active subject</tref> to the previously
- <tref>expanded value</tref> (either a <tref>blank node</tref> or an <ldtref>IRI</ldtref>).</li>
+ <li>Return <tref>active object</tref>.</li>
+ </ol>
+ </section>
+
+ <section id="list-conversion">
+ <h3>List Conversion</h3>
+
+ <p>List Conversion is the process of taking an <tref>array</tref> of values and adding them to a newly
+ created <cite><a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab">RDF Collection</a></cite> (see
+ [[!RDF-SCHEMA]]) by linking each element of the list using <code>rdf:first</code> and <code>rdf:next</code>,
+ terminating the list with <code>rdf:nil</code> using the following sequence:</p>
+ <p>The algorithm is invoked with an <tref>array</tref> <em>array</em>, the <tref>active property</tref>
+ and returns a value to be used as an <tref>active object</tref> in the calling location.</p>
+ <div class="note">This algorithm does not support lists containing lists.</div>
+ <ol class="algorithm">
<li>
- Otherwise, if <em>element</em> does not have a <code>@id</code> property, set the <tref>active
- subject</tref> to newly generated <tref>blank node</tref>.</li>
- <li>
- Process each <em>property</em> and <em>value</em> in <em>element</em>, ordered by
- <em>property</em>, as follows:
- <ol class="algorithm">
- <li>
- If <em>property</em> is <code>@type</code>, set the <tref>active property</tref>
- to <code>rdf:type</code>.
- </li>
- <li>Otherwise, if <em>property</em> is <code>@graph</code>,
- process <em>value</em> algorithm recursively, using <tref>active subject</tref> as <tref>graph name</tref>
- and null values for <tref>active subject</tref> and <tref>active property</tref> and then
- proceed to next property.</li>
- <li>Otherwise, if <em>property</em> is a <tref>keyword</tref>, skip this step.</li>
- <li>Otherwise, set <tref>active property</tref> to the <tref>expanded IRI form</tref> of <em>property</em>.</li>
- <li>Process <em>value</em> recursively using this algorithm, passing copies of
- <tref>active subject</tref>, <tref>active property</tref> and <tref>graph name</tref>.
- </li>
- </ol>
+ If <em>array</em> is empty return <code>rdf:nil</code>.
</li>
<li>
- Set <tref>active object</tref> to <tref>active subject</tref>.
- </li>
- </ol>
- </li>
-
- <li>Otherwise, if <em>element</em> is an <tref>array</tref>, process each value in the <tref>array</tref>
- as follows, process <em>element</em> recursively using this algorithm, using copies of
- <tref>active subject</tref>, <tref>active property</tref>, and <tref>graph name</tref>.</li>
-
- <li>Otherwise, if <em>element</em> is a <tref>string</tref>, then the <tref>active property</tref>
- must be <code>rdf:type</code> so set the <tref>active object</tref> to an <ldtref>IRI</ldtref>.</li>
-
- <li>If any of these steps created an <tref>active object</tref> and neither <tref>active subject</tref>
- nor <tref>active property</tref> are <tref>null</tref>, generate a <a>Quad</a> using
- <tref>active subject</tref>,<tref>active property</tref>, <tref>active object</tref> and
- <tref>graph name</tref>.
- </li>
- <li>Return <tref>active object</tref>.</li>
- </ol>
-</section>
-<section id="list-conversion">
- <h3>List Conversion</h3>
-
- <p>List Conversion is the process of taking an <tref>array</tref> of values and adding them to a newly
- created <cite><a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab">RDF Collection</a></cite> (see
- [[!RDF-SCHEMA]]) by linking each element of the list using <code>rdf:first</code> and <code>rdf:next</code>,
- terminating the list with <code>rdf:nil</code> using the following sequence:</p>
- <p>The algorithm is invoked with an <tref>array</tref> <em>array</em>, the <tref>active property</tref>
- and returns a value to be used as an <tref>active object</tref> in the calling location.</p>
- <div class="note">This algorithm does not support lists containing lists.</div>
- <ol class="algorithm">
- <li>
- If <em>array</em> is empty return <code>rdf:nil</code>.
- </li>
- <li>
- Otherwise, generate a <a>Quad</a> using using the <tref>active subject</tref>, <tref>active property</tref>
- and a newly generated <tref>blank node</tref> identified as <em>first <tref>blank node</tref></em>.
- </li>
- <li>
- For each element in <em>array</em> other than the last element:
- <ol class="algorithm">
- <li>Create a processor state using
- <em>first blank node</em> as the <tref>active subject</tref>, and
- <code>rdf:first</code> as the <tref>active property</tref>.
- <ol class="algorithm">
- <li>Process the value starting at <a href="#processing-step-associative">Step 1</a>.</li>
- <li>Proceed using the previous <tref>processor state</tref>.</li>
- </ol>
+ Otherwise, generate a <a>Quad</a> using using the <tref>active subject</tref>, <tref>active property</tref>
+ and a newly generated <tref>blank node</tref> identified as <em>first <tref>blank node</tref></em>.
</li>
- <li>Unless this is the last element in <em>array</em>, generate a new <tref>blank node</tref> identified as
- <em>rest blank node</em>, otherwise use <code>rdf:nil</code>.</li>
- <li>Generate a new <a>Quad</a> using <em>first blank node</em>,
- <code>rdf:rest</code> and <em>rest blank node</em>.</li>
- <li>Set <em>first blank node</em> to
- <em>rest blank node</em>.</li>
- <li>Return <em>first blank node</em>.</li>
- </ol>
- </li>
- </ol>
-</section>
-
-<section>
- <h2>Convert from RDF Algorithm</h2>
- <p>In some cases, data exists natively in Triples or Quads form; for example, if the data was originally
- represented in an RDF graph or triple/quad store. This algorithm is designed to simply translate
- an array of <ldtref title="Quad">Quads</ldtref> into a JSON-LD document.</p>
- <p>When expanding <tref>typed literal</tref> values having a datatype of <code>xsd:string</code>,
- the <code>@type</code> MUST NOT be set to <code>xsd:string</code> and the resulting value
- MUST have only a <code>@value</code> property.</p>
-
- <p>The conversion algorithm takes a single parameter <em>input</em> in the form of an
- array of <a>Quad</a> representations.</p>
-
- <ol class="algorithm">
- <li id="new_graph">Construct <em>defaultGraph</em> as a <tref>JSON object</tref>
- containing <em>nodes</em> and <em>listMap</em>, each an empty <tref>JSON object</tref>.</li>
- <li>Construct <em>graphs</em> as a <tref>JSON object</tref> containing <em>defaultGraph</em>
- identified by
- an empty <tref>string</tref>.</li>
- <li>For each quad in <em>input</em>:
- <ol class="algorithm">
- <li>Set <em>graph</em> to the entry in <em>graphs</em> identified
- by <em>name</em>, initializing it to a new entry using the mechanism
- described in <a href="#new_graph">Step 1</a>.</li>
- <li>If <em>property</em> is <code>rdf:first</code>,
- use the entry in <em>graph.listMap</em> indexed by <em>subject</em>,
- initializing it to a new <tref>JSON object</tref> if nesessary. Represent
- <em>object</em> in <tref>expanded form</tref>, as described in
- <a href="#value-expansion">Value Expansion</a>. Add the
- resulting <em>object representation</em> to the entry indexed by
- <em>first</em>, and skip to the next quad.</li>
- <li>If <em>property</em> is <code>rdf:rest</code>:
+ <li>
+ For each element in <em>array</em> other than the last element:
<ol class="algorithm">
- <li>If <em>object</em> is a <tref>blank node</tref>, use the entry in
- <em>graph.listMap</em> indexed by <em>subject</em>, initializing it
- to a new <tref>JSON object</tref> if necessary. Add the <em>nominalValue</em> of
- <em>object</em> to the entry indexed by <em>rest</em>.
- </li>
- <li>Skip to the next quad.</li>
- </ol>
- </li>
- <li>If <em>name</em> is not <tref>null</tref>, and <em>defaultGraph.nodes</em>
- does not contain an entry for <em>name</em>,
- create a new entry for <em>name</em> from a new
- <tref>JSON object</tref> with key/value pair of <code>@id</code> and
- <em>name</em> represented in <tref>expanded IRI form</tref>.</li>
- <li>Set <em>value</em> as the entry from <em>graph.nodes</em> for
- <em>subject</em>, initializing it to a new
- <tref>JSON object</tref> with key/value pair of <code>@id</code> and
- <em>subject</em> represented in <tref>expanded IRI form</tref> if necessary.</li>
- <li>If <em>property</em> is <code>rdf:type</code>, <em>object</em> is not a <tref>literal</tref>, and the
- <code class="idlMemberName"><a href="#widl-JsonLdOptions-useRdfType">useRdfType</a></code>
- option is not present or <tref>false</tref>:
- <ol class="algorithm">
- <li>Append <em>object</em> represented in <tref>expanded IRI form</tref> to the array value for the
- key <code>@type</code>, creating an entry in <em>value</em> if necessary.</li>
- </ol>
- </li>
-
- <li>Otherwise, if <em>object</em> is a <tref>typed literal</tref> and the
- <code class="idlMemberName"><a href="#widl-JsonLdOptions-useNativeTypes">useNativeTypes</a></code>
- option is set to <tref>true</tref>:
- <ol class="algorithm">
- <li>Generate a <em>converted value</em>:
+ <li>Create a processor state using
+ <em>first blank node</em> as the <tref>active subject</tref>, and
+ <code>rdf:first</code> as the <tref>active property</tref>.
<ol class="algorithm">
- <li>If the literal's type is <code>xsd:boolean</code>, the
- <em>converted value</em> is <tref>true</tref> if the literal
- matches the value <code>true</code> or <code>false</code> if
- the literal matches the value <code>false</code>.</li>
- <li>If the literal's type is <code>xsd:integer</code> or
- <code>xsd:double</code>, try to convert the literal to a
- JSON <tref>number</tref>. If the conversion is successful,
- store the result in <em>converted value</em>, otherwise
- set <em>converted value</em> to <em>value</em>.</li>
- <li>Otherwise, do not perform a conversion. Set
- the <em>converted value</em> to the <em>value</em>.</li>
+ <li>Process the value starting at <a href="#processing-step-associative">Step 1</a>.</li>
+ <li>Proceed using the previous <tref>processor state</tref>.</li>
</ol>
</li>
- <li>Append the <em>converted value</em> to the array value for the
- key, creating an entry in <em>value</em> if necessary.</li>
- </ol>
- </li>
-
- <li>Otherwise, if <em>object</em> is <code>rdf:nil</code>:
- <ol class="algorithm">
- <li>Let <em>key</em> be <em>property</em> expressed in <tref>expanded IRI form</tref>.</li>
- <li>Append an empty <code>@list</code> representation to the array value for
- <em>key</em>, creating an entry in <em>value</em> if necessary.</li>
- </ol>
- </li>
- <li>Otherwise,
- <ol class="algorithm">
- <li>Let <em>key</em> be <em>property</em> expressed in <tref>expanded IRI form</tref> and let
- <em>object representation</em>
- be <em>object</em> represented in <tref>expanded form</tref> as described in
- <a href="#value-expansion">Value Expansion</a>.</li>
- <li>If <em>object</em> is a <tref>blank node</tref>,
- use the entry in <em>graph.listMap</em> indexed by <em>object</em>,
- initializing it to a new <tref>JSON object</tref> if nesessary.
- Add an entry for <em>head</em> with <em>object representation</em>.</li>
- <li>Append <em>object representation</em> to the array value for
- <em>key</em>, creating an entry in <em>value</em> if necessary.</li>
+ <li>Unless this is the last element in <em>array</em>, generate a new <tref>blank node</tref> identified as
+ <em>rest blank node</em>, otherwise use <code>rdf:nil</code>.</li>
+ <li>Generate a new <a>Quad</a> using <em>first blank node</em>,
+ <code>rdf:rest</code> and <em>rest blank node</em>.</li>
+ <li>Set <em>first blank node</em> to
+ <em>rest blank node</em>.</li>
+ <li>Return <em>first blank node</em>.</li>
</ol>
</li>
</ol>
- </li>
- <li>For each <em>name</em> and <em>graph</em> in <em>graphs</em>:
+ </section>
+
+ <section>
+ <h2>Convert from RDF Algorithm</h2>
+ <p>In some cases, data exists natively in Triples or Quads form; for example, if the data was originally
+ represented in an RDF graph or triple/quad store. This algorithm is designed to simply translate
+ an array of <ldtref title="Quad">Quads</ldtref> into a JSON-LD document.</p>
+ <p>When expanding <tref>typed literal</tref> values having a datatype of <code>xsd:string</code>,
+ the <code>@type</code> MUST NOT be set to <code>xsd:string</code> and the resulting value
+ MUST have only a <code>@value</code> property.</p>
+
+ <p>The conversion algorithm takes a single parameter <em>input</em> in the form of an
+ array of <a>Quad</a> representations.</p>
+
<ol class="algorithm">
- <li>For each <em>subject</em> and <em>entry</em> in <em>graph</em>
- where <em>entry</em> has both <em>head</em> and <em>first</em> keys:
+ <li id="new_graph">Construct <em>defaultGraph</em> as a <tref>JSON object</tref>
+ containing <em>nodes</em> and <em>listMap</em>, each an empty <tref>JSON object</tref>.</li>
+ <li>Construct <em>graphs</em> as a <tref>JSON object</tref> containing <em>defaultGraph</em>
+ identified by
+ an empty <tref>string</tref>.</li>
+ <li>For each quad in <em>input</em>:
<ol class="algorithm">
- <li>Set <em>value</em> to the value of <em>head</em> in <em>entry</em>.</li>
- <li>Remove the entry for <code>@id</code> in <em>value</em>.</li>
- <li>Add an entry to <em>value</em> for <code>@list</code> initialized to a new array
- containing the value of <em>first</em> from <em>entry</em>.</li>
- <li>While <em>entry</em> has a key for <em>rest</em>:
+ <li>Set <em>graph</em> to the entry in <em>graphs</em> identified
+ by <em>name</em>, initializing it to a new entry using the mechanism
+ described in <a href="#new_graph">Step 1</a>.</li>
+ <li>If <em>property</em> is <code>rdf:first</code>,
+ use the entry in <em>graph.listMap</em> indexed by <em>subject</em>,
+ initializing it to a new <tref>JSON object</tref> if nesessary. Represent
+ <em>object</em> in <tref>expanded form</tref>, as described in
+ <a href="#value-expansion">Value Expansion</a>. Add the
+ resulting <em>object representation</em> to the entry indexed by
+ <em>first</em>, and skip to the next quad.</li>
+ <li>If <em>property</em> is <code>rdf:rest</code>:
<ol class="algorithm">
- <li>Set <em>entry</em> to the value of <em>graph.listMap</em> for <em>entry.rest</em>.</li>
- <li>Add the value for <em>entry.first</em> to the list array.</li>
+ <li>If <em>object</em> is a <tref>blank node</tref>, use the entry in
+ <em>graph.listMap</em> indexed by <em>subject</em>, initializing it
+ to a new <tref>JSON object</tref> if necessary. Add the <em>nominalValue</em> of
+ <em>object</em> to the entry indexed by <em>rest</em>.
+ </li>
+ <li>Skip to the next quad.</li>
+ </ol>
+ </li>
+ <li>If <em>name</em> is not <tref>null</tref>, and <em>defaultGraph.nodes</em>
+ does not contain an entry for <em>name</em>,
+ create a new entry for <em>name</em> from a new
+ <tref>JSON object</tref> with key/value pair of <code>@id</code> and
+ <em>name</em> represented in <tref>expanded IRI form</tref>.</li>
+ <li>Set <em>value</em> as the entry from <em>graph.nodes</em> for
+ <em>subject</em>, initializing it to a new
+ <tref>JSON object</tref> with key/value pair of <code>@id</code> and
+ <em>subject</em> represented in <tref>expanded IRI form</tref> if necessary.</li>
+ <li>If <em>property</em> is <code>rdf:type</code>, <em>object</em> is not a <tref>literal</tref>, and the
+ <code class="idlMemberName"><a href="#widl-JsonLdOptions-useRdfType">useRdfType</a></code>
+ option is not present or <tref>false</tref>:
+ <ol class="algorithm">
+ <li>Append <em>object</em> represented in <tref>expanded IRI form</tref> to the array value for the
+ key <code>@type</code>, creating an entry in <em>value</em> if necessary.</li>
+ </ol>
+ </li>
+
+ <li>Otherwise, if <em>object</em> is a <tref>typed literal</tref> and the
+ <code class="idlMemberName"><a href="#widl-JsonLdOptions-useNativeTypes">useNativeTypes</a></code>
+ option is set to <tref>true</tref>:
+ <ol class="algorithm">
+ <li>Generate a <em>converted value</em>:
+ <ol class="algorithm">
+ <li>If the literal's type is <code>xsd:boolean</code>, the
+ <em>converted value</em> is <tref>true</tref> if the literal
+ matches the value <code>true</code> or <code>false</code> if
+ the literal matches the value <code>false</code>.</li>
+ <li>If the literal's type is <code>xsd:integer</code> or
+ <code>xsd:double</code>, try to convert the literal to a
+ JSON <tref>number</tref>. If the conversion is successful,
+ store the result in <em>converted value</em>, otherwise
+ set <em>converted value</em> to <em>value</em>.</li>
+ <li>Otherwise, do not perform a conversion. Set
+ the <em>converted value</em> to the <em>value</em>.</li>
+ </ol>
+ </li>
+ <li>Append the <em>converted value</em> to the array value for the
+ key, creating an entry in <em>value</em> if necessary.</li>
+ </ol>
+ </li>
+
+ <li>Otherwise, if <em>object</em> is <code>rdf:nil</code>:
+ <ol class="algorithm">
+ <li>Let <em>key</em> be <em>property</em> expressed in <tref>expanded IRI form</tref>.</li>
+ <li>Append an empty <code>@list</code> representation to the array value for
+ <em>key</em>, creating an entry in <em>value</em> if necessary.</li>
+ </ol>
+ </li>
+ <li>Otherwise,
+ <ol class="algorithm">
+ <li>Let <em>key</em> be <em>property</em> expressed in <tref>expanded IRI form</tref> and let
+ <em>object representation</em>
+ be <em>object</em> represented in <tref>expanded form</tref> as described in
+ <a href="#value-expansion">Value Expansion</a>.</li>
+ <li>If <em>object</em> is a <tref>blank node</tref>,
+ use the entry in <em>graph.listMap</em> indexed by <em>object</em>,
+ initializing it to a new <tref>JSON object</tref> if nesessary.
+ Add an entry for <em>head</em> with <em>object representation</em>.</li>
+ <li>Append <em>object representation</em> to the array value for
+ <em>key</em>, creating an entry in <em>value</em> if necessary.</li>
</ol>
</li>
</ol>
</li>
- </ol>
- </li>
- <li>Create <em>array</em> as an empty <tref>array</tref>.</li>
- <li>For each <em>subject</em> and <em>entry</em> in <em>defaultGraph.nodes</em>
- ordered by <em>subject</em>:
- <ol class="algorithm">
- <li>Add <em>entry</em> to <em>array</em>.</li>
- <li>If <em>graphs</em> has an entry for <em>subject</em>, add a property
- <code>@graph</code> in <em>entry</em> containing the ordered entries
- from <em>graphs[subject].nodes</em>.</li>
+ <li>For each <em>name</em> and <em>graph</em> in <em>graphs</em>:
+ <ol class="algorithm">
+ <li>For each <em>subject</em> and <em>entry</em> in <em>graph</em>
+ where <em>entry</em> has both <em>head</em> and <em>first</em> keys:
+ <ol class="algorithm">
+ <li>Set <em>value</em> to the value of <em>head</em> in <em>entry</em>.</li>
+ <li>Remove the entry for <code>@id</code> in <em>value</em>.</li>
+ <li>Add an entry to <em>value</em> for <code>@list</code> initialized to a new array
+ containing the value of <em>first</em> from <em>entry</em>.</li>
+ <li>While <em>entry</em> has a key for <em>rest</em>:
+ <ol class="algorithm">
+ <li>Set <em>entry</em> to the value of <em>graph.listMap</em> for <em>entry.rest</em>.</li>
+ <li>Add the value for <em>entry.first</em> to the list array.</li>
+ </ol>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ </li>
+ <li>Create <em>array</em> as an empty <tref>array</tref>.</li>
+ <li>For each <em>subject</em> and <em>entry</em> in <em>defaultGraph.nodes</em>
+ ordered by <em>subject</em>:
+ <ol class="algorithm">
+ <li>Add <em>entry</em> to <em>array</em>.</li>
+ <li>If <em>graphs</em> has an entry for <em>subject</em>, add a property
+ <code>@graph</code> in <em>entry</em> containing the ordered entries
+ from <em>graphs[subject].nodes</em>.</li>
+ </ol>
+ </li>
+ <li>Return <em>array</em> as the result.</li>
</ol>
- </li>
- <li>Return <em>array</em> as the result.</li>
- </ol>
-</section>
-</section>
-
-</section>
-
-<section>
-<h3>Data Round Tripping</h3>
-
-<p>When <a href="#rdf-conversion">converting JSON-LD to RDF</a> JSON-native types such as
- <em>numbers</em> and <em>booleans</em> are automatically coerced to <strong>xsd:integer</strong>,
- <strong>xsd:double</strong>, or <strong>xsd:boolean</strong>. Implementers MUST ensure that the
- result is in <tref>canonical lexical form</tref>. A
- <tdef>canonical lexical form</tdef> is a set of literals from among the valid set of literals for
- a datatype such that there is a one-to-one mapping between the <tref>canonical lexical form</tref> and a value
- in the value space as defined in [[!XMLSCHEMA11-2]]. In other words, every value MUST be converted
- to a deterministic <tref>string</tref> representation.</p>
-
-<p>The canonical lexical form of an <em>integer</em>, i.e., a number without fractions
- or a number coerced to <strong>xsd:integer</strong>, is a finite-length sequence of decimal
- digits (<code>0-9</code>) with an optional leading minus sign; leading zeroes are prohibited.
- To convert the number in JavaScript, implementers can use the following snippet of code:</p>
-
-<pre class="example" data-transform="updateExample">
-<!--
-(value).toFixed(0).toString()
--->
-</pre>
+ </section>
-<p>The canonical lexical form of a <em>double</em>, i.e., a number with fractions
- or a number coerced to <strong>xsd:double</strong>, consists of a mantissa followed by the
- character "E", followed by an exponent. The mantissa MUST be a decimal number. The exponent
- MUST be an integer. Leading zeroes and a preceding plus sign (<code>+</code>) are prohibited
- in the exponent. If the exponent is zero, it must be indicated by <code>E0</code>.
- For the mantissa, the preceding optional plus sign is prohibited and the decimal point is
- required. Leading and trailing zeroes are prohibited subject to the following: number
- representations must be normalized such that there is a single digit which is non-zero to the
- 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 <code>0.0E0</code>.
- <strong>xsd:double</strong>'s value space is defined by the IEEE double-precision 64-bit
- floating point type [[!IEEE-754-1985]]; in JSON-LD the mantissa is rounded to 15 digits after the
- decimal point.</p>
-
-<p>To convert the number in JavaScript, implementers can use the following snippet of code:</p>
+ <section>
+ <h3>Data Round Tripping</h3>
-<pre class="example" data-transform="updateExample">
-<!--
-(value).toExponential(15).replace(/(\d)0*e\+?/,'$1E')
--->
-</pre>
-
-<p class="note">When data such as decimals need to be normalized, JSON-LD authors should
- not use values that are going to undergo automatic conversion. This is due to the lossy nature
- of <strong>xsd:double</strong> values. Authors should instead use the expanded object form to
- set the canonical lexical form directly.</p>
+ <p>When <a href="#rdf-conversion">converting JSON-LD to RDF</a> JSON-native types such as
+ <em>numbers</em> and <em>booleans</em> are automatically coerced to <strong>xsd:integer</strong>,
+ <strong>xsd:double</strong>, or <strong>xsd:boolean</strong>. Implementers MUST ensure that the
+ result is in <tref>canonical lexical form</tref>. A
+ <tdef>canonical lexical form</tdef> is a set of literals from among the valid set of literals for
+ a datatype such that there is a one-to-one mapping between the <tref>canonical lexical form</tref> and a value
+ in the value space as defined in [[!XMLSCHEMA11-2]]. In other words, every value MUST be converted
+ to a deterministic <tref>string</tref> representation.</p>
-<p>The canonical lexical form of the <em>boolean</em> values <code>true</code> and <code>false</code>
- are the strings <strong>true</strong> and <strong>false</strong>.</p>
+ <p>The canonical lexical form of an <em>integer</em>, i.e., a number without fractions
+ or a number coerced to <strong>xsd:integer</strong>, is a finite-length sequence of decimal
+ digits (<code>0-9</code>) with an optional leading minus sign; leading zeroes are prohibited.
+ To convert the number in JavaScript, implementers can use the following snippet of code:</p>
-<p>When JSON-native <tref>number</tref>s, are type coerced, lossless data round-tripping can not
- be guaranted as rounding errors might occur. Additionally, only literals typed as
- <strong>xsd:integer</strong>, <strong>xsd:double</strong>, and <strong>xsd:boolean</strong> are
- automatically converted back to their JSON-native counterparts in when
- <a href="#rdf-conversion">converting from RDF</a>.</p>
+ <pre class="example" data-transform="updateExample">
+ <!--
+ (value).toFixed(0).toString()
+ -->
+ </pre>
-<p>Some JSON serializers, such as PHP's native implementation in some versions,
- backslash-escape the forward slash character. For example, the value
- <code>http://example.com/</code> would be serialized as <code>http:\/\/example.com\/</code>.
- 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, a JSON-LD serializer MUST NOT backslash-escape forward slashes.</p>
+ <p>The canonical lexical form of a <em>double</em>, i.e., a number with fractions
+ or a number coerced to <strong>xsd:double</strong>, consists of a mantissa followed by the
+ character "E", followed by an exponent. The mantissa MUST be a decimal number. The exponent
+ MUST be an integer. Leading zeroes and a preceding plus sign (<code>+</code>) are prohibited
+ in the exponent. If the exponent is zero, it must be indicated by <code>E0</code>.
+ For the mantissa, the preceding optional plus sign is prohibited and the decimal point is
+ required. Leading and trailing zeroes are prohibited subject to the following: number
+ representations must be normalized such that there is a single digit which is non-zero to the
+ 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 <code>0.0E0</code>.
+ <strong>xsd:double</strong>'s value space is defined by the IEEE double-precision 64-bit
+ floating point type [[!IEEE-754-1985]]; in JSON-LD the mantissa is rounded to 15 digits after the
+ decimal point.</p>
+ <p>To convert the number in JavaScript, implementers can use the following snippet of code:</p>
+
+ <pre class="example" data-transform="updateExample">
+ <!--
+ (value).toExponential(15).replace(/(\d)0*e\+?/,'$1E')
+ -->
+ </pre>
+
+ <p class="note">When data such as decimals need to be normalized, JSON-LD authors should
+ not use values that are going to undergo automatic conversion. This is due to the lossy nature
+ of <strong>xsd:double</strong> values. Authors should instead use the expanded object form to
+ set the canonical lexical form directly.</p>
+
+ <p>The canonical lexical form of the <em>boolean</em> values <code>true</code> and <code>false</code>
+ are the strings <strong>true</strong> and <strong>false</strong>.</p>
+
+ <p>When JSON-native <tref>number</tref>s, are type coerced, lossless data round-tripping can not
+ be guaranted as rounding errors might occur. Additionally, only literals typed as
+ <strong>xsd:integer</strong>, <strong>xsd:double</strong>, and <strong>xsd:boolean</strong> are
+ automatically converted back to their JSON-native counterparts in when
+ <a href="#rdf-conversion">converting from RDF</a>.</p>
+
+ <p>Some JSON serializers, such as PHP's native implementation in some versions,
+ backslash-escape the forward slash character. For example, the value
+ <code>http://example.com/</code> would be serialized as <code>http:\/\/example.com\/</code>.
+ 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, a JSON-LD serializer MUST NOT backslash-escape forward slashes.</p>
+ </section>
+ </section>
</section>
<section>