--- a/spec/latest/json-ld-api/index.html Fri Mar 22 10:41:06 2013 +0100
+++ b/spec/latest/json-ld-api/index.html Fri Mar 22 12:26:17 2013 +0100
@@ -807,7 +807,9 @@
<tref>term definition</tref> consists of an <tdef>IRI mapping</tdef>, a boolean
flag <tdef>reverse property</tdef>, an optional <tdef>type mapping</tdef>
or <tdef>language mapping</tdef>, and an optional <tdef>container mapping</tdef>.
- The <tref>active context</tref> also keeps track of <tref>keyword</tref> aliases.</p>
+ A <tref>term definition</tref> can not only be used to map a <tref>term</tref>
+ to an IRI, but also to map a <tref>term</tref> to a <tref>keyword</tref>,
+ in which case it is referred to as a <tdef>keyword alias</tdef>.</p>
<p>When processing, the <tref>active context</tref> is initialized
without any <tref title="term definition">term definitions</tref>,
@@ -856,14 +858,14 @@
<p>Then, for every other key in <tref>local context</tref>, we update
the <tref>term definition</tref> in <i>result</i>. Since
- <tref title="context">context</tref> values in a <tref>local context</tref>
- may themselves contain <tref title="compact IRI">compact IRIs</tref>, we may
- need to recurse to define a <tref>prefix</tref>. When doing so, we must ensure
- that there is no cyclical dependency, which is an error. After we have processed any
- <tref title="term definition">term definition</tref> dependencies, we update
- the current <tref title="term definition">term definition</tref>, which may be
- a keyword alias or consist of <code>@id</code>, <code>@language</code>,
- <code>@type</code>, or <code>@container</code> mappings.</p>
+ <tref title="term definition">term definitions</tref> in a <tref>local context</tref>
+ may themselves contain <tref title="term">terms</tref> or
+ <tref title="compact IRI">compact IRIs</tref>, we may need to recurse.
+ When doing so, we must ensure that there is no cyclical dependency,
+ which is an error. After we have processed any
+ <tref title="term definition">term definition</tref> dependencies,
+ we update the current <tref title="term definition">term definition</tref>,
+ which may be a <tref>keyword alias</tref>.</p>
<p>Finally, we return <i>result</i> as the new <tref>active context</tref>.</p>
</section>
@@ -1067,12 +1069,7 @@
<li>If <i>value</i> is a <tref>keyword</tref>, <i>value</i>
must not be <code>@context</code>, if it is, an
<code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-keyword-alias">invalid keyword alias</a></code>
- error has been
- detected. Add <i>term</i> to <tref>active context</tref> as a
- <tref>keyword</tref> alias for <i>value</i>. If there is more than
- one <tref>keyword</tref> alias for <i>value</i>, store its
- aliases as an <tref>array</tref>, sorted by length, breaking ties
- lexicographically.</li>
+ error has been detected.</li>
<li>Set the <tref>IRI mapping</tref> for the <tref>term definition</tref>
for <i>term</i> in <tref>active context</tref> to <i>value</i>,
set the value associated with <i>defined</i>'s key <i>term</i> to
@@ -1214,8 +1211,9 @@
<p>In JSON-LD documents, some keys and values may represent
<tref title="IRI">IRIs</tref>. This section defines an algorithm for
transforming a <tref>string</tref> that represents an <tref>IRI</tref> into
- an <tref>absolute IRI</tref>. It also covers transforming <tref>keyword</tref>
- aliases into <tref title="keyword">keywords</tref>.</p>
+ an <tref>absolute IRI</tref>. It also covers transforming
+ <tref title="keyword alias">keyword aliases</tref> into
+ <tref title="keyword">keywords</tref>.</p>
<p><tref>IRI</tref> expansion may occur during context processing or during
any of the other JSON-LD algorithms. If IRI expansion occurs during context
@@ -1236,7 +1234,7 @@
<p>We have a value that needs to be expanded to an <tref>absolute IRI</tref>
or a <tref>keyword</tref>. The given value may be <tref>null</tref>, a
- <tref>term</tref>, a <tref>keyword</tref> alias, a <tref>compact IRI</tref>,
+ <tref>term</tref>, a <tref>keyword alias</tref>, a <tref>compact IRI</tref>,
a <tref>relative IRI</tref>, or an <tref>absolute IRI</tref>.</p>
</section>
@@ -1245,9 +1243,9 @@
<p>In order to expand <i>value</i> to an <tref>absolute IRI</tref>, we must
first determine if it is <tref>null</tref>, a <tref>term</tref>, a
- <tref>keyword</tref> alias, or some form of <tref>IRI</tref>. Based on what
+ <tref>keyword alias</tref>, or some form of <tref>IRI</tref>. Based on what
we find, we handle the specific kind of expansion; for example, we expand
- a <tref>keyword</tref> alias to a <tref>keyword</tref> and a <tref>term</tref>
+ a <tref>keyword alias</tref> to a <tref>keyword</tref> and a <tref>term</tref>
to an <tref>absolute IRI</tref> according to its <tref>IRI mapping</tref>
in the <tref>active context</tref>. While inspecting <i>value</i> we
may also find that we need to create <tref>term definition</tref>
@@ -1283,7 +1281,7 @@
<tref>local context</tref> and <i>defined</i> are initialized to <tref>null</tref>.</p>
<ol class="algorithm">
- <li>If <i>value</i> is a <tref>keyword</tref> or is <tref>null</tref>,
+ <li>If <i>value</i> is a <tref>keyword</tref> or <tref>null</tref>,
return <i>value</i> as is.</li>
<li>If <tref>local context</tref> is not <tref>null</tref>, it contains
a key that equals <i>value</i>, and the value associated with the key
@@ -1302,6 +1300,8 @@
<li>If <tref>active context</tref> has a <tref>term definition</tref> for
<i>value</i>, set <i>result</i> to the associated
<tref>IRI mapping</tref>.</li>
+ <li>If <i>result</i> is a <tref>keyword</tref> (meaning that <i>value</i>
+ is a <tref>keyword alias</tref>), return <i>result</i>.</li>
</ol>
</li>
<li>If <i>result</i> is <tref>null</tref> and <i>value</i> contains a
@@ -1334,8 +1334,6 @@
</ol>
</li>
<li>If <i>result</i> is <tref>null</tref>, set it to <i>value</i>.</li>
- <li>If <tref>active context</tref> indicates that <i>value</i> is a
- <tref>keyword</tref> alias return the associated <tref>keyword</tref>.</li>
<li>If <tref>local context</tref> is <tref>null</tref> and <i>result</i>
begins with an underscore and colon (<code>_:</code>) <i>result</i> is a
<tref>blank node identifier</tref>. Set <i>result</i> to the
@@ -1937,20 +1935,19 @@
compacted, using the <a href="#iri-compaction">IRI Compaction algorithm</a>,
to <tref title="term">terms</tref> or <tref title="compact IRI">compact IRIs</tref>
and others will be compacted from <tref title="keyword">keywords</tref> to
- <tref>keyword</tref> aliases or simply left unchanged because
- they do not have definitions in the <tref>context</tref>. Values will
- be converted to <tref>compacted form</tref> via the
+ <tref title="keyword alias">keyword aliases</tref> or simply left
+ unchanged because they do not have definitions in the <tref>context</tref>.
+ Values will be converted to <tref>compacted form</tref> via the
<a href="#value-compaction">Value Compaction algorithm</a>. Some data
- will be reshaped based on
- <tref title="container mapping">container mappings</tref> specified
- in the context such as <code>@index</code> or <code>@language</code>
+ will be reshaped based on <tref title="container mapping">container mappings</tref>
+ specified in the context such as <code>@index</code> or <code>@language</code>
maps.</li>
</ol>
<p>The final output is a <tref>JSON object</tref> with a <code>@context</code>
key, if a <tref>context</tref> was given, where the <tref>JSON object</tref>
is either <i>result</i> or a wrapper for it where <i>result</i> appears
- as the value of an aliased <code>@graph</code> key because <i>result</i>
+ as the value of an (aliased) <code>@graph</code> key because <i>result</i>
contained two or more items in an <tref>array</tref>. If no
<tref>context</tref> was given, the <i>result</i> is only simplified
from an <tref>array</tref> to a <tref>JSON object</tref> if it has one or
@@ -2046,9 +2043,8 @@
<a href="#iri-compaction">IRI Compaction algorithm</a>,
passing <tref>active context</tref>, <tref>inverse context</tref>, and
<i>expanded property</i> for <i>iri</i>.</li>
- <li>Add the key-value pair,
- (<i>alias</i>-<i>compacted value</i>) to
- <i>result</i> and continue to the next
+ <li>Add a member <i>alias</i> to <i>result</i> whose value is
+ set to <i>compacted value</i> and continue to the next
<i>expanded property</i>.</li>
</ol>
</li>
@@ -2424,37 +2420,35 @@
<p>This section defines an algorithm for transforming an <tref>IRI</tref>
to a <tref>term</tref> or <tref>compact IRI</tref>, or a <tref>keyword</tref>
- alias to a <tref>keyword</tref>. A value that is associated with the
+ to a <tref>keyword alias</tref>. A value that is associated with the
<tref>IRI</tref> may be passed in order to assist in selecting the most
context-appropriate <tref>term</tref>.</p>
<section class="informative">
<h3>Purpose</h3>
- <p>We have an <tref>IRI</tref> (or <tref>keyword</tref>) that we may
- be able to compact to <tref>term</tref>, <tref>compact IRI</tref>, or
- <tref>keyword</tref> alias.</p>
+ <p>We have an <tref>IRI</tref> or <tref>keyword</tref> that we want
+ to compact to a <tref>term</tref>, a <tref>compact IRI</tref>, or
+ a <tref>keyword alias</tref>.</p>
</section>
<section class="informative">
<h3>General Solution</h3>
- <p>First, we handle the simple cases: if the value given as an <tref>IRI</tref>
- is <tref>null</tref>, we simply return <tref>null</tref> and if it is a
- <tref>keyword</tref> we return its associated alias.</p>
-
- <p>Otherwise, we first try to find a <tref>term</tref> that the
- <tref>IRI</tref> can be <tref title="compaction">compacted</tref> to if
- it is relative to <tref title="active context">active context's</tref>'s
- <tref>vocabulary mapping</tref>. In order to select a <tref>term</tref>, we
- have to collect information about the <tref title="IRI">IRI's</tref>
- associated value. This information includes which
+ <p>If the passed <tref>IRI</tref> is <tref>null</tref>, we simply
+ return <tref>null</tref>. Otherwise, we first try to find a <tref>term</tref>
+ that the <tref>IRI</tref> or <tref>keyword</tref> can be compacted to if
+ it is relative to <tref title="active context">active context's</tref>
+ <tref>vocabulary mapping</tref>. In order to select the most appropriate
+ <tref>term</tref>, we may have to collect information about the passed
+ <i>value</i>. This information includes whic
<tref title="container mapping">container mappings</tref>
- would be preferred for expressing the value, and what its
+ would be preferred for expressing the <i>value</i>, and what its
<tref>type mapping</tref> or <tref>language mapping</tref> is. For
- JSON-LD lists, the <tref>type mapping</tref> or <tref>language mapping</tref>
- will be chosen based on the most specific values that work for all items in
- the list. Once this information is gathered, it is passed to the
+ <tref title="list object">JSON-LD lists</tref>, the <tref>type mapping</tref>
+ or <tref>language mapping</tref> will be chosen based on the most
+ specific values that work for all items in the list. Once this
+ information is gathered, it is passed to the
<a href="#term-selection">Term Selection algorithm</a>, which will
return the most appropriate <tref>term</tref> to use.</p>
@@ -2463,9 +2457,10 @@
to use. If there is no appropriate <tref>compact IRI</tref>, then, if
the <tref>IRI</tref> is relative to
<tref title="active context">active context's</tref>
- <tref>vocabulary mapping</tref>, then it is used. Otherwise, transform it to
- a <tref>relative IRI</tref> using the document's base <tref>IRI</tref>.
- Finally, if the <tref>IRI</tref> still could not be compacted, return it
+ <tref>vocabulary mapping</tref>, then it is used. Otherwise, it is
+ transformed to a <tref>relative IRI</tref> using the document's
+ <tref>base IRI</tref>. Finally, if the <tref>IRI</tref> or
+ <tref>keyword</tref> still could not be compacted, it is returned
as is.</p>
</section>
@@ -2485,10 +2480,6 @@
<ol class="algorithm">
<li>If <i>iri</i> is <tref>null</tref>, return <tref>null</tref>.</li>
- <li>If <i>iri</i> is a <tref>keyword</tref> and does not have a
- <tref>keyword</tref> alias, return <i>iri</i>, otherwise return
- its first associated <tref>keyword</tref> alias from
- <tref>active context</tref>.</li>
<li>If <i>vocabRelative</i> is <tref>true</tref> and <i>iri</i> is a
key in <tref>inverse context</tref>:
<ol class="algorithm">