Skip to content

Type as set #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "https://rubygems.org"

gem 'json-ld', github: 'ruby-rdf/json-ld', branch: 'develop'
gem 'nokogiri'
gem 'linkeddata'
gem 'colorize'
Expand Down
21 changes: 14 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: git://github.com/ruby-rdf/json-ld.git
revision: 53ed283d8c66924c58262962223326177c7053b1
branch: develop
specs:
json-ld (3.0.2)
multi_json (~> 1.12)
rdf (>= 2.2.8, < 4.0)

GEM
remote: https://rubygems.org/
specs:
Expand All @@ -22,9 +31,6 @@ GEM
htmlentities (4.3.4)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
json-ld (3.0.1)
multi_json (~> 1.12)
rdf (>= 2.2.8, < 4.0)
json-ld-preloaded (3.0.1)
json-ld (~> 3.0)
multi_json (~> 1.12)
Expand Down Expand Up @@ -71,7 +77,7 @@ GEM
nokogiri
public_suffix (3.0.3)
rake (12.3.1)
rdf (3.0.3)
rdf (3.0.4)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (2.2.1)
Expand Down Expand Up @@ -111,13 +117,13 @@ GEM
rdf (>= 2.2, < 4.0)
rdf-vocab (>= 2.2, < 4.0)
rdf-xsd (>= 2.2, < 4.0)
rdf-trig (3.0.0)
rdf-trig (3.0.1)
ebnf (~> 1.1)
rdf (~> 3.0)
rdf-turtle (~> 3.0, >= 3.0.2)
rdf-turtle (~> 3.0, >= 3.0.3)
rdf-trix (2.2.1)
rdf (>= 2.2, < 4.0)
rdf-turtle (3.0.2)
rdf-turtle (3.0.3)
ebnf (~> 1.1)
rdf (~> 3.0)
rdf-vocab (3.0.3)
Expand Down Expand Up @@ -153,6 +159,7 @@ PLATFORMS

