@@ -3325,89 +3325,47 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
3325
3325
JSON-LD 1.1 allows term definitions to be < em > protected</ em > .
3326
3326
</ p >
3327
3327
< 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 >
3330
3335
3331
3336
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
+ <!--
3343
3340
{
3344
3341
"@context": [
3345
3342
{
3346
3343
****"@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",
3349
3346
"name": {
3350
- "@id": "http://schema.org /name",
3347
+ "@id": "http://xmlns.com/foaf/0.1 /name",
3351
3348
****"@protected": true****
3352
3349
}
3353
3350
},
3354
3351
{
3355
- ****"name": "this_attempt_to_override_name_will_fail"****
3352
+ ####– this attempt will fail with an error####
3353
+ ****"name": "http://schema.org/name"****
3356
3354
}
3357
3355
],
3358
3356
"@type": "Person",
3359
3357
"name": "Manu Sporny",
3360
3358
"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
+ ],
3364
3364
"name": "Gregg Kellogg"
3365
3365
}
3366
3366
}
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
- }]
3380
3367
-->
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 >
3411
3369
3412
3370
< p > When all or most term definitions of a context need to be protected,
3413
3371
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>
3444
3402
"name": "Digital Bazaar",
3445
3403
"member": {
3446
3404
"@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"
3449
3409
},
3450
3410
"@type": "Person",
3451
3411
"name": "Manu Sporny"
@@ -3499,14 +3459,27 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
3499
3459
</ pre >
3500
3460
</ aside >
3501
3461
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 >
3507
3480
3508
3481
< aside class ="example ds-selector-tabs changed "
3509
- title ="@context null erases protected term definitions ">
3482
+ title ="overriding permitted in property scoped context ">
3510
3483
< div class ="selectors ">
3511
3484
< button class ="selected " data-selects ="original "> Original</ button >
3512
3485
< button data-selects ="expanded "> Expanded</ button >
@@ -3519,59 +3492,82 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
3519
3492
{
3520
3493
"@context": [
3521
3494
{
3495
+ ####– This context reflects the specification used by "plain JSON" implementations####
3522
3496
****"@version": 1.1****,
3523
3497
****"@protected": true****,
3524
3498
"Organization": "http://schema.org/Organization",
3525
3499
"name": "http://schema.org/name",
3526
3500
"employee": {
3527
3501
"@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
+ ]
3529
3519
}
3530
3520
}
3531
3521
],
3532
3522
"@type": "Organization",
3533
3523
"name": "Digital Bazaar",
3534
3524
"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"
3542
3529
}
3543
3530
}
3544
3531
-->
3545
3532
</ pre >
3546
3533
< pre class ="expanded nohighlight "
3547
3534
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
+ >
3549
3538
<!--
3550
3539
[{
3551
3540
"@type": ["http://schema.org/Organization"],
3552
3541
"http://schema.org/name": [{"@value": "Digital Bazaar"}],
3553
3542
"http://schema.org/employee": [
3554
3543
{
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"}]
3556
3550
}
3557
3551
]
3558
3552
}]
3559
3553
-->
3560
3554
</ pre >
3561
3555
< 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 "
3563
3557
data-to-rdf >
3564
3558
< thead > < tr > < th > Subject</ th > < th > Property</ th > < th > Value</ th > </ tr > </ thead >
3565
3559
< tbody >
3566
3560
< tr > < td > _:b0</ td > < td > rdf:type</ td > < td > schema:Organization</ td > </ tr >
3567
3561
< tr > < td > _:b0</ td > < td > schema:name</ td > < td > Digital Bazaar</ td > </ tr >
3568
3562
< 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 >
3570
3566
</ tbody >
3571
3567
</ table >
3572
3568
< pre class ="turtle "
3573
3569
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 "
3575
3571
data-transform ="updateExample "
3576
3572
data-to-rdf >
3577
3573
<!--
@@ -3582,7 +3578,10 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
3582
3578
a schema:Organization;
3583
3579
schema:name "Digital Bazaar";
3584
3580
schema:employee [
3585
- foaf:name "Manu Sporny"
3581
+ schema:familyName "Sporny"
3582
+ ];
3583
+ foaf:based_near [
3584
+ foaf:name "Blacksburg, Virginia"
3586
3585
];
3587
3586
] .
3588
3587
-->
0 commit comments