Skip to content

Add tests and spec text for scoped-contexts on @nest alias. #388

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 8 commits into from
Nov 16, 2020
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
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
- stage: examples
name: "Verify examples are consistent"
language: ruby
rvm: 2.6
rvm: 2.7
before_install:
- 'gem update --system --conservative'
- 'gem update bundler --conservative'
script: "bundle exec rake test"
- stage: links
name: "Check internal links and HTML"
Expand All @@ -26,7 +29,10 @@ jobs:
# Because (alas) rawgit is end of life, we'll run this only on the master branch.
if: branch = master
language: ruby
rvm: 2.6
rvm: 2.7
before_install:
- 'gem update --system --conservative'
- 'gem update bundler --conservative'
script:
- docker pull stupchiy/checklink
- docker run -it stupchiy/checklink -b -X '(http|https|mailto):' "https://labs.w3.org/spec-generator/?type=respec&url=https://raw.githack.com/w3c/json-ld-api/${TRAVIS_BRANCH}/index.html?specStatus=WD&shortName=json-ld11-api"
Expand Down
86 changes: 45 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: git://github.com/ruby-rdf/json-ld.git
revision: f663709f5a98abca4106730e5139ad2c6aefa0e3
remote: https://github.com/ruby-rdf/json-ld.git
revision: d864b20f6c8bff286a9a12f7c69917105842bc29
branch: develop
specs:
json-ld (3.1.1)
json-ld (3.1.4)
htmlentities (~> 4.3)
json-canonicalization (~> 0.2)
link_header (~> 0.0, >= 0.0.8)
Expand All @@ -20,70 +20,72 @@ GEM
i18n
builder (3.2.4)
colorize (0.8.1)
concurrent-ruby (1.1.6)
connection_pool (2.2.2)
ebnf (1.2.0)
concurrent-ruby (1.1.7)
connection_pool (2.2.3)
ebnf (2.1.2)
htmlentities (~> 4.3)
rdf (~> 3.1)
scanf (~> 1.0)
sxp (~> 1.1)
equivalent-xml (0.6.0)
nokogiri (>= 1.4.3)
haml (5.1.2)
haml (5.2.0)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
htmlentities (4.3.4)
i18n (1.8.2)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
json-canonicalization (0.2.0)
json-ld-preloaded (3.1.1)
json-ld-preloaded (3.1.3)
json-ld (~> 3.1)
rdf (~> 3.1)
ld-patch (3.1.0)
ebnf (~> 1.2)
ld-patch (3.1.1)
ebnf (~> 2.0)
rdf (~> 3.1)
rdf-xsd (~> 3.1)
sparql (~> 3.1)
sxp (~> 1.1)
link_header (0.0.8)
linkeddata (3.1.1)
linkeddata (3.1.2)
equivalent-xml (~> 0.6)
json-ld (~> 3.1, >= 3.1.1)
json-ld-preloaded (~> 3.1, >= 3.1.1)
ld-patch (~> 3.1)
nokogiri (~> 1.10)
nokogumbo (~> 2.0)
rdf (~> 3.1, >= 3.1.1)
rdf (~> 3.1, >= 3.1.2)
rdf-aggregate-repo (~> 3.1)
rdf-isomorphic (~> 3.1)
rdf-json (~> 3.1)
rdf-microdata (~> 3.1)
rdf-n3 (~> 3.1)
rdf-normalize (~> 0.4)
rdf-rdfa (~> 3.1)
rdf-rdfa (~> 3.1, >= 3.1.1)
rdf-rdfxml (~> 3.1)
rdf-reasoner (~> 0.6)
rdf-reasoner (~> 0.6, >= 0.6.1)
rdf-tabular (~> 3.1)
rdf-trig (~> 3.1)
rdf-trix (~> 3.1)
rdf-turtle (~> 3.1)
rdf-turtle (~> 3.1, >= 3.1.1)
rdf-vocab (~> 3.1, >= 3.1.2)
rdf-xsd (~> 3.1)
shex (~> 0.6)
sparql (~> 3.1)
sparql (~> 3.1, >= 3.1.1)
sparql-client (~> 3.1)
mini_portile2 (2.4.0)
multi_json (1.14.1)
multi_json (1.15.0)
net-http-persistent (3.1.0)
connection_pool (~> 2.2)
nokogiri (1.10.8)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogumbo (2.0.2)
nokogiri (~> 1.8, >= 1.8.4)
public_suffix (4.0.3)
public_suffix (4.0.6)
rack (2.2.3)
rake (13.0.1)
rdf (3.1.1)
rdf (3.1.6)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.1.0)
Expand All @@ -92,7 +94,7 @@ GEM
rdf (~> 3.1)
rdf-json (3.1.0)
rdf (~> 3.1)
rdf-microdata (3.1.0)
rdf-microdata (3.1.1)
htmlentities (~> 4.3)
nokogiri (~> 1.10)
rdf (~> 3.1)
Expand All @@ -103,54 +105,56 @@ GEM
sxp (~> 1.1)
rdf-normalize (0.4.0)
rdf (~> 3.1)
rdf-rdfa (3.1.0)
rdf-rdfa (3.1.2)
haml (~> 5.1)
htmlentities (~> 4.3)
rdf (~> 3.1)
rdf (~> 3.1, >= 3.1.2)
rdf-aggregate-repo (~> 3.1)
rdf-vocab (~> 3.1, >= 3.1.5)
rdf-xsd (~> 3.1)
rdf-rdfxml (3.1.0)
htmlentities (~> 4.3)
rdf (~> 3.1)
rdf-rdfa (~> 3.1)
rdf-xsd (~> 3.1)
rdf-reasoner (0.6.0)
rdf (~> 3.1)
rdf-vocab (~> 3.1)
rdf-reasoner (0.6.2)
rdf (~> 3.1, >= 3.1.2)
rdf-vocab (~> 3.1, >= 3.1.5)
rdf-xsd (~> 3.1)
rdf-tabular (3.1.0)
rdf-tabular (3.1.1)
addressable (~> 2.3)
bcp47 (~> 0.3, >= 0.3.3)
json-ld (~> 3.1)
rdf (~> 3.1)
rdf-vocab (~> 3.1)
rdf-xsd (~> 3.1)
rdf-trig (3.1.0)
ebnf (~> 1.1)
rdf-trig (3.1.1)
ebnf (~> 2.0)
rdf (~> 3.1)
rdf-turtle (~> 3.1)
rdf-trix (3.1.0)
rdf (~> 3.1)
rdf-turtle (3.1.0)
ebnf (~> 1.2)
rdf (~> 3.1)
rdf-vocab (3.1.2)
rdf (~> 3.1)
rdf-turtle (3.1.2)
ebnf (~> 2.0)
rdf (~> 3.1, >= 3.1.2)
rdf-vocab (3.1.8)
rdf (~> 3.1, >= 3.1.2)
rdf-xsd (3.1.0)
rdf (~> 3.1)
redcarpet (3.5.0)
shex (0.6.0)
ebnf (~> 1.2)
scanf (1.0.0)
shex (0.6.1)
ebnf (~> 2.0)
json-ld (~> 3.1)
json-ld-preloaded (~> 3.1)
rdf (~> 3.1)
rdf-xsd (~> 3.1)
sparql (~> 3.1)
sxp (~> 1.1)
sparql (3.1.0)
sparql (3.1.3)
builder (~> 3.2)
ebnf (~> 1.2)
rdf (~> 3.1)
ebnf (>= 1.1)
rdf (~> 3.1, >= 3.1.2)
rdf-aggregate-repo (~> 3.1)
rdf-xsd (~> 3.1)
sparql-client (~> 3.1)
Expand All @@ -177,4 +181,4 @@ DEPENDENCIES
redcarpet