DEPENDENCIES
colorize
json-ld!
linkeddata
nokogiri
rake
Expand Down
7 changes: 7 additions & 0 deletions examples/example-032-Setting-container-set-on-type.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": {
"@version": 1.1,
"@type": {"@container": "@set"}
},
"@type": ["http:/example.org/type"]
}
33 changes: 33 additions & 0 deletions examples/example-103-Linked-Data-Dataset-compacted.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"@context": [
"http://schema.org/",
{"@base": "http://example.com/"}
],
"@graph": [{
"@id": "people/alice",
"gender": [
{"@value": "weiblich", "@language": "de"},
{"@value": "female", "@language": "en"}
],
"knows": {"@id": "people/bob"},
"name": "Alice"
}, {
"@id": "graphs/1",
"@graph": {
"@id": "people/alice",
"parent": {
"@id": "people/bob",
"name": "Bob"
}
}
}, {
"@id": "graphs/2",
"@graph": {
"@id": "people/bob",
"sibling": {
"name": "Mary",
"sibling": {"@id": "people/bob"}
}
}
}]
}
31 changes: 31 additions & 0 deletions examples/example-103-Linked-Data-Dataset-expanded.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[{
"@id": "http://example.com/people/alice",
"http://schema.org/name": [{"@value": "Alice"}],
"http://schema.org/gender": [
{"@value": "weiblich","@language": "de"},
{"@value": "female","@language": "en"}
],
"http://schema.org/knows": [
{"@id": "http://example.com/people/bob"}
]
}, {
"@id": "http://example.com/graphs/1",
"@graph": [{
"@id": "http://example.com/people/alice",
"http://schema.org/parent": [{
"@id": "http://example.com/people/bob",
"http://schema.org/name": [{"@value": "Bob"}]
}]
}]
}, {
"@id": "http://example.com/graphs/2",
"@graph": [{
"@id": "http://example.com/people/bob",
"http://schema.org/sibling": [{
"http://schema.org/name": [{"@value": "Mary"}],
"http://schema.org/sibling": [
{"@id": "http://example.com/people/bob"}
]
}]
}]
}]
74 changes: 74 additions & 0 deletions examples/example-103-Linked-Data-Dataset-statements.table
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<table class="statements" data-result-for="Linked Data Dataset-expanded" data-to-rdf>
<thead><tr>
<th>Graph</th>
<th>Subject</th>
<th>Property</th>
<th>Value</th>
<th>Language</th>
</tr></thead>
<tbody>
<tr>
<td> </td>
<td>http://example.com/people/alice</td>
<td>schema:name</td>
<td>Alice</td>
<td></td>
</tr>
<tr>
<td> </td>
<td>http://example.com/people/alice</td>
<td>schema:gender</td>
<td>weiblich</td>
<td>de</td>
</tr>
<tr>
<td> </td>
<td>http://example.com/people/alice</td>
<td>schema:gender</td>
<td>female</td>
<td>en</td>
</tr>
<tr>
<td> </td>
<td>http://example.com/people/alice</td>
<td>schema:knows</td>
<td>http://example.com/people/bob</td>
<td></td>
</tr>
<tr>
<td>http://example.com/graphs/1</td>
<td>http://example.com/people/bob</td>
<td>schema:name</td>
<td>Bob</td>
<td></td>
</tr>
<tr>
<td>http://example.com/graphs/1</td>
<td>http://example.com/people/alice</td>
<td>schema:parent</td>
<td>http://example.com/people/bob</td>
<td></td>
</tr>
<tr>
<td>http://example.com/graphs/2</td>
<td>http://example.com/people/bob</td>
<td>schema:sibling</td>
<td>_:b0</td>
<td></td>
</tr>
<tr>
<td>http://example.com/graphs/2</td>
<td>_:b0</td>
<td>schema:name</td>
<td>Mary</td>
<td></td>
</tr>
<tr>
<td>http://example.com/graphs/2</td>
<td>_:b0</td>
<td>schema:sibling</td>
<td>http://example.com/people/bob</td>
<td></td>
</tr>
</tbody>
</table>
14 changes: 14 additions & 0 deletions examples/example-103-Linked-Data-Dataset-trig.trig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix schema: <http://schema.org/> .
<http://example.com/people/alice> schema:knows <http://example.com/people/bob>;
schema:name "Alice";
schema:gender "weiblich"@de, "female"@en .
<http://example.com/graphs/1> {
<http://example.com/people/alice> schema:parent <http://example.com/people/bob> .
<http://example.com/people/bob> schema:name "Bob" .
}
<http://example.com/graphs/2> {
<http://example.com/people/bob> schema:sibling [
schema:name "Mary";
schema:sibling <http://example.com/people/bob>
] .
}
32 changes: 30 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,27 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
<a>keywords</a> have been given the aliases
<strong>url</strong> and <strong>a</strong>, respectively.</p>

<p><span class="changed">Other than for <code>@type</code>,</span> properties of
<a>expanded term definitions</a> where the term is a <a>keyword</a> are be ignored.</p>

<p class="changed">When <a>processing mode</a> is set to <code>json-ld-1.1</code>,
<code>@type</code> may be used with an <a>expanded term definition</a> with <code>@container</code> set
to <code>@set</code>; no other members may be set within such an <a>expanded term definition</a>.
This is used by the <a data-cite="JSON-LD11-API#compaction-algorithm">Compaction algorithm</a> to ensure that the values of @type (or an alias)
are always represented in an <a>array</a>.</p>

<pre class="example" data-transform="updateExample" title="Setting @container: @set on @type">
<!--
{
"@context": {
"@version": 1.1,
"@type": {"@container": "@set"}
},
"@type": ["http:/example.org/type"]
}
-->
</pre>

<p>Since keywords cannot be redefined, they can also not be aliased to
other keywords.</p>

Expand Down Expand Up @@ -8999,7 +9020,7 @@ <h2>Context Definitions</h2>
<p>A <a>context definition</a> MUST be a <a>dictionary</a> whose
keys MUST be either <a>terms</a>, <a>compact IRIs</a>, <a>absolute IRIs</a>,
or one of the <a>keywords</a> <code>@language</code>, <code>@base</code>,
<code>@vocab</code>, or <code class="changed">@version</code>.</p>
<code class="changed">@type</code>, <code>@vocab</code>, or <code class="changed">@version</code>.</p>

<p>If the <a>context definition</a> has an <code>@language</code> key,
its value MUST have the <a data-cite="BCP47#section-2.1.1">lexical form</a> described in [[!BCP47]] or be <a>null</a>.</p>
Expand All @@ -9008,6 +9029,9 @@ <h2>Context Definitions</h2>
its value MUST be an <a>absolute IRI</a>, a <a>relative IRI</a>,
or <a>null</a>.</p>

