Skip to content

Commit 351b118

Browse files
committed
Describe _Type Maps_ in the syntax document.
1 parent 83f6332 commit 351b118

File tree

2 files changed

+78
-10
lines changed

2 files changed

+78
-10
lines changed

spec/latest/common/terms.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ <h1>General Terminology</h1>
251251
a <a>JSON object</a> as a <a>property</a>, type, or elsewhere that a string is interpreted as a vocabulary item.
252252
Its value is either a string, expanding to an absolute IRI, or an <a>expanded term definition</a>.
253253
</dd>
254+
<dt class="changed"><dfn data-lt="type maps">type map</dfn></dt><dd class="changed">
255+
An <a>type map</a> is a <a>JSON object</a> value of a <a>term</a> defined with
256+
<code>@container</code> set to <code>@type</code>, who's keys are
257+
interpreted as <a>IRIs</a> representing the <code>@type</code>
258+
of the associated <a>node object</a>;
259+
value MUST be a <a>node object</a>, or <a>array</a> of node objects.
260+
If the value contains a property expanding to <code>@type</code>, it's values
261+
are merged with the map value when expanding.</dd>
254262
<dt><dfn>typed literal</dfn></dt><dd>
255263
A <a>typed literal</a> is a <a>literal</a> with an associated <a>IRI</a>
256264
which indicates the literal's datatype. See <cite><a

spec/latest/json-ld/index.html

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,10 +2586,10 @@ <h2>Data Indexing</h2>
25862586
<section class="informative changed">
25872587
<h2>Node Identifier Indexing</h2>
25882588

2589-
<p>In addition to index maps, JSON-LD introduces the notion of <a>id maps</a>
2589+
<p>In addition to <a>index maps</a>, JSON-LD introduces the notion of <a>id maps</a>
25902590
for structuring data. The id indexing feature allows an author to
25912591
structure data using a simple key-value map where the keys map
2592-
to <a>IRIs</a>. This enables direct access to associated node objects
2592+
to <a>IRIs</a>. This enables direct access to associated <a>node objects</a>
25932593
instead of having to scan an array in search of a specific item.
25942594
In JSON-LD such data can be specified by associating the
25952595
<code>@id</code> <a>keyword</a> with a
@@ -2627,14 +2627,61 @@ <h2>Node Identifier Indexing</h2>
26272627
-->
26282628
</pre>
26292629

2630-
<p>In the example above, the <strong>post</strong> <a>term</a> has
2631-
been marked as an <a>id map</a>. The <strong>http://example.com/posts/1/en</strong> and
2632-
<strong>http://example.com/posts/1/de</strong> keys will be interpreted
2630+
<p>In the example above, the <code>post</code> <a>term</a> has
2631+
been marked as an <a>id map</a>. The <code>http://example.com/posts/1/en</code> and
2632+
<code>http://example.com/posts/1/de</code> keys will be interpreted
26332633
as the <code>@id</code> property of the <a>node object</a> value.</p>
26342634