BUNDLED WITH
1.17.3
2.1.4
19 changes: 15 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ <h3>Algorithm</h3>
<li>If <var>element</var> is <code>null</code>, return <code>null</code>.</li>
<li class="changed">If <var>active property</var> is <code>@default</code>,
initialize the {{JsonLdOptions/frameExpansion}} flag to <code>false</code>.</li>
<li class="changed">If <var>active property</var> has a <a>term definition</a> in <var>active context</var>
<li id="alg-expand-property-scoped-context" class="changed">If <var>active property</var> has a <a>term definition</a> in <var>active context</var>
with a <a>local context</a>, initialize <var>property-scoped context</var> to that <a>local context</a>.</li>
<li>If <var>element</var> is a <a>scalar</a>,
<ol>
Expand Down Expand Up @@ -2530,7 +2530,7 @@ <h3>Algorithm</h3>
(where <a>entries</a> are <span class="changed"><a data-lt="IRI expanding">IRI expanded</a></span>,
set <var>active context</var> to <a>previous context</a> from <var>active context</var>,
as the scope of a term-scoped <a>context</a> does not apply when processing new <a>node objects</a>.</li>
<li id="alg-expand-property-scoped-context" class="changed">If <var>property-scoped context</var> is defined,
<li id="alg-expand-property-scoped-context2" class="changed">If <var>property-scoped context</var> is defined,
set <var>active context</var> to the result of the
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
passing <var>active context</var>, <var>property-scoped context</var> as <var>local context</var>,
Expand Down Expand Up @@ -3069,9 +3069,20 @@ <h3>Algorithm</h3>
<var>nested value</var> expands to <code>@value</code>, an
<a data-link-for="JsonLdErrorCode">invalid @nest value</a> error
has been detected and processing is aborted.</li>
<li>Recursively repeat steps <a href="#alg-expand-each-key-value">13</a>
<li>Recursively repeat steps
<a href="#alg-expand-property-scoped-context">3</a>,
<a href="#alg-expand-property-scoped-context2">8</a>,
<a href="#alg-expand-each-key-value">13</a>,
and <a href="#alg-expand-resolve-nest">14</a>
using <var>nested value</var> for <var>element</var>.
using <var>nesting-key</var> for <var>active property</var>, and
<var>nested value</var> for <var>element</var>.
<div class="note">Steps <a href="#alg-expand-property-scoped-context">3</a>
and <a href="#alg-expand-property-scoped-context2">8</a>
may update the <var>active context</var> based on a
property-scoped context associated with <var>nesting-key</var>.
Updates to <var>active context</var> are restricted to the
recursive operation, and do not propogate to subsequent iterations
on <var>nested values</var> and <var>nesting-key</var>.</div>
<div class="note">By invoking steps <a href="#alg-expand-each-key-value">13</a>
and <a href="#alg-expand-resolve-nest">14</a> on <var>nested value</var>
we are able to unfold arbitrary levels of nesting, with results being merged into
Expand Down
16 changes: 16 additions & 0 deletions tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,22 @@
"input": "expand/c036-in.jsonld",
"expect": "expand/c036-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tc037",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "property-scoped contexts which are alias of @nest",
"purpose": "Nesting terms may have property-scoped contexts defined.",
"input": "expand/c037-in.jsonld",
"expect": "expand/c037-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tc038",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Bibframe example (poor-mans inferrence)",
"purpose": "Nesting terms may have property-scoped contexts defined.",
"input": "expand/c038-in.jsonld",
"expect": "expand/c038-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tdi01",
"@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ],
Expand Down
15 changes: 15 additions & 0 deletions tests/expand/c037-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": {
"@version": 1.1,
"@vocab": "http://example.org/",
"nest": {
"@id": "@nest",
"@context": {
"@vocab": "http://example.org/nest/"
}
}
},
"nest": {
"property": "should be in /nest"
}
}
3 changes: 3 additions & 0 deletions tests/expand/c037-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[{
"http://example.org/nest/property": [{"@value": "should be in /nest"}]
}]
54 changes: 54 additions & 0 deletions tests/expand/c038-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"@context": {
"@version": 1.1,
"@base": "http://example.org/base/",
"@vocab": "http://purl.org/dc/terms/",
"bibo": "http://purl.org/ontology/bibo/",
"Print": "bibo:Book",
"name": "http://www.w3.org/2000/01/rdf-schema#label",
"instanceOf": "@nest",
"contributionByRole": {
"@id": "@nest",
"@context": {
"agent": "@nest",
"aut": "creator"
}
},
"provisionActivityByType": {
"@id": "@nest",
"@context": {
"Publication": {
"@id": "@nest",
"@context": {"date": "published", "agent": "publisher"}
}
}
},
"identifiedByType": {
"@id": "@nest",
"@context": {
"Isbn": {"@id": "@nest"},
"value": "bibo:isbn"
}
}
},
"@id": "book/one",
"@type": "Print",
"instanceOf": {
"contributionByRole": {
"aut": {
"agent": {"name": "Some Body"}
}
}
},
"identifiedByType": {
"Isbn": {
"value": "1234567890"
}
},
"provisionActivityByType": {
"Publication": {
"date": "1999",
"agent": {"name": "PubCorp"}
}
}
}
12 changes: 12 additions & 0 deletions tests/expand/c038-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[{
"@id": "http://example.org/base/book/one",
"@type": ["http://purl.org/ontology/bibo/Book"],
"http://purl.org/dc/terms/creator": [{
"http://www.w3.org/2000/01/rdf-schema#label": [{"@value": "Some Body"}]
}],
"http://purl.org/ontology/bibo/isbn": [{"@value": "1234567890"}],
"http://purl.org/dc/terms/published": [{"@value": "1999"}],
"http://purl.org/dc/terms/publisher": [{
"http://www.w3.org/2000/01/rdf-schema#label": [{"@value": "PubCorp"}]
}]
}]
Loading