Skip to content

Commit

Permalink
Improved Named Graphs section
Browse files Browse the repository at this point in the history
Addressed feedback from Peter Patel-Schneider:

"@graph is not needed "to express a set of JSON-LD node definitions that may
not be directly related to one another".  This wording should be changed."
  • Loading branch information
lanthaler committed Oct 22, 2012
1 parent 1b98c3e commit dc9e1d2
Showing 1 changed file with 123 additions and 123 deletions.
246 changes: 123 additions & 123 deletions spec/latest/json-ld-syntax/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2248,10 +2248,121 @@ <h2>Embedding</h2>

<section>
<h2>Named Graphs</h2>
<p>The <code>@graph</code> <tref>keyword</tref> is used to express a set of
JSON-LD <tref>node definition</tref>s that may not be directly related
to one another through a property. The mechanism may also be used where
<tref>embedding</tref> is not desirable to the application. For example:</p>

<p>At times, it is necessary to to make statements about a <tref>JSON-LD graph</tref>

This comment has been minimized.

Copy link
@scor

scor Oct 22, 2012

Contributor

double "to" here

This comment has been minimized.

Copy link
@lanthaler

lanthaler via email Oct 22, 2012

Author Member
itself, rather than just a single <tref>node</tref>. This can be done by
grouping a set of <tref title="node">nodes</tref> using the <code>@graph</code>
<tref>keyword</tref>. A developer MAY also name data expressed using the
<code>@graph</code> <tref>keyword</tref> by pairing it with an
<code>@id</code> <tref>keyword</tref> as shown in the following example:</p>

