Skip to content
Prev Previous commit
Next Next commit
Describe @none in the @graph @index case, and note potential issu…
…es on merging multiple unindexed or unnamed graphs.
  • Loading branch information
gkellogg committed Jan 19, 2018
commit 82f0526fac4a51751b81cfea7dea7e4e1153a19a
81 changes: 80 additions & 1 deletion spec/latest/json-ld/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,81 @@ <h3>Named Graph Indexing</h3>

<p>As with <a>index maps</a>, when used with <code>@graph</code>, a container may also
include <code>@set</code> to ensure that key values are always contained in an array.</p>

<p class="changed">The special index <code>@none</code> is used for indexing
graphs which does not have an <code>@index</code> key, which is useful to maintain
a normalized representation. <span class="note">Note, however, that
compacting a document where multiple unidentified named graphs are
compacted using the <code>@none</code> index will result in the content
of those graphs being merged. To prevent this, give each graph a distinct
<code>@index</code> key.</span></p>

<pre class="example nohighlight" data-transform="updateExample"
title="Indexing languaged-tagged strings using @none for no language">
<pre class="example nohighlight" data-transform="updateExample"
title="Indexing graph data in JSON-LD">
<!--
{
"@context": {
"@version": 1.1,
"schema": "http://schema.org/",
"name": "schema:name",
"body": "schema:articleBody",
"words": "schema:wordCount",
"post": {
"@id": "schema:blogPost",
"@container": ["@graph", "@index"]
}
},
"@id": "http://example.com/",
"@type": "schema:Blog",
"name": "World Financial News",
"post": {
"en": {
"@id": "http://example.com/posts/1/en",
"body": "World commodities were up today with heavy trading of crude oil...",
"words": 1539
},
"@none": {
"@id": "http://example.com/posts/1/de",
"body": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl...",
"words": 1204
}
}
}
-->
</pre>

<p>This expands to the following:</p>

<pre class="example nohighlight" data-transform="updateExample"
title="Referencing named graphs after expansion">
<!--
[{
"@id": "http://example.com/",
"@type": ["http://schema.org/Blog"],
"http://schema.org/blogPost": [{
"@graph": [{
"@id": "http://example.com/posts/1/de",
"http://schema.org/articleBody": [{
"@value": "Die Werte an Warenbörsen stiegen im Sog eines starken Handels von Rohöl..."
}],
"http://schema.org/wordCount": [{"@value": 1204}]
}]
}, {
"@graph": [{
"@id": "http://example.com/posts/1/en",
"http://schema.org/articleBody": [{
"@value": "World commodities were up today with heavy trading of crude oil..."
}],
"http://schema.org/wordCount": [{"@value": 1539}]
}],
"@index": "en"
}],
"http://schema.org/name": [{"@value": "World Financial News"}]
}]
-->
</pre>
</section>

<section class="informative changed">
Expand Down Expand Up @@ -3552,7 +3627,11 @@ <h3>Named Graph Indexing by Identifier</h3>
<p>As with <a>id maps</a>, the special index <code>@none</code> is used for indexing
<a>named graphs</a> which do not have an <code>@id</code>, which is useful to maintain
a normalized representation. The <code>@none</code> index may also be
a term which expands to <code>@none</code>.</p>
a term which expands to <code>@none</code>.
<span class="note">Note, however, that if multiple graphs are represented without
an <code>@id</code>, they will be merged on expansion. To prevent this,
use <code>@none</code> judiciously, and consider giving graphs
their own distinct identifier.</span></p>

<pre class="example nohighlight" data-transform="updateExample"
title="Referencing named graphs using an id map with @none">
Expand Down