<p class="changed">If the <a>context definition</a> has an <code>@type</code> key,
its value MUST be a <a>dictionary</a> with the single member <code>@container</code> set to <code>@set</code>.</p>

<p>If the <a>context definition</a> has an <code>@vocab</code> key,
its value MUST be a <a>absolute IRI</a>, a <a>compact IRI</a>,
a <a>blank node identifier</a>,
Expand Down Expand Up @@ -9840,14 +9864,18 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
a context. When this is set, vocabulary-relative IRIs, such as the
keys of <a>node objects</a>, are expanded or compacted relative
to the <a>base IRI</a> using string concatenation.</li>
<li><a>Lists</a> may now have items which are themselves <a>lists</a>.</li>
</ul>
<p>Additionally, see <a href="#changes-from-cg" class="sectionRef"></a>.</p>
</section>

<section class="appendix informative" id="changes-from-cg">
<h2>Changes since JSON-LD Community Group Final Report</h2>
<ul>
<li><a>Lists</a> may now have items which are themselves <a>lists</a>.</li>
<li>Values of <code>@type</code>, or an alais of <code>@type</code>, may now have their <code>@container</code> set to <code>@set</code>
to ensure that <code>@type</code> members are always represented as an array. This
also allows a term to be defined for <code>@type</code>, where the value MUST be a <a>dictionary</a>
with <code>@container</code> set to <code>@set</code>.</li>
</ul>
</section>

Expand Down
8 changes: 8 additions & 0 deletions yaml/example-032-Setting-container-set-on-type.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Example 032: Setting @container: @set on @type
---
"@context":
"@version": 1.1
"@type":
"@container": "@set"
"@type":
- http:/example.org/type
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 032: IRI expansion within a context
Example 033: IRI expansion within a context
---
"@context":
xsd: http://www.w3.org/2001/XMLSchema#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 033: Using a term to define the IRI of another term within a context
Example 034: Using a term to define the IRI of another term within a context
---
"@context":
foaf: http://xmlns.com/foaf/0.1/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 034: Using a compact IRI as a term
Example 035: Using a compact IRI as a term
---
"@context":
foaf: http://xmlns.com/foaf/0.1/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 035: Associating context definitions with absolute IRIs
Example 036: Associating context definitions with absolute IRIs
---
"@context":
foaf: http://xmlns.com/foaf/0.1/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 037: Defining an @context within a term definition-expanded
Example 038: Defining an @context within a term definition-expanded
---
- http://xmlns.com/foaf/0.1/interest:
- "@id": https://www.w3.org/TR/json-ld11/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 037: Defining an @context within a term definition-original
Example 038: Defining an @context within a term definition-original
---
"@context":
"@version": 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 038: Defining an @context within a term definition used on @type-expanded
Example 039: Defining an @context within a term definition used on @type-expanded
---
- "@type":
- http://schema.org/Person
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 038: Defining an @context within a term definition used on @type-original
Example 039: Defining an @context within a term definition used on @type-original
---
"@context":
"@version": 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 039: Expanded term definition with type coercion-expanded
Example 040: Expanded term definition with type coercion-expanded
---
- "@id": http://example.com/docs/1
http://purl.org/dc/terms/modified:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 039: Expanded term definition with type coercion-original
Example 040: Expanded term definition with type coercion-original
---
"@context":
modified:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 040: Expanded value with type-expanded
Example 041: Expanded value with type-expanded
---
- http://purl.org/dc/terms/modified:
- "@type": http://www.w3.org/2001/XMLSchema#dateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 040: Expanded value with type-original
Example 041: Expanded value with type-original
---
"@context":
modified:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 041: Example demonstrating the context-sensitivity for @type
Example 042: Example demonstrating the context-sensitivity for @type
---
"@id": http://example.org/posts#TripToWestVirginia
"@type": http://schema.org/BlogPosting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 043: Expanded term definition with types-expanded
Example 044: Expanded term definition with types-expanded
---
- "@id": http://example.com/people#john
http://xmlns.com/foaf/0.1/name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Example 043: Expanded term definition with types-original
Example 044: Expanded term definition with types-original
---
"@context":
xsd: http://www.w3.org/2001/XMLSchema#
Expand Down
Loading