Skip to content

Commit

Permalink
Added more explanation about the context-sensitivity for @type.
Browse files Browse the repository at this point in the history
  • Loading branch information
msporny committed Aug 19, 2012
1 parent a8366dc commit cf4bde9
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions spec/latest/json-ld-syntax/index.html
Expand Up @@ -1057,8 +1057,8 @@ <h2>Identifying the Subject</h2>
<h2>Specifying the Type</h2>

<p>The type of a particular subject can be specified using the
<code>@type</code> <tref>keyword</tref>. Specifying the type in this way will generate a
triple of the form (subject, type, type-IRI). To be considered
<code>@type</code> <tref>keyword</tref>. Specifying the type in this way will
generate a triple of the form (subject, type, type-IRI). To be considered
<tref>Linked Data</tref>, types MUST be uniquely identified by
an <tref>IRI</tref>.</p>

Expand Down Expand Up @@ -1398,14 +1398,42 @@ <h2>Typed Values</h2>
also possible to use a <tref>term</tref> or a <tref>compact IRI</tref> to
express the value of a type.</p>

<p class="note">
The <code>@type</code> <tref>keyword</tref> is also used to associate a type with
a <tref>subject</tref>. Although the same keyword is used in both places,
the concept of an <em>object type</em> and a <em>value type</em>
are different. This is similar to object-oriented programming languages
where both scalar and structured types use the same class inheritance
mechanism, even though scalar types and structured types are
inherently different.
The <code>@type</code> <tref>keyword</tref> is also used to associate a type
with a <tref>subject</tref>. The concept of an <tdef>subject type</tdef> and
a <tdef>value type</tdef> are different. This is similar to object-oriented
programming languages where both scalar and structured types use the same
class inheritance mechanism, even though scalar types and structured types are
inherently different.

<pre class="example" data-transform="updateExample"
title="Example demonstrating the context-sensitivity for @type">
<!--
{
...
"@id": "http://example.org/posts#TripToWestVirginia",
****"@type": "http://schema.org/BlogPosting"****,
"modified":
{
"@value": "2010-05-29T14:17:39+02:00",
****"@type": "http://www.w3.org/2001/XMLSchema#dateTime"****
}
...
}
-->
</pre>

<p>
The first use of <code>@type</code> associates a <tref>subject type</tref>
(<code>http://schema.org/BlogPosting</code>) with the <tref>subject</tref>,
which is expressed using the <code>@id</code> <tref>keyword</tref>.
The second use of <code>@type</code> associates a <tref>value type</tref>
(<code>http://www.w3.org/2001/XMLSchema#dateTime</code>) with the
<tref>object</tref>, which is expressed using the <code>@value</code>
<tref>keyword</tref>. As a general rule, when <code>@value</code> and
<code>@type</code> are used in the same <tref>JSON object</tref>
in JSON-LD data, the <code>@type</code> <tref>keyword</tref> is expressing a
<tref>value type</tref>. Otherwise, the <code>@type</code>
<tref>keyword</tref> is expressing a <tref>subject type</tref>.
</p>

</section>
Expand Down

0 comments on commit cf4bde9

Please sign in to comment.