26352635
<p>The interpretation of the data above is exactly the same
26362636
as that in <a class="sectionRef" href="#data-indexing"></a>
2637-
using a JSON-LD processor:</p>
2637+
using a JSON-LD processor.</p>
2638+
</section>
2639+
2640+
<section class="informative changed">
2641+
<h2>Node Type Indexing</h2>
2642+
2643+
<p>In addition to <a data-lt="id map">id</a> and <a>index maps</a>, JSON-LD introduces the notion of <a>type maps</a>
2644+
for structuring data. The type indexing feature allows an author to
2645+
structure data using a simple key-value map where the keys map
2646+
to <a>IRIs</a>. This enables data to be structured based on the <code>@type</code>
2647+
of specific <a>node objects</a>.
2648+
In JSON-LD such data can be specified by associating the
2649+
<code>@type</code> <a>keyword</a> with a
2650+
<code>@container</code> declaration in the context:</p>
2651+
2652+
<pre class="example" data-transform="updateExample"
2653+
title="Indexing data in JSON-LD by node identifiers">
2654+
<!--
2655+
{
2656+
"@context":
2657+
{
2658+
"schema": "http://schema.org/",
2659+
"name": "schema:name",
2660+
"affiliation": {
2661+
"@id": "schema:affiliation",
2662+
****"@container": "@type"****
2663+
}
2664+
},
2665+
"name": "Manu Sporny",
2666+
"affiliation": {
2667+
****"schema:Corporpation"****: {
2668+
"@id": "http://digitalbazaar.com/",
2669+
"name": "Digital Bazaar"
2670+
},
2671+
****"schema:ProfessionalService"****: {
2672+
"@id": "https://spec-ops.io",
2673+
"name": "Spec-Ops"
2674+
}
2675+
2676+
}
2677+
}
2678+
-->
2679+
</pre>
2680+
2681+
<p>In the example above, the <code>affiliation</code> <a>term</a> has
2682+
been marked as an <a>type map</a>. The <code>schema:Corporpation</code> and
2683+
<code>schema:ProfessionalService</code> keys will be interpreted
2684+
as the <code>@type</code> property of the <a>node object</a> value.</p>
26382685
</section>
26392686

26402687
<section class="informative">
@@ -3250,7 +3297,21 @@ <h2>Id Maps</h2>
32503297
and the values MUST be <a>node objects</a>.</p>
32513298

32523299
<p>If the value contains a property expanding to <code>@id</code>, it's value MUST
3253-
be equivalent to the referencing key. Otherwise, the key is used as
3300+
be equivalent to the referencing key. Otherwise, the property from the value is used as
3301+
the <code>@id</code> of the <a>node object</a> value when expanding.</p>
3302+
</section>
3303+
3304+
<section class="changed">
3305+
<h2>Type Maps</h2>
3306+
3307+
<p>An <a>type map</a> is used to associate an <a>IRI</a> with a value that allows easy
3308+
programatic access. An <a>id map</a> may be used as a term value within a <a>node object</a> if the <a>term</a>
3309+
is defined with <code>@container</code> set to <code>@id</code>. The keys of an <a>id map</a> MUST be <a>IRIs</a>
3310+
(<a>relative IRI</a>, <a>compact IRI</a> (including <a>blank node identifiers</a>), or <a>absolute IRI</a>)
3311+
and the values MUST be <a>node objects</a>.</p>
3312+
3313+
<p>If the value contains a property expanding to <code>@id</code>, it's value MUST
3314+
be equivalent to the referencing key. Otherwise, the property from the value is used as
32543315
the <code>@id</code> of the <a>node object</a> value when expanding.</p>
32553316
</section>
32563317

@@ -3519,17 +3580,16 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
35193580
<li>An <a>expanded term definition</a> can now have an
35203581
<code>@context</code> property, which defines a <a>context</a> used for values of
35213582
a <a>property</a> identified with such a <a>term</a>.</li>
3583+
<li><code>@container</code> values within an <a>expanded term definition</a> may now
3584+
include <code>@id</code> and <code>@type</code>, corresponding to <a>id maps</a> and <a>type maps</a>.</li>
35223585
</ul>
35233586
</section>
35243587

35253588
<section class="appendix informative">
35263589
<h4>Open Issues</h4>
35273590
<p>The following is a list of open issues being worked on for the next release.</p>
3528-
<p class="issue" data-number="12"></p>
35293591
<p class="issue" data-number="195"></p>
35303592
<p class="issue" data-number="246"></p>
3531-
<p class="issue" data-number="247"></p>
3532-
<p class="issue" data-number="262"></p>
35333593
<p class="issue" data-number="269"></p>
35343594
<p class="issue" data-number="271"></p>
35353595
<p class="issue" data-number="272"></p>

0 commit comments

Comments
 (0)