Skip to content

Commit d414507

Browse files
committed
Disallow terms which are compact IRIs or absolute IRIs which would expand to something other than they key itself.
Note, this represents a change from 1.0 behavior. For #155.
1 parent 71726a6 commit d414507

File tree

1 file changed

+46
-20
lines changed

1 file changed

+46
-20
lines changed

index.html

+46-20
Original file line numberDiff line numberDiff line change
@@ -2970,21 +2970,44 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
29702970
</pre>
29712971

29722972
<p>
2973-
In this example, the <a>compact IRI</a> form is used in two different
2974-
ways.
2975-
In the first approach, <code>foaf:age</code> declares both the
2976-
<a>IRI</a> for the <a>term</a> (using short-form) as well as the
2977-
<code>@type</code> associated with the <a>term</a>. In the second
2978-
approach, only the <code>@type</code> associated with the <a>term</a> is
2979-
specified. The full <a>IRI</a> for
2980-
<code>foaf:homepage</code> is determined by looking up the <code>foaf</code>
2981-
<a>prefix</a> in the
2982-
<a>context</a>.
2983-
</p>
2973+
In this example, the <a>compact IRI</a> form is used in two different ways.
2974+
In the first approach, <code>foaf:age</code> declares both the
2975+
<a>IRI</a> for the <a>term</a> (using short-form) as well as the
2976+
<code>@type</code> associated with the <a>term</a>. In the second
2977+
approach, only the <code>@type</code> associated with the <a>term</a> is
2978+
specified. The full <a>IRI</a> for
2979+
<code>foaf:homepage</code> is determined by looking up the <code>foaf</code>
2980+
<a>prefix</a> in the
2981+
<a>context</a>.</p>
2982+
2983+
<p class="warning changed">If a <a>compact IRI</a> is used as a <a>term</a>, it must expand to the
2984+
value that <a>compact IRI</a> would have on its own when expanded.
2985+
This represents a change to the original 1.0 algorithm to prevent terms from
2986+
expanding to a different <a>absolute IRI</a>, which could lead to undesired results.</p>
29842987

2985-
<p>
2986-
<a>Absolute IRIs</a> may also be used in the key position in a <a>context</a>:
2987-
</p>
2988+
<pre class="illegal-example nohighlight" data-transform="updateExample"
2989+
title="Illegal Aliasing of a compact IRI to a different absolute IRI">
2990+
<!--
2991+
{
2992+
"@context": {
2993+
"foaf": "http://xmlns.com/foaf/0.1/",
2994+
"xsd": "http://www.w3.org/2001/XMLSchema#",
2995+
"name": "foaf:name",
2996+
"foaf:age": {
2997+
"@id": "http://xmlns.com/foaf/0.1/age",
2998+
"@type": "xsd:integer"
2999+
},
3000+
"foaf:homepage": {
3001+
****"@id": "http://schema.org/url"****,
3002+
"@type": "@id"
3003+
}
3004+
}####,
3005+
...####
3006+
}
3007+
-->
3008+
</pre>
3009+
3010+
<p><a>Absolute IRIs</a> may also be used in the key position in a <a>context</a>:</p>
29883011

29893012
<pre class="example nohighlight" data-transform="updateExample"
29903013
title="Associating context definitions with absolute IRIs">
@@ -3014,13 +3037,11 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
30143037
That is, <a>terms</a> are looked up in a <a>context</a> using
30153038
direct string comparison before the <a>prefix</a> lookup mechanism is applied.</p>
30163039

3017-
<p class="note">While it is possible to define a <a>compact IRI</a>, or
3018-
an <a>absolute IRI</a> to expand to some other unrelated <a>IRI</a>
3019-
(for example, <code>foaf:name</code> expanding to
3020-
<code>http://example.org/unrelated#species</code>), such usage is strongly
3021-
discouraged.</p>
3040+
<p class="warning changed">Neither a <a>compact IRI</a> nor an <a>absolute IRI</a>
3041+
may expand to some other unrelated <a>IRI</a>.
3042+
This represents a change to the original 1.0 algorithm which allowed this behavior but discouraged it.</p>
30223043

3023-
<p>The only exception for using terms in the <a>context</a> is that
3044+
<p>The only other exception for using terms in the <a>context</a> is that
30243045
circular definitions are not allowed. That is,
30253046
a definition of <em>term1</em> cannot depend on the
30263047
definition of <em>term2</em> if <em>term2</em> also depends on
@@ -11219,6 +11240,9 @@ <h2>Context Definitions</h2>
1121911240
<code>@vocab</code> mapping, the <a>expanded term definition</a> MUST
1122011241
include the <code>@id</code> key.</p>
1122111242

11243+
<p class="changed"><a>Term definitions</a> with keys which are of the form of a <a>compact IRI</a> or <a>absolute IRI</a> MUST NOT
11244+
expand to an <a>IRI</a> other than the expansion of the key itself.</p>
11245+
1122211246
<p>If the <a>expanded term definition</a> contains the <code>@id</code>
1122311247
<a>keyword</a>, its value MUST be <a>null</a>, an <a>absolute IRI</a>,
1122411248
a <a>blank node identifier</a>, a <a>compact IRI</a>, a <a>term</a>,
@@ -12299,6 +12323,8 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
1229912323
to the document base.</li>
1230012324
<li>Added support for <code>"@type": "@none"</code> in a <a>term definition</a> to prevent value compaction.
1230112325
Define the <code>rdf:JSON</code> datatype.</li>
12326+
<li><a>Term definitions</a> with keys which are of the form of a <a>compact IRI</a> or <a>absolute IRI</a> MUST NOT
12327+
expand to an <a>IRI</a> other than the expansion of the key itself.</li>
1230212328
</ul>
1230312329
</section>
1230412330

0 commit comments

Comments
 (0)