Skip to content

Update text on vocabulary mapping and @vocab to allow relative IRIs #114

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
Jan 15, 2019
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
dist: trusty
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
jobs:
include:
- stage: common
Expand Down
21 changes: 12 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
GIT
remote: git://github.com/ruby-rdf/json-ld.git
revision: a26c3205d006550f85162848a4a2bc3366b39970
revision: afe7b3b10547b552676d1379a2be4bc34cf83d02
branch: develop
specs:
json-ld (3.0.2)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.13)
rdf (~> 3.0, >= 3.0.4)
rack (>= 1.6, < 3.0)
rdf (~> 3.0, >= 3.0.8)

GEM
remote: https://rubygems.org/
Expand All @@ -16,7 +18,7 @@ GEM
i18n
builder (3.2.3)
colorize (0.8.1)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
ebnf (1.1.3)
rdf (~> 3.0)
Expand All @@ -29,7 +31,7 @@ GEM
hamster (3.0.0)
concurrent-ruby (~> 1.0)
htmlentities (4.3.4)
i18n (1.1.1)
i18n (1.5.1)
concurrent-ruby (~> 1.0)
json-ld-preloaded (3.0.2)
json-ld (~> 3.0)
Expand Down Expand Up @@ -67,17 +69,18 @@ GEM
shex (~> 0.5, >= 0.5.2)
sparql (~> 3.0)
sparql-client (~> 3.0)
mini_portile2 (2.3.0)
mini_portile2 (2.4.0)
multi_json (1.13.1)
net-http-persistent (3.0.0)
connection_pool (~> 2.2)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogiri (1.10.0)
mini_portile2 (~> 2.4.0)
nokogumbo (1.5.0)
nokogiri
public_suffix (3.0.3)
rack (2.0.6)
rake (12.3.2)
rdf (3.0.7)
rdf (3.0.9)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (2.2.1)
Expand Down Expand Up @@ -166,4 +169,4 @@ DEPENDENCIES
rake

BUNDLED WITH
1.17.1
1.17.3
113 changes: 90 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@ <h1>Advanced Concepts</h1>
not contain a colon).</p>

