--- a/spec/latest/json-ld-api/index.html Wed Apr 11 14:46:45 2012 -0700
+++ b/spec/latest/json-ld-api/index.html Wed Apr 11 16:03:53 2012 -0700
@@ -1841,9 +1841,10 @@
<section>
<h4>RDF Conversion Algorithm Terms</h4>
<dl>
- <dt><tdef>default graph</tdef></dt>
+ <dt><tdef>graph name</tdef></dt>
<dd>
- the destination graph for all <a>Statement</a>s (triples or quads) generated by JSON-LD markup.
+ A <tref>IRI</tref> or <tref>Blank Node</tref> used to identify statements belonging to a
+ <em>named graph</em>.
</dd>
</dl>
</section>
@@ -1855,127 +1856,102 @@
</p>
<p>
A conforming JSON-LD processor implementing RDF conversion MUST implement a
- processing algorithm that results in the same <tref>default graph</tref> that the following
+ processing algorithm that results in the same set of RDF <a>Statement</a>s that the following
algorithm generates:
</p>
- <p>The algorithm takes four input variables: a <em>value</em> to be converted, an
- <tref>active subject</tref> and an <tref>active property</tref>.
- To begin, the <tref>active subject</tref> and <tref>active property</tref> are set to <tref>null</tref>, and <em>value</em> is
+ <p>The algorithm takes five 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>. This removes any existing context to allow the given context to be cleanly
applied.</p>
<ol class="algorithm">
<li id="processing-step-associative">
- If <em>value</em> is a <tref>JSON object</tref>, perform the following steps:
+ If <em>element</em> is a <tref>JSON object</tref>, perform the following steps:
<ol class="algorithm">
<li>Set <tref>active object</tref> to <tref>null</tref>.</li>
<li>
- If the <tref>JSON object</tref> has a <code>@value</code> key, set the <tref>active object</tref>
+ If <em>element</em> has a <code>@value</code> property, set the <tref>active object</tref>
to a literal value as follows:
<ol class="algorithm">
<li>
- as a <tref>typed literal</tref> if the <tref>JSON object</tref> contains a <code>@type</code> key
+ As a <tref>typed literal</tref> if <em>element</em> contains a <code>@type</code> property
after performing <a href="#iri-expansion">IRI Expansion</a> on the specified <code>@type</code>.
</li>
<li>
- otherwise, as a <tref>plain literal</tref>. If the <tref>JSON object</tref> contains
- a <code>@language</code> key, use it's value to set the language of the plain literal.
- </li>
- </ol>
- </li>
- <li>
- If the <tref>JSON object</tref> has a <code>@list</code> key the value MUST be an <tref>array</tref>.
- Process the 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 nether <tref>active subject</tref> nor <tref>active property</tref> are <tref>null</tref>, generate a <a>Statement</a>
- representing the <tref>active subject</tref>, the <tref>active property</tref> and the
- <tref>active object</tref>.</li>
- <li>Return the <tref>active object</tref> to the calling location.</li>
- </ol>
- </li>
- <li id="processing-step-subject">If the <tref>JSON object</tref> has a <code>@id</code> key:
- <ol class="algorithm">
- <li>
- If the value is a <tref>string</tref>, set the <tref>active subject</tref> to the previously
- expanded value (either a <tref>blank node</tref> or an <tref>IRI</tref>).</li>
- <li>Otherwise,
- Generate a create a new <tref>processor state</tref> copies of the <tref>active subject</tref>
- and <tref>active property</tref>.
- <ol class="algorithm">
- <li>
- Process the value starting at
- <a href="#processing-step-associative">Step 1</a> using the returned value as
- <tref>active subject</tref>.
- </li>
- <li>Proceed using the previous <tref>processor state</tref>.</li>
- </ol>
+ Otherwise, as a <tref>plain literal</tref>. If <em>element</em> contains
+ a <code>@language</code> property, use it's value to set the language of the plain literal.
</li>
</ol>
</li>
<li>
- If the <tref>JSON object</tref> does not have a <code>@id</code> key, set the <tref>active
- object</tref> to newly generated <tref>blank node</tref>.</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>
+ <li>If <tref>active object</tref> is not <tref>null</tref>:
+ <ol class="algorithm">
+ <li>If nether <tref>active subject</tref> nor <tref>active property</tref> are <tref>null</tref>,
+ generate a <a>Statement</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
+ expanded value (either a <tref>blank node</tref> or an <tref>IRI</tref>).</li>
<li>
- For each key in the <tref>JSON object</tref> that has not already been processed, perform
- the following steps:
+ 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> as follows:
<ol class="algorithm">
<li>
- If the key is <code>@type</code>, set the <tref>active property</tref>
+ If <em>property</em> is <code>@type</code>, set the <tref>active property</tref>
to <code>rdf:type</code>.
</li>
- <li>Otherwise, if the key is a <tref>keyword</tref>, skip this step.</li>
- <li>Otherwise, set <tref>active property</tref> to the value of the key.</li>
- <li>
- Create a new <tref>processor state</tref> copies of
- <tref>active subject</tref> and <tref>active property</tref> and process the value
- starting at <a href="#processing-step-associative">Step 1</a> and proceed using the
- previous <tref>processor state</tref>.
+ <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>.</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 IRI value 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>
- Return the <tref>active subject</tref> to the calling location.
+ Set <tref>active object</tref> to <tref>active subject</tref>.
</li>
</ol>
</li>
- <li>If a regular <tref>array</tref> is detected, process each value in the <tref>array</tref>
- by doing the following returning the result of processing the last value in the <tref>array</tref>:
- <div class="issue">Update based on decision of what value, if any, of array to use.</div>
- <ol class="algorithm">
- <li>
- Create a new <tref>processor state</tref> using copies of <tref>active subject</tref> and
- <tref>active property</tref> and process the value
- starting at <a href="#processing-step-associative">Step 1</a> then proceed using the previous
- <tref>processor state</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>
- If a <tref>string</tref> is detected, set the <tref>active object</tref>
+ <li>Otherwise, if <em>element</em> is a <tref>string</tref>, set the <tref>active object</tref>
to a <tref>plain literal</tref> value created from the string.</li>
- <li>
- If a <tref>number</tref> is detected, set the <tref>active object</tref> to a
+
+ <li>Otherwise, if <em>element<em> is a <tref>number</tref>, set the <tref>active object</tref> to a
<tref>typed literal</tref> using a string representation of the value with datatype set
to 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 <strong>true</strong> or <strong>false</strong> is detected,
+
+ <li>Otherwise, if <em>element</em> is <strong>true</strong> or <strong>false</strong>,
set the <tref>active object</tref> to a <tref>typed literal</tref> created from the
- string representation of the value with datatype set to <code>xsd:boolean</code>.
+ string representation of the value with datatype set to <code>xsd:boolean</code>.</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>Statement</a> using
+ <tref>active subject</tref>,<tref>active property</tref>, <tref>active object</tref> and
+ <tref>graph name</tref>.
</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>Statement</a> using <tref>active subject</tref>,
- <tref>active property</tref> and <tref>active object</tref>
- </li>
- <li>Return <tref>active object</tref> to the calling location.</li>
+ <li>Return <tref>active object</tref>.</li>
</ol>
</section>
<section id="list-conversion">