Skip to content

Commit 004ec29

Browse files
pchampingkellogg
authored andcommitted
reflected the decisions about #136
NB: marked example 44 as ignored, because it is not supported by the current implementation
1 parent 1c88579 commit 004ec29

File tree

1 file changed

+84
-85
lines changed

1 file changed

+84
-85
lines changed

index.html

Lines changed: 84 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,89 +3325,47 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
33253325
JSON-LD 1.1 allows term definitions to be <em>protected</em>.
33263326
</p>
33273327
<p>A <dfn>protected term definition</dfn> is a term definition with a member <code>@protected</code> set to <code>true</code>.
3328-
It prevents further contexts to override this term definition.
3329-
</p>
3328+
It generally prevents further contexts to override this term definition,
3329+
either through a new definition of the same term,
3330+
or through clearing the context with <code>"@context": null</code>.
3331+
Such attempts will raise an error and abort the processing
3332+
(except in some specific situations described
3333+
<a href="#overriding-protected-terms">below</a>).
3334+
</p>
33303335

33313336

3332-
<aside class="example ds-selector-tabs changed"
3333-
title="A protected term definition can not be overridden">
3334-
<div class="selectors">
3335-
<button class="selected" data-selects="original">Original</button>
3336-
<button data-selects="expanded">Expanded</button>
3337-
<button data-selects="statements">Statements</button>
3338-
<button data-selects="turtle">Turtle</button>
3339-
<a class="playground" target="_blank"></a>
3340-
</div>
3341-
<pre class="original selected nohighlight" data-transform="updateExample">
3342-
<!--
3337+
<pre class="example" data-transform="updateExample"
3338+
title="A protected term definition can generally not be overridden">
3339+
<!--
33433340
{
33443341
"@context": [
33453342
{
33463343
****"@version": 1.1****,
3347-
"Person": "http://schema.org/Person",
3348-
"knows": "http://schema.org/knows",
3344+
"Person": "http://xmlns.com/foaf/0.1/Person",
3345+
"knows": "http://xmlns.com/foaf/0.1/knows",
33493346
"name": {
3350-
"@id": "http://schema.org/name",
3347+
"@id": "http://xmlns.com/foaf/0.1/name",
33513348
****"@protected": true****
33523349
}
33533350
},
33543351
{
3355-
****"name": "this_attempt_to_override_name_will_fail"****
3352+
####– this attempt will fail with an error####
3353+
****"name": "http://schema.org/name"****
33563354
}
33573355
],
33583356
"@type": "Person",
33593357
"name": "Manu Sporny",
33603358
"knows": {
3361-
"@context": {
3362-
****"name": "this_attempt_to_override_name_will_also_fail"****
3363-
},
3359+
"@context": [
3360+
####– this attempt would also fail with an error####
3361+
****null,****
3362+
"http://schema.org/"
3363+
],
33643364
"name": "Gregg Kellogg"
33653365
}
33663366
}
3367-
-->
3368-
</pre>
3369-
<pre class="expanded nohighlight"
3370-
data-transform="updateExample"
3371-
data-result-for="A protected term definition can not be overridden-original">
3372-
<!--
3373-
[{
3374-
"@type": ["http://schema.org/Person"],
3375-
"http://schema.org/name": [{"@value": "Manu Sporny"}],
3376-
"http://schema.org/knows": [{
3377-
"http://schema.org/name": [{"@value": "Gregg Kellogg"}]
3378-
}]
3379-
}]
33803367
-->
3381-
</pre>
3382-
<table class="statements"
3383-
data-result-for="A protected term definition can not be overridden-expanded"
3384-
data-to-rdf>
3385-
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
3386-
<tbody>
3387-
<tr><td>_:b0</td><td>rdf:type</td><td>schema:Person</td></tr>
3388-
<tr><td>_:b0</td><td>schema:name</td><td>Manu Sporny</td></tr>
3389-
<tr><td>_:b0</td><td>schema:knows</td><td>_:b1</td></tr>
3390-
<tr><td>_:b1</td><td>schema:name</td><td>Gregg Kellogg</td></tr>
3391-
</tbody>
3392-
</table>
3393-
<pre class="turtle"
3394-
data-content-type="text/turtle"
3395-
data-result-for="A protected term definition can not be overridden-expanded"
3396-
data-transform="updateExample"
3397-
data-to-rdf>
3398-
<!--
3399-
@prefix schema: <http://schema.org/> .
3400-
3401-
[
3402-
a schema:Person;
3403-
schema:name "Manu Sporny";
3404-
schema:knows [
3405-
schema:name "Gregg Kellogg"
3406-
]
3407-
] .
3408-
-->
3409-
</pre>
3410-
</aside>
3368+
</pre>
34113369