<aside class="example ds-selector-tabs"
title="Using a common vocabulary prefix">
title="Using a default vocabulary">
<div class="selectors">
<button class="selected" data-selects="original">Original</button>
<button data-selects="expanded">Expanded</button>
Expand All @@ -2068,7 +2068,7 @@ <h1>Advanced Concepts</h1>
-->
</pre>
<pre class="expanded nohighlight" data-transform="updateExample"
data-result-for="Using a common vocabulary prefix-original">
data-result-for="Using a default vocabulary-original">
<!--
[{
"@id": "http://example.org/places#BrewEats",
Expand All @@ -2078,7 +2078,7 @@ <h1>Advanced Concepts</h1>
-->
</pre>
<table class="statements"
data-result-for="Using a common vocabulary prefix-expanded"
data-result-for="Using a default vocabulary-expanded"
data-to-rdf>
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
<tbody>
Expand All @@ -2088,7 +2088,7 @@ <h1>Advanced Concepts</h1>
</table>
<pre class="turtle"
data-content-type="text/turtle"
data-result-for="Using a common vocabulary prefix-expanded"
data-result-for="Using a default vocabulary-expanded"
data-transform="updateExample"
data-to-rdf>
<!--
Expand Down Expand Up @@ -2161,31 +2161,97 @@ <h1>Advanced Concepts</h1>
schema:name "Brew Eats" .
-->
</pre>

</aside>

<section class="changed">
<h3>Using the Document Base as the Default Vocabulary</h3>
<p class="changed">Since <code>json-ld-1.1</code>,
the <a>vocabulary mapping</a> in a <a>local context</a> can be set to the a <a>relative IRI</a>,
which is concatentated to any <a>vocabulary mapping</a> in the <a>active context</a>
(see <a href="#document-relative-vocabulary-mapping" class="sectionRef"></a>
for how this applies if there is no <a>vocabulary mapping</a> in the <a>active context</a>).</p>

<aside class="example ds-selector-tabs"
title="Using a default vocabulary relative to a previous default vocabulary">
<div class="selectors">
<button class="selected" data-selects="original">Original</button>
<button data-selects="expanded">Expanded</button>
<button data-selects="statements">Statements</button>
<button data-selects="turtle">Turtle</button>
<a class="playground" target="_blank"></a>
</div>
<pre class="original selected nohighlight" data-transform="updateExample">
<!--
{
"@context": [{
"@vocab": ****"http://schema.org"****
}, ****{
"@version": 1.1,
"@vocab": "/"
}****],
"@id": "http://example.org/places#BrewEats",
"@type": "Restaurant",
"name": "Brew Eats"
####...####
}
-->
</pre>
<pre class="expanded nohighlight" data-transform="updateExample"
data-result-for="Using a default vocabulary relative to a previous default vocabulary-original">
<!--
[{
"@id": "http://example.org/places#BrewEats",
"@type": ["http://schema.org/Restaurant"],
"http://schema.org/name": [{"@value": "Brew Eats"}]
}]
-->
</pre>
<table class="statements"
data-result-for="Using a default vocabulary relative to a previous default vocabulary-expanded"
data-to-rdf>
<thead><tr><th>Subject</th><th>Property</th><th>Value</th></tr></thead>
<tbody>
<tr><td>http://example.org/places#BrewEats</td><td>rdf:type</td><td>schema:Restaurant</td></tr>
<tr><td>http://example.org/places#BrewEats</td><td>schema:name</td><td>Brew Eats</td></tr>
</tbody>
</table>
<pre class="turtle"
data-content-type="text/turtle"
data-result-for="Using a default vocabulary relative to a previous default vocabulary-expanded"
data-transform="updateExample"
data-to-rdf>
<!--
@prefix schema: <http://schema.org/> .

<http://example.org/places#BrewEats> a schema:Restaurant;
schema:name "Brew Eats" .
-->
</pre>
</aside>

<section id="document-relative-vocabulary-mapping" class="changed">
<h3>Using the Document Base for the Default Vocabulary</h3>
<p>In some cases, vocabulary terms are defined directly within the document
itself, rather than in an external vocabulary. Since
<code>json-ld-1.1</code>, the <a>vocabulary mapping</a> in the <a>active
context</a> can be set to the empty string <code>&quot;&quot;</code>, which causes terms which
are expanded relative to the vocabulary, such as the keys of <a>node
objects</a>, to use the <a>base IRI</a> to create <a>absolute
IRIs</a>.</p>
itself, rather than in an external vocabulary.
Since <code>json-ld-1.1</code>, the <a>vocabulary mapping</a> in a <a>local context</a>
can be set to a <a>relative IRI</a>,
which is, if there is no vocabulary mapping in scope, resolved against the <a>base IRI</a>.
This causes terms which are expanded relative to the vocabulary,
such as the keys of <a>node objects</a>,
to be based on the <a>base IRI</a> to create <a>absolute IRIs</a>.</p>

<pre class="example nohighlight" data-transform="updateExample"
title="Using &quot;&quot; as the vocabulary mapping"
title="Using &quot;#&quot; as the vocabulary mapping"
data-base="http://example/document">
<!--
{
"@context": {
****"@version": 1.1,****
****"@base": "http://example/document",****
"@vocab": ****""****
"@vocab": ****"#"****
},
"@id": "http://example.org/places#BrewEats",
"@type": ****"#Restaurant"****,
****"#name"****: "Brew Eats"
"@type": ****"Restaurant"****,
****"name"****: "Brew Eats"
####...####
}
-->
Expand Down Expand Up @@ -9658,7 +9724,7 @@ <h2>Context Definitions</h2>
<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>,
<span class="changed">an empty string (<code>&quot;&quot;</code>)</span>,
<span class="changed">a <a>relative IRI</a></span>,
a <a>term</a>, or <a>null</a>.</p>

<p class="changed">If the <a>context definition</a> has an <code>@version</code> key,
Expand Down Expand Up @@ -9916,7 +9982,7 @@ <h2>Keywords</h2>
<dt><code>@vocab</code></dt><dd>
The <code>@vocab</code> keyword MUST NOT be aliased and MAY be used as a key in a <a>context definition</a>
or as the value of <code>@type</code> in an <a>expanded term definition</a>.
Its value MUST be a <a>absolute IRI</a>, a <a>compact IRI</a>, a <a>blank node identifier</a>, an empty <a>string</a> (""), a <a>term</a>, or <a>null</a>.
Its value MUST be a <a>absolute IRI</a>, <span class="changed">a <a>relative IRI</a></span>, a <a>compact IRI</a>, a <a>blank node identifier</a>, an empty <a>string</a> (""), a <a>term</a>, or <a>null</a>.
This keyword is described further in <a class="sectionRef" href="#context-definitions"></a>,
and <a class="sectionRef" href="#default-vocabulary"></a>.
</dd>
Expand Down Expand Up @@ -9967,7 +10033,7 @@ <h2>Relationship to RDF</h2>
instead, consider one of the following mechanisms:</p>
<ul>
<li>a <a>relative IRI</a>, either relative to the document or the vocabulary
(see <a href="#using-the-document-base-as-the-default-vocabulary" class="sectionRef"></a> for a discussion on using the document base as the <a>vocabulary mapping</a>).</li>
(see <a href="#document-relative-vocabulary-mapping" class="sectionRef"></a> for a discussion on using the document base as part of the the <a>vocabulary mapping</a>).</li>
<li>a URN such as <code>urn:example:1</code>, see [[?URN]], or</li>
<li>a "Skolem IRI" as per
<a data-cite="RDF11-CONCEPTS#section-skolemization">Replacing Blank Nodes with IRIs</a>
Expand Down Expand Up @@ -10691,10 +10757,6 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
may include <code>"@set"</code>, which create maps from the
graph identifier or index value similar to <a>index maps</a>
and <a>id maps</a>.</li>
<li>The empty string (<code>&quot;&quot;</code>) has been added as a possible value for <code>@vocab</code> in
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>
</ul>
<p>Additionally, see <a href="#changes-from-cg" class="sectionRef"></a>.</p>
</section>
Expand All @@ -10709,6 +10771,11 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
with <code>@container</code> set to <code>@set</code>.</li>
<li>The use of <a>blank node identifiers</a> to label properties is obsolete,
and may be removed in a future version of JSON-LD, as is the support for <a>generalized RDF Datasets</a>.</li>
<li>The <a>default vocabulary</a> can be a relative IRI, which is evaluated
either against an existing default vocabulary, or against the document base.
This allows vocabulary-relative IRIs, such as the
keys of <a>node objects</a>, are expanded or compacted relative
to the document base.</li>
</ul>
</section>

Expand Down