@@ -608,6 +608,10 @@ <h2>Syntax Tokens and Keywords</h2>
608
608
Used in a <a>context definition</a> to load an external context
609
609
within which the containing <a>context definition</a> is merged.
610
610
This can be useful to add JSON-LD 1.1 features to JSON-LD 1.0 contexts.</dd>
611
+ <dt class="changed">`@included`</dt><dd class="changed">
612
+ Used in in a top-level <a>node object</a> to define an <a>included block</a>,
613
+ for including secondary <a>node objects</a> within another <a>node object</a>.
614
+ </dd>
611
615
</dl>
612
616
613
617
<p>All keys, <a>keywords</a>, and values in JSON-LD are case-sensitive.</p>
@@ -8272,6 +8276,150 @@ <h3>Using the Document Base for the Default Vocabulary</h3>
8272
8276
</section>
8273
8277
</section>
8274
8278
8279
+ <section class="informative changed"><h3>Included Nodes</h3>
8280
+ <p>Sometimes it is useful to list node objects as part of another node object.
8281
+ For instance, to represent a set of resources which are used by some other
8282
+ resource.
8283
+ In JSON-LD. these resources could all be contained as members of an array,
8284
+ but this does not conveniently allow them to share a common context.</p>
8285
+
8286
+ <p>Included resources are described in
8287
+ <a data-cite="JSON.API#fetching-includes">Inclusion of Related Resources</a> of [[[JSON.API]]] [[JSON.API]]
8288
+ as a way to include related resources associated with some primary resource.</p>
8289
+
8290
+ <p>In JSON-LD, <a>included blocks</a> may be used to collect such secondary <a>node objects</a>
8291
+ which can be referenced from a primary <a>node object</a>.
8292
+ Semantically, this is the same as if the node objects were embedded, or were contained
8293
+ in some enclosing <a>array</a>.</p>
8294
+
8295
+ <p>For an example, consider a node object containing a list of different items,
8296
+ some of which share some common elements:</p>
8297
+
8298
+ <pre class="example input"
8299
+ id="included-blocks-to-be-flattened"
8300
+ title="Included Blocks"
8301
+ data-transform="updateExample">
8302
+ <!--
8303
+ {
8304
+ "@context": {
8305
+ "@version": 1.1,
8306
+ "@vocab": "http://example.org/",
8307
+ "@base": "http://example.org/base/",
8308
+ "id": "@id",
8309
+ "type": "@type",
8310
+ "included": "@included",
8311
+ "enum": "http://example.org/enum#",
8312
+ "classification": {"@type": "@id"},
8313
+ "service": {"@type": "@id"},
8314
+ "included": "@included"
8315
+ },
8316
+ "id": "http://example.org/base/1",
8317
+ "type": "Thing-with-Items",
8318
+ "items": [{
8319
+ "id":"http://example.org/base/2",
8320
+ "classification": "enum:c6",
8321
+ "service": "enum:s2"
8322
+ },####
8323
+ 3...26 go here####
8324
+ {
8325
+ "id": "http://example.org/base/27",
8326
+ "classification": "enum:c6"
8327
+ }],
8328
+ "included": [
8329
+ {"id": "enum:c6", "type": "Type", "label": "Classification 6"},
8330
+ {"id": "enum:s2", "type": "Service", "label": "Login Service"}
8331
+ ]
8332
+ }
8333
+ -->
8334
+ </pre>
8335
+
8336
+ <p>When <a>flattened</a>, this will move the `enum:c6` and `enum:s2` elements
8337
+ from the <a>included block</a> into the outer <a>array</a>.</p>
8338
+
8339
+ <aside class="example ds-selector-tabs"
8340
+ title="Flattened form for included blocks">
8341
+ <div class="selectors">
8342
+ <button class="selected" data-selects="flattened">Flattened (Result)</button>
8343
+ <button data-selects="statements">Statements</button>
8344
+ <button data-selects="turtle">Turtle</button>
8345
+ <a class="playground" target="_blank"
8346
+ data-result-for="#included-blocks-to-be-flattened"></a>
8347
+ </div>
8348
+ <pre class="flattened result selected" data-transform="updateExample"
8349
+ data-flatten
8350
+ data-result-for="Included Blocks">
8351
+ <!--
8352
+ [{
8353
+ "@id": "http://example.org/base/1",
8354
+ "@type": ["http://example.org/Thing-with-Items"],
8355
+ "http://example.org/items": [
8356
+ {"@id": "http://example.org/base/2"},
8357
+ {"@id": "http://example.org/base/27"}
8358
+ ]
8359
+ }, {
8360
+ "@id": "http://example.org/enum#c6",
8361
+ "@type": ["http://example.org/Type"],
8362
+ "http://example.org/label": [{"@value": "Classification 6"}]
8363
+ }, {
8364
+ "@id": "http://example.org/enum#s2",
8365
+ "@type": ["http://example.org/Service"],
8366
+ "http://example.org/label": [{"@value": "Login Service"}]
8367
+ }, {
8368
+ "@id": "http://example.org/base/2",
8369
+ "http://example.org/classification": [{"@id": "http://example.org/enum#c6"}],
8370
+ "http://example.org/service": [{"@id": "http://example.org/enum#s2"}]
8371
+ }, {
8372
+ "@id": "http://example.org/base/27",
8373
+ "http://example.org/classification": [{"@id": "http://example.org/enum#c6"}]
8374
+ }
8375
+ ]
8376
+ -->
8377
+ </pre>
8378
+ <table class="statements"
8379
+ data-result-for="Flattened form for included blocks-flattened"
8380
+ data-to-rdf>
8381
+ <thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
8382
+ <tbody>
8383
+ <tr><td>http://example.org/base/1</td><td>rdf:type</td><td>http://example.org/Thing-with-Items</td></tr>
8384
+ <tr><td>http://example.org/base/1</td><td>http://example.org/items</td><td>http://example.org/base/2</td></tr>
8385
+ <tr><td>http://example.org/base/1</td><td>http://example.org/items</td><td>http://example.org/base/27</td></tr>
8386
+ <tr><td>http://example.org/base/2</td><td>http://example.org/classification</td><td>http://example.org/enum#c6</td></tr>
8387
+ <tr><td>http://example.org/base/2</td><td>http://example.org/service</td><td>http://example.org/enum#s2</td></tr>
8388
+ <tr><td>http://example.org/base/27</td><td>http://example.org/classification</td><td>http://example.org/enum#c6</td></tr>
8389
+ <tr><td>http://example.org/enum#c6</td><td>rdf:type</td><td>http://example.org/Type</td></tr>
8390
+ <tr><td>http://example.org/enum#c6</td><td>http://example.org/label</td><td>Classification 6</td></tr>
8391
+ <tr><td>http://example.org/enum#s2</td><td>rdf:type</td><td>http://example.org/Service</td></tr>
8392
+ <tr><td>http://example.org/enum#s2</td><td>http://example.org/label</td><td>Login Service</td></tr>
8393
+ </tbody>
8394
+ </table>
8395
+ <pre class="turtle"
8396
+ data-content-type="text/turtle"
8397
+ data-result-for="Flattened form for included blocks-flattened"
8398
+ data-transform="updateExample"
8399
+ data-to-rdf>
8400
+ <!--
8401
+ @base <http://example.org/base/> .
8402
+ @prefix ex: <http://example.org/> .
8403
+ @prefix enum: <http://example.org/enum#> .
8404
+
8405
+ <1> a ex:Thing-with-Items;
8406
+ ex:items <2>, <27> .
8407
+
8408
+ <2> ex:classification enum:c6;
8409
+ ex:service enum:s2 .
8410
+
8411
+ <27> ex:classification enum:c6 .
8412
+
8413
+ enum:c6 a ex:Type;
8414
+ ex:label "Classification 6" .
8415
+
8416
+ enum:s2 a ex:Service;
8417
+ ex:label "Login Service" .
8418
+ -->
8419
+ </pre>
8420
+ </aside>
8421
+ </section>
8422
+
8275
8423
<section class="informative"><h2>Reverse Properties</h2>
8276
8424
8277
8425
<p>JSON-LD serializes directed <a>graphs</a>. That means that
@@ -11535,6 +11683,7 @@ <h2>Node Objects</h2>
11535
11683
<ul>
11536
11684
<li><code>@context</code>,</li>
11537
11685
<li><code>@id</code>,</li>
11686
+ <li class="changed"><code>@included</code>,</li>
11538
11687
<li><code>@graph</code>,</li>
11539
11688
<li class="changed"><code>@nest</code>,</li>
11540
11689
<li><code>@type</code>,</li>
@@ -11587,6 +11736,11 @@ <h2>Node Objects</h2>
11587
11736
a <a>relative IRI</a>, a <a>compact IRI</a>, a <a>blank node identifier</a>,
11588
11737
a <a>node object</a> or an <a>array</a> containing a combination of these.</p>
11589
11738
11739
+ <p class="changed">If the <a>node object</a> contains the <code>@included</code> key,
11740
+ its value MUST be an <a>included block</a>.
11741
+ See <a class="sectionRef" href="#included-blocks"></a> for further discussion
11742
+ on <a>included blocks</a>.</p>
11743
+
11590
11744
<p>If the <a>node object</a> contains the <code>@index</code> key,
11591
11745
its value MUST be a <a>string</a>. See
11592
11746
<a class="sectionRef" href="#data-indexing"></a> for further discussion
@@ -11617,6 +11771,7 @@ <h2>Node Objects</h2>
11617
11771
<li>an <a>array</a> of zero or more of any of the possibilities above,</li>
11618
11772
<li>a <a>language map</a>,</li>
11619
11773
<li>an <a>index map</a>,</li>
11774
+ <li class="changed">an <a>included block</a></li>
11620
11775
<li class="changed">an <a>id map</a>, or</li>
11621
11776
<li class="changed">a <a>type map</a></li>
11622
11777
</ul>
@@ -11918,6 +12073,16 @@ <h2>Type Maps</h2>
11918
12073
added as a <code>@type</code> of the <a>node object</a> value when expanding.</p>
11919
12074
</section>
11920
12075
12076
+ <section class="changed">
12077
+ <h2>Included Blocks</h2>
12078
+
12079
+ <p>An <a>included block</a> is used to provide a set of <a>node objects</a>.
12080
+ An <a>included block</a> MAY appear as the value of a member of a node object with the key of `@included`, or an alias.
12081
+ An <a>included block</a> is either a <a>node object</a> or an array of <a>node objects</a>.</p>
12082
+
12083
+ <p>When <a data-lt="expansion">expanding</a>, multiple <a>included blocks</a> will be coalesced into a single <a>included block</a>.</p>
12084
+ </section>
12085
+
11921
12086
<section class="changed">
11922
12087
<h2>Property Nesting</h2>
11923
12088
@@ -12246,6 +12411,12 @@ <h2>Keywords</h2>
12246
12411
This keyword is described further in <a class="sectionRef" href="#context-definitions"></a>,
12247
12412
and <a class="sectionRef" href="#default-vocabulary"></a>.
12248
12413
</dd>
12414
+ <dt><code>@included</code></dt><dd>
12415
+ The `@included` keyword MAY be aliased,
12416
+ its value MUST be an <a>included block</a>.
12417
+ This keyword is described further in <a class="sectionRef" href="#included-nodes"></a>,
12418
+ and <a class="sectionRef" href="#included-blocks"></a>.
12419
+ </dd>
12249
12420
</dl>
12250
12421
</section>
12251
12422
</section>
@@ -13171,6 +13342,13 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
13171
13342
<li>A context may contain an <code>@import</code> <a>entry</a> used to reference a remote context
13172
13343
within a context, allowing <code>JSON-LD 1.1</code> features to be added to contexts originally
13173
13344
authored for <code>JSON-LD 1.0</code>.</li>
13345
+ <li>A <a>node object</a> may include an <a>included block</a>,
13346
+ which is used to contain a set of <a>node objects</a> which are treated
13347
+ exactly as if they were <a>node objects</a> defined in an <a>array</a> including the containing
13348
+ <a>node object</a>.
13349
+ This allows the use of the object form of a JSON-LD document when there is more
13350
+ than one <a>node object</a> being defined, and where those <a>node objects</a>
13351
+ are not embedded as values of the containing <a>node object</a>.</li>
13174
13352
</ul>
13175
13353
</section>
13176
13354
0 commit comments