Skip to content

Commit b9a714b

Browse files
committed
Compaction of @id and @type containers.
1 parent 351b118 commit b9a714b

File tree

1 file changed

+46
-10
lines changed

1 file changed

+46
-10
lines changed

spec/latest/json-ld-api/index.html

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ <h3>Algorithm</h3>
987987
<li>Initialize <em>container</em> to the value associated with the
988988
<code>@container</code> key, which must be either
989989
<code>@list</code>, <code>@set</code>, <code>@index</code>,
990+
<span class="changed"><code>@id</code>, <code>@type</code></span>
990991
or <code>@language</code>. Otherwise, an
991992
<a data-link-for="JsonLdErrorCode">invalid container mapping</a>
992993
has been detected and processing is aborted.</li>
@@ -1470,9 +1471,10 @@ <h3>Algorithm</h3>
14701471
</ol>
14711472
</li>
14721473
<li>Otherwise, if <em>key</em>'s <a>container mapping</a> in
1473-
<em class="changed">term context</em> is <code>@index</code> and
1474+
<em class="changed">term context</em> is <code>@index</code>,
1475+
<span class="changed"><code>@type</code>, or <code>@id</code></span> and
14741476
<em>value</em> is a <a>JSON object</a> then <em>value</em>
1475-
is expanded from an index map as follows:
1477+
is expanded from an map as follows:
14761478
<ol class="algorithm">
14771479
<li>Initialize <em>expanded value</em> to an empty
14781480
<a>array</a>.</li>
@@ -1488,11 +1490,23 @@ <h3>Algorithm</h3>
14881490
<em>key</em> as <a>active property</a>,
14891491
and <em>index value</em> as <em>element</em>.</li>
14901492
<li>For each <em>item</em> in <em>index value</em>:
1491-
<ol class="algorithm">
1492-
<li>If <em>item</em> does not have the key
1493+
<ol class="algorithm changed">
1494+
<li>If <a>container mapping</a> is <code>@index</code>
1495+
and <em>item</em> does not have the key
14931496
<code>@index</code>, add the key-value pair
14941497
(<code>@index</code>-<em>index</em>) to
14951498
<em>item</em>.</li>
1499+
<li>Otherwise, if <a>container mapping</a> is <code>@id</code>
1500+
and <em>item</em> does not have the key
1501+
<code>@id</code>, add the key-value pair
1502+
(<code>@id</code>-<em>index</em>) to
1503+
<em>item</em>.</li>
1504+
<li>Otherwise, if <a>container mapping</a> is <code>@type</code>
1505+
set <em>types</em> to the concatenation of <em>index
1506+
value</em> with any existing values of
1507+
<code>@type</code> in <em>item</em> and add the
1508+
key-value pair (<code>@type</code>-<em>types</em>) to
1509+
<em>item</em>.</li>
14961510
<li>Append <em>item</em> to <em>expanded value</em>.</li>
14971511
</ol>
14981512
</li>
@@ -1994,20 +2008,39 @@ <h3>Algorithm</h3>
19942008
</ol>
19952009
</li>
19962010
<li>
1997-
If <em>container</em> is <code>@language</code> or
1998-
<code>@index</code>:
2011+
If <em>container</em> is <code>@language</code>,
2012+
<code>@index</code>, <span class="changed"><code>@id</code>,
2013+
or <code>@type</code></span>:
19992014
<ol class="algorithm">
20002015
<li>If <em>item active property</em> is not a key in
20012016
<em>result</em>, initialize it to an empty <a>JSON object</a>.
20022017
Initialize <em>map object</em> to the value of <em>item active property</em>
20032018
in <em>result</em>.</li>
2019+
<li>Set <em>compacted container</em> to the result of calling the
2020+
<a href="#iri-compaction">IRI Compaction algorithm</a>
2021+
passing <a>active context</a>,
2022+
<em>container</em> as <em>iri</em>, and <code>true</code>
2023+
for <em>vocab</em>.</li>
20042024
<li>If <em>container</em> is <code>@language</code> and
20052025
<em>compacted item</em> contains the key
20062026
<code>@value</code>, then set <em>compacted item</em>
20072027
to the value associated with its <code>@value</code> key.</li>
2008-
<li>Initialize <em>map key</em> to the value associated with
2028+
<li>If <em>container</em> is <code>@index</code>,
2029+
set <em>map key</em> to the value associated with
20092030
with the key that equals <em>container</em> in
20102031
<em>expanded item</em>.</li>
2032+
<li class="changed">If <em>container</em> is <code>@id</code>, set
2033+
<em>map key</em> to the value associated with the key that equals
2034+
<em>compacted container</em> in <em>compacted item</em>
2035+
and remove that key-value pair from <em>compacted item</em>.</li>
2036+
<li class="changed">If <em>container</em> is <code>@type</code>,
2037+
set <em>map key</em> to the first value associated with
2038+
the key that equals <em>container</em> in <em>expanded
2039+
item</em>. If there are remaining values in <em>compacted
2040+
item</em> for <em>compacted container</em>, set the value
2041+
of <em>compacted container</em> in <em>compacted
2042+
value</em> to those remaining values. Otherwise, remove
2043+
that key-value pair from <em>compacted item</em>.</li>
20112044
<li>If <em>map key</em> is not a key in <em>map object</em>,
20122045
then set this key's value in <em>map object</em>
20132046
to <em>compacted item</em>. Otherwise, if the value
@@ -2284,9 +2317,10 @@ <h3>Algorithm</h3>
22842317
variables will keep track of the preferred
22852318
<a>type mapping</a> or <a>language mapping</a> for
22862319
a <a>term</a>, based on what is compatible with <em>value</em>.</li>
2287-
<li>If <em>value</em> is a <a>JSON object</a> that contains the
2288-
key <code>@index</code>, then append the value <code>@index</code>
2289-
to <em>containers</em>.</li>
2320+
<li>If <em>value</em> is a <a>JSON object</a>,
2321+
<span class="changed">then for the keywords <code>@index</code>,
2322+
<code>@id</code>, and <code>@type</code>, if <em>value</em>
2323+
contains that <a>keyword</a>, append it to <em>containers</em>.</span></li>
22902324
<li>If <em>reverse</em> is <code>true</code>, set <em>type/language</em>
22912325
to <code>@type</code>, <em>type/language value</em> to
22922326
<code>@reverse</code>, and append <code>@set</code> to <em>containers</em>.</li>
@@ -4208,6 +4242,8 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
42084242
<li>A new <a href="#merge-node-maps" class="sectionRef"></a> is required
42094243
for framing, to create a single graph from the <a data-lt="default graph">default</a>
42104244
and <a>named graphs</a>.</li>
4245+
<li><code>@container</code> values within an <a>expanded term definition</a> may now
4246+
include <code>@id</code> and <code>@type</code>, corresponding to <a>id maps</a> and <a>type maps</a>.</li>
42114247
</ul>
42124248
</section>
42134249

0 commit comments

Comments
 (0)