34123370
<p>When all or most term definitions of a context need to be protected,
34133371
it is possible to add a member <code>@protected</code> set to <code>true</code>
@@ -3444,8 +3402,10 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
34443402
"name": "Digital Bazaar",
34453403
"member": {
34463404
"@context": {
3447-
"Person": "http://xmlns.com/foaf/0.1/Person",
3448-
"name": "this_attempt_to_override_name_will_fail"
3405+
####­– name *is* protected, so the following would fail with an error
3406+
– "name": "http://xmlns.com/foaf/0.1/Person",
3407+
­– Person is *not* protected, and can be overridden ####
3408+
"Person": "http://xmlns.com/foaf/0.1/Person"
34493409
},
34503410
"@type": "Person",
34513411
"name": "Manu Sporny"
@@ -3499,14 +3459,27 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
34993459
</pre>
35003460
</aside>
35013461

3502-
<p>While protected term definitions can not be directly overridden,
3503-
it is worth noting that setting <code>@context</code> to <code>null</code>
3504-
will erase everything from the active context,
3505-
<em>including</em> protected term definitions.
3506-
</p>
3462+
<p id="overriding-protected-terms">
3463+
While protected terms can in general not be overridden,
3464+
there is an exception to this rule:
3465+
a property-<a>scoped context</a> is not affected by protection,
3466+
and can therefore override protected terms,
3467+
either with a new term definition,
3468+
or by clearing the context with <code>"@context": null</code>.
3469+
</p>
3470+
<p>
3471+
The rationale is that "plain JSON" implementations,
3472+
relying on a given specification,
3473+
will only traverse properties defined by that specification.
3474+
<a>Scoped contexts</a> belonging to the specified properties are part of the specification,
3475+
so the "plain JSON" implementations are expected to be aware of the change of semantics they induce.
3476+
<a>Scoped contexts</a> belonging to other properties apply to parts of the document that "plain JSON" implementations will ignore.
3477+
In both cases, there is therefore no risk of diverging interpretations between JSON-LD-aware implementations and "plain JSON" implementations,
3478+
so overriding is permitted.
3479+
</p>
35073480

35083481
<aside class="example ds-selector-tabs changed"
3509-
title="@context null erases protected term definitions">
3482+
title="overriding permitted in property scoped context">
35103483
<div class="selectors">
35113484
<button class="selected" data-selects="original">Original</button>
35123485
<button data-selects="expanded">Expanded</button>
@@ -3519,59 +3492,82 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
35193492
{
35203493
"@context": [
35213494
{
3495+
####– This context reflects the specification used by "plain JSON" implementations####
35223496
****"@version": 1.1****,
35233497
****"@protected": true****,
35243498
"Organization": "http://schema.org/Organization",
35253499
"name": "http://schema.org/name",
35263500
"employee": {
35273501
"@id": "http://schema.org/employee",
3528-
****"@context": null****
3502+
****"@context": {
3503+
"@protected": true,
3504+
"name": "http://schema.org/familyName"
3505+
}****
3506+
####↑ overrides the definition of "name"####
3507+
}
3508+
},
3509+
{
3510+
####– This context extends the previous one,
3511+
– only JSON-LD-aware implementations are expected to use it####
3512+
"location": {
3513+
"@id": "http://xmlns.com/foaf/0.1/based_near",
3514+
"@context": [
3515+
****null,****
3516+
####↑ clears the context entirely, including all protected terms####
3517+
{ "@vocab": "http://xmlns.com/foaf/0.1/" }
3518+
]
35293519
}
35303520
}
35313521
],
35323522
"@type": "Organization",
35333523
"name": "Digital Bazaar",
35343524
"employee" : {
3535-
#### — because of "@context": null in the scoped context, ####
3536-
#### — the active context at this point is empty; ####
3537-
#### — so we can (and we must) redefine "name" below ####
3538-
"@context": {
3539-
****"name": "http://xmlns.com/foaf/0.1/name"****
3540-
},
3541-
"name": "Manu Sporny"
3525+
"name": "Sporny"
3526+
},
3527+
"location": {
3528+
"name": "Blacksburg, Virginia"
35423529
}
35433530
}
35443531
-->
35453532
</pre>
35463533
<pre class="expanded nohighlight"
35473534
data-transform="updateExample"
3548-
data-result-for="@context null erases protected term definitions-original">
3535+
data-result-for="overriding permitted in property scoped context-original"
3536+
data-ignore
3537+
>
35493538
<!--
35503539
[{
35513540
"@type": ["http://schema.org/Organization"],
35523541
"http://schema.org/name": [{"@value": "Digital Bazaar"}],
35533542
"http://schema.org/employee": [
35543543
{
3555-
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}]
3544+
"http://schema.org/familyName": [{"@value": "Sporny"}]
3545+
}
3546+
],
3547+
"http://xmlns.com/foaf/0.1/based_near": [
3548+
{
3549+
"http://xmlns.com/foaf/0.1/name": [{"@value": "Blacksburg, Virginia"}]
35563550
}
35573551
]
35583552
}]
35593553
-->
35603554
</pre>
35613555
<table class="statements"
3562-
data-result-for="@context null erases protected term definitions-expanded"
3556+
data-result-for="overriding permitted in property scoped context-expanded"
35633557
data-to-rdf>
35643558
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
35653559
<tbody>
35663560
<tr><td>_:b0</td><td>rdf:type</td><td>schema:Organization</td></tr>
35673561
<tr><td>_:b0</td><td>schema:name</td><td>Digital Bazaar</td></tr>
35683562
<tr><td>_:b0</td><td>schema:employee</td><td>_:b1</td></tr>
3569-
<tr><td>_:b1</td><td>foaf:name</td><td>Manu Sporny</td></tr>
3563+
<tr><td>_:b1</td><td>schema:familyName</td><td>Sporny</td></tr>
3564+
<tr><td>_:b0</td><td>foaf:based_near</td><td>_:b2</td></tr>
3565+
<tr><td>_:b2</td><td>foaf:name</td><td>Blacksburg, Virginia</td></tr>
35703566
</tbody>
35713567
</table>
35723568
<pre class="turtle"
35733569
data-content-type="text/turtle"
3574-
data-result-for="@context null erases protected term definitions-expanded"
3570+
data-result-for="overriding permitted in property scoped context-expanded"
35753571
data-transform="updateExample"
35763572
data-to-rdf>
35773573
<!--
@@ -3582,7 +3578,10 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
35823578
a schema:Organization;
35833579
schema:name "Digital Bazaar";
35843580
schema:employee [
3585-
foaf:name "Manu Sporny"
3581+
schema:familyName "Sporny"
3582+
];
3583+
foaf:based_near [
3584+
foaf:name "Blacksburg, Virginia"
35863585
];
35873586
] .
35883587
-->

0 commit comments

Comments
 (0)