<pre class="example" data-transform="updateExample">
<!--
{
"@context": {
"asOf": "http://purl.org/net/provenance/ns#accessedResource",
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
****"@id": "http://example.org/graphs/73",
"asOf": { "@value": "2012-04-09", "@type": "xsd:date" },
"@graph":****
[
{
"@id": "http://manu.sporny.org/i/public",
"@type": "Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/i/public"
}
]
}
-->
</pre>

<p>The example above expresses a <em>named</em> <tref>JSON-LD graph</tref>
that is identified by the <tref>IRI</tref>
<code>http://example.org/graphs/73</code>. That graph is composed of the
statements about Manu and Gregg. Metadata about the graph itself is also
expressed via the <code>asOf</code> property, which specifies when the
information was retrieved from the Web. An alternative view of the
information above is represented in table form below:</p>

<table class="example">
<thead>
<th>Graph</th>
<th>Subject</th>
<th>Property</th>
<th>Object</th>
<th>Datatype</th>
</thead>
<tbody>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://example.org/graphs/73</td>
<td>http://purl.org/net/provenance/ns#accessedResource</td>
<td>2012-04-09</td>
<td>http://www.w3.org/2001/XMLSchema#date</td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://www.w3.org/2001/XMLSchema#type</td>
<td>http://xmlns.com/foaf/0.1/Person</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://xmlns.com/foaf/0.1/name</td>
<td>Manu Sporny</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://xmlns.com/foaf/0.1/knows</td>
<td>http://greggkellogg.net/foaf#me</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://www.w3.org/2001/XMLSchema#type</td>
<td>http://xmlns.com/foaf/0.1/Person</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://xmlns.com/foaf/0.1/name</td>
<td>Gregg Kellogg</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://xmlns.com/foaf/0.1/knows</td>
<td>http://manu.sporny.org/i/public</td>
<td></td>
</tr>
</tbody>
</table>

<p>When <code>@graph</code> is used in a document's top-level object which
has no other <tref title="property">properties</tref> that are mapped
to an <tref>IRI</tref> or a <tref>keyword</tref> it is considered to
express the otherwise implicit default graph. This mechanism can be useful
when a number of <tref title="node">nodes</tref> thay may not directly
relate to one another through a property or where <tref>embedding</tref>
is not desirable to the application. For example:</p>

<pre class="example" data-transform="updateExample">
<!--
Expand All @@ -2276,19 +2387,17 @@ <h2>Named Graphs</h2>
-->
</pre>

<p>In this case, embedding doesn't work as each
<tref>node definition</tref> references the other. Using the
<code>@graph</code> <tref>keyword</tref> allows multiple resources to be
defined within an <tref>array</tref>, and allows the use of a shared
<tref>context</tref>. When used in a <tref>JSON object</tref> that is not otherwise
a <tref>node definition</tref>, this describes resources in the <em>default graph</em>.
This is equivalent to using multiple <tref
title="node definition">node definitions</tref> in array and defining
<p>In this case, embedding doesn't work as each <tref>node definition</tref>
references the other. Using the <code>@graph</code> <tref>keyword</tref>
allows multiple <tref title="node">nodes</tref> to be defined within an
<tref>array</tref>, and allows the use of a shared <tref>context</tref>.
This is equivalent to using multiple
<tref title="node definition">node definitions</tref> in array and defining
the <code>@context</code> within each <tref>node definition</tref>:</p>

<pre class="example" data-transform="updateExample">
<!--
****[****
[
{
****"@context": ...,****
"@id": "http://manu.sporny.org/i/public",
Expand All @@ -2303,119 +2412,10 @@ <h2>Named Graphs</h2>
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/i/public"
}
****]****
-->
</pre>

<p>JSON-LD allows you to <em>name</em> things on the Web by assigning
an <code>@id</code> to them, which is typically an <tref>IRI</tref>.
This notion extends to the ability to identify graphs in the same
manner. A developer may name data expressed using the <code>@graph</code>
<tref>keyword</tref> by pairing it with an <code>@id</code>
<tref>keyword</tref>. This enables the developer to make statements
about a <tref>JSON-LD graph</tref> itself,
rather than just a single <tref>node</tref>.</p>

<pre class="example" data-transform="updateExample">
<!--
{
"@context": {
"asOf": "http://purl.org/net/provenance/ns#accessedResource",
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"knows": "http://xmlns.com/foaf/0.1/knows",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
****"@id": "http://example.org/graphs/73",
"asOf": { "@value": "2012-04-09", "@type": "xsd:date" },
"@graph":****
[
{
"@id": "http://manu.sporny.org/i/public",
"@type": "Person",
"name": "Manu Sporny",
"knows": "http://greggkellogg.net/foaf#me"
},
{
"@id": "http://greggkellogg.net/foaf#me",
"@type": "Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/i/public"
}
]
}
]
-->
</pre>

<p>The example above expresses a <em>named</em>
<tref>JSON-LD graph</tref> that is identified by the <tref>IRI</tref>
<code>http://example.org/graphs/73</code>. That graph is composed of the
statements about Manu and Gregg. Metadata about the graph itself is also
expressed via the <code>asOf</code> property, which specifies when the
information was retrieved from the Web. An alternative view of the
information above is represented in table form below:</p>

<table class="example">
<thead>
<th>Graph</th>
<th>Subject</th>
<th>Property</th>
<th>Object</th>
<th>Datatype</th>
</thead>
<tbody>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://example.org/graphs/73</td>
<td>http://purl.org/net/provenance/ns#accessedResource</td>
<td>2012-04-09</td>
<td>http://www.w3.org/2001/XMLSchema#date</td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://www.w3.org/2001/XMLSchema#type</td>
<td>http://xmlns.com/foaf/0.1/Person</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://xmlns.com/foaf/0.1/name</td>
<td>Manu Sporny</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://manu.sporny.org/i/public</td>
<td>http://xmlns.com/foaf/0.1/knows</td>
<td>http://greggkellogg.net/foaf#me</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://www.w3.org/2001/XMLSchema#type</td>
<td>http://xmlns.com/foaf/0.1/Person</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://xmlns.com/foaf/0.1/name</td>
<td>Gregg Kellogg</td>
<td></td>
</tr>
<tr>
<td>http://example.org/graphs/73</td>
<td>http://greggkellogg.net/foaf#me</td>
<td>http://xmlns.com/foaf/0.1/knows</td>
<td>http://manu.sporny.org/i/public</td>
<td></td>
</tr>
</tbody>
</table>

</section>

<section>
Expand Down

0 comments on commit dc9e1d2

Please sign in to comment.