diff --git a/.travis.yml b/.travis.yml index 114e02d5..bf75dbd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ dist: trusty +env: + global: + - NOKOGIRI_USE_SYSTEM_LIBRARIES=true jobs: include: - stage: common diff --git a/Gemfile.lock b/Gemfile.lock index 79fbbd48..f8b7428c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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/ @@ -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) @@ -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) @@ -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) @@ -166,4 +169,4 @@ DEPENDENCIES rake BUNDLED WITH - 1.17.1 + 1.17.3 diff --git a/common/terms.html b/common/terms.html index 62f5aa19..d3aa9851 100644 --- a/common/terms.html +++ b/common/terms.html @@ -335,5 +335,5 @@ A value object is a dictionary that has an @value member.
vocabulary mapping
The vocabulary mapping is set in the context using the @vocab key - whose value MUST be an absolute IRI or null.
+ whose value MUST be an IRI or null. diff --git a/index.html b/index.html index f8561062..c13cd463 100644 --- a/index.html +++ b/index.html @@ -1092,14 +1092,18 @@

Algorithm

@vocab member.
  • If value is null, remove any vocabulary mapping from result.
  • -
  • Otherwise, if value - the empty string (""), - the effective value is the current base IRI.
  • Otherwise, if value is - an absolute IRI + an IRI or blank node identifier, the vocabulary mapping - of result is set to value. If it is not - an absolute IRI, or a blank node identifier, an + of result is set to + the result of using the + IRI Expansion algorithm, + passing result as the active context, + value, + true for vocab, and + true for document relative. + . + If it is not an IRI, or a blank node identifier, an invalid vocab mapping error has been detected and processing is aborted.
    The use of blank node identifiers to value for @vocab is obsolete, @@ -5520,7 +5524,7 @@

    JsonLdErrorCode

    i.e., it is neither a scalar nor null.
    invalid vocab mapping
    An invalid vocabulary mapping has been detected, - i.e., it is neither an absolute IRI nor null.
    + i.e., it is neither an IRI nor null.
    keyword redefinition
    A keyword redefinition has been detected.
    loading document failed
    diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index d99be60e..660249c6 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -616,7 +616,7 @@ "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], "name": "Compact using relative fragment identifier", "purpose": "Compacting a relative round-trips", - "option": {"base": "http://example.org/"}, + "option": {"processingMode": "json-ld-1.0", "base": "http://example.org/"}, "input": "compact/0075-in.jsonld", "context": "compact/0075-context.jsonld", "expect": "compact/0075-out.jsonld" @@ -896,6 +896,14 @@ "context": "compact/0106-context.jsonld", "expect": "compact/0106-out.jsonld", "option": {"processingMode": "json-ld-1.0", "specVersion": "json-ld-1.1"} + }, { + "@id": "#t0107", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Relative propererty IRIs with @vocab: ''", + "purpose": "Complex use cases for relative IRI compaction or properties", + "input": "compact/0107-in.jsonld", + "context": "compact/0107-context.jsonld", + "expect": "compact/0107-out.jsonld" }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], diff --git a/tests/compact/0107-context.jsonld b/tests/compact/0107-context.jsonld new file mode 100644 index 00000000..9a7115dd --- /dev/null +++ b/tests/compact/0107-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@base": "http://example.com/some/", + "@vocab": "other/" + } +} diff --git a/tests/compact/0107-in.jsonld b/tests/compact/0107-in.jsonld new file mode 100644 index 00000000..13505e4b --- /dev/null +++ b/tests/compact/0107-in.jsonld @@ -0,0 +1,13 @@ +[ + { + "@id": "http://example.com/some/deep/directory/and/relativePropertyIris", + "http://example.com/absolute": [{"@value": "/absolute"}], + "http://example.com/some/other/deep/directory/": [{"@value": "deep/directory"}], + "http://example.com/some/other/deep/directory/and/": [{"@value": "deep/directory/and/"}], + "http://example.com/some/other/#fragment-works": [{"@value": "#fragment-works"}], + "http://example.com/some/other/?query=works": [{"@value": "?query=works"}], + "http://example.com/some/other/link": [{"@value": "link"}], + "http://example.com/some/other/../parent": [{"@value": "../parent"}], + "http://example.com/too-many-dots": [{"@value": "too-many-dots"}] + } +] diff --git a/tests/compact/0107-out.jsonld b/tests/compact/0107-out.jsonld new file mode 100644 index 00000000..7b9f8838 --- /dev/null +++ b/tests/compact/0107-out.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "@base": "http://example.com/some/", + "@vocab": "other/" + }, + "#fragment-works": "#fragment-works", + "../parent": "../parent", + "?query=works": "?query=works", + "@id": "deep/directory/and/relativePropertyIris", + "deep/directory/": "deep/directory", + "deep/directory/and/": "deep/directory/and/", + "http://example.com/absolute": "/absolute", + "http://example.com/too-many-dots": "too-many-dots", + "link": "link" +} \ No newline at end of file diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 5facfbd8..32abb3d1 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -270,6 +270,7 @@ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Expanding blank node labels", "purpose": "Blank nodes are not relabeled during expansion", + "option": {"processingMode": "json-ld-1.0"}, "input": "expand/0038-in.jsonld", "expect": "expand/0038-out.jsonld" }, { @@ -528,6 +529,7 @@ "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@vocab as blank node identifier", "purpose": "Use @vocab to map all properties to blank node identifiers", + "option": {"processingMode": "json-ld-1.0"}, "input": "expand/0075-in.jsonld", "expect": "expand/0075-out.jsonld" }, { @@ -808,6 +810,27 @@ "purpose": "Do not treat as absolute IRIs values that look like compact IRIs if they're not absolute", "input": "expand/0109-in.jsonld", "expect": "expand/0109-out.jsonld" + }, { + "@id": "#t0110", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Various relative IRIs as properties with with relative @vocab", + "purpose": "Pathological relative property IRIs", + "input": "expand/0110-in.jsonld", + "expect": "expand/0110-out.jsonld" + }, { + "@id": "#t0111", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Various relative IRIs as properties with with relative @vocab itself relative to an existing vocabulary base", + "purpose": "Pathological relative property IRIs", + "input": "expand/0111-in.jsonld", + "expect": "expand/0111-out.jsonld" + }, { + "@id": "#t0112", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Various relative IRIs as properties with with relative @vocab relative to another relative vocabulary base", + "purpose": "Pathological relative property IRIs", + "input": "expand/0112-in.jsonld", + "expect": "expand/0112-out.jsonld" }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/0110-in.jsonld b/tests/expand/0110-in.jsonld new file mode 100644 index 00000000..a6f1e676 --- /dev/null +++ b/tests/expand/0110-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@base": "http://example.com/some/deep/directory/and/file/", + "@vocab": "/relative" + }, + "@id": "relativePropertyIris", + "link": "link", + "#fragment-works": "#fragment-works", + "?query=works": "?query=works", + "./": "./", + "../": "../", + "../parent": "../parent", + "../../parent-parent-eq-root": "../../parent-parent-eq-root", + "../../../../../still-root": "../../../../../still-root", + "../.././.././../../too-many-dots": "../.././.././../../too-many-dots", + "/absolute": "/absolute", + "//example.org/scheme-relative": "//example.org/scheme-relative" +} diff --git a/tests/expand/0110-out.jsonld b/tests/expand/0110-out.jsonld new file mode 100644 index 00000000..c93ab5ea --- /dev/null +++ b/tests/expand/0110-out.jsonld @@ -0,0 +1,16 @@ +[ + { + "@id": "http://example.com/some/deep/directory/and/file/relativePropertyIris", + "http://example.com/relative#fragment-works": [{"@value": "#fragment-works"}], + "http://example.com/relative../": [{"@value": "../"}], + "http://example.com/relative../../../../../still-root": [{"@value": "../../../../../still-root"}], + "http://example.com/relative../.././.././../../too-many-dots": [{"@value": "../.././.././../../too-many-dots"}], + "http://example.com/relative../../parent-parent-eq-root": [{"@value": "../../parent-parent-eq-root"}], + "http://example.com/relative../parent": [{"@value": "../parent"}], + "http://example.com/relative./": [{"@value": "./"}], + "http://example.com/relative//example.org/scheme-relative": [{"@value": "//example.org/scheme-relative"}], + "http://example.com/relative/absolute": [{"@value": "/absolute"}], + "http://example.com/relative?query=works": [{"@value": "?query=works"}], + "http://example.com/relativelink": [{"@value": "link"}] + } +] \ No newline at end of file diff --git a/tests/expand/0111-in.jsonld b/tests/expand/0111-in.jsonld new file mode 100644 index 00000000..5a0a1178 --- /dev/null +++ b/tests/expand/0111-in.jsonld @@ -0,0 +1,20 @@ +{ + "@context": [{ + "@base": "http://example.com/some/deep/directory/and/file/", + "@vocab": "http://example.com/vocabulary/" + }, { + "@vocab": "./rel2#" + }], + "@id": "relativePropertyIris", + "link": "link", + "#fragment-works": "#fragment-works", + "?query=works": "?query=works", + "./": "./", + "../": "../", + "../parent": "../parent", + "../../parent-parent-eq-root": "../../parent-parent-eq-root", + "../../../../../still-root": "../../../../../still-root", + "../.././.././../../too-many-dots": "../.././.././../../too-many-dots", + "/absolute": "/absolute", + "//example.org/scheme-relative": "//example.org/scheme-relative" +} diff --git a/tests/expand/0111-out.jsonld b/tests/expand/0111-out.jsonld new file mode 100644 index 00000000..8febce3b --- /dev/null +++ b/tests/expand/0111-out.jsonld @@ -0,0 +1,16 @@ +[ + { + "@id": "http://example.com/some/deep/directory/and/file/relativePropertyIris", + "http://example.com/vocabulary/./rel2##fragment-works": [{"@value": "#fragment-works"}], + "http://example.com/vocabulary/./rel2#../": [{"@value": "../"}], + "http://example.com/vocabulary/./rel2#../../../../../still-root": [{"@value": "../../../../../still-root"}], + "http://example.com/vocabulary/./rel2#../.././.././../../too-many-dots": [{"@value": "../.././.././../../too-many-dots"}], + "http://example.com/vocabulary/./rel2#../../parent-parent-eq-root": [{"@value": "../../parent-parent-eq-root"}], + "http://example.com/vocabulary/./rel2#../parent": [{"@value": "../parent"}], + "http://example.com/vocabulary/./rel2#./": [{"@value": "./"}], + "http://example.com/vocabulary/./rel2#//example.org/scheme-relative": [{"@value": "//example.org/scheme-relative"}], + "http://example.com/vocabulary/./rel2#/absolute": [{"@value": "/absolute"}], + "http://example.com/vocabulary/./rel2#?query=works": [{"@value": "?query=works"}], + "http://example.com/vocabulary/./rel2#link": [{"@value": "link"}] + } +] \ No newline at end of file diff --git a/tests/expand/0112-in.jsonld b/tests/expand/0112-in.jsonld new file mode 100644 index 00000000..273eebdd --- /dev/null +++ b/tests/expand/0112-in.jsonld @@ -0,0 +1,20 @@ +{ + "@context": [{ + "@base": "http://example.com/some/deep/directory/and/file/", + "@vocab": "/rel1" + }, { + "@vocab": "./rel2#" + }], + "@id": "relativePropertyIris", + "link": "link", + "#fragment-works": "#fragment-works", + "?query=works": "?query=works", + "./": "./", + "../": "../", + "../parent": "../parent", + "../../parent-parent-eq-root": "../../parent-parent-eq-root", + "../../../../../still-root": "../../../../../still-root", + "../.././.././../../too-many-dots": "../.././.././../../too-many-dots", + "/absolute": "/absolute", + "//example.org/scheme-relative": "//example.org/scheme-relative" +} diff --git a/tests/expand/0112-out.jsonld b/tests/expand/0112-out.jsonld new file mode 100644 index 00000000..07fe15c4 --- /dev/null +++ b/tests/expand/0112-out.jsonld @@ -0,0 +1,16 @@ +[ + { + "@id": "http://example.com/some/deep/directory/and/file/relativePropertyIris", + "http://example.com/rel1./rel2##fragment-works": [{"@value": "#fragment-works"}], + "http://example.com/rel1./rel2#../": [{"@value": "../"}], + "http://example.com/rel1./rel2#../../../../../still-root": [{"@value": "../../../../../still-root"}], + "http://example.com/rel1./rel2#../.././.././../../too-many-dots": [{"@value": "../.././.././../../too-many-dots"}], + "http://example.com/rel1./rel2#../../parent-parent-eq-root": [{"@value": "../../parent-parent-eq-root"}], + "http://example.com/rel1./rel2#../parent": [{"@value": "../parent"}], + "http://example.com/rel1./rel2#./": [{"@value": "./"}], + "http://example.com/rel1./rel2#//example.org/scheme-relative": [{"@value": "//example.org/scheme-relative"}], + "http://example.com/rel1./rel2#/absolute": [{"@value": "/absolute"}], + "http://example.com/rel1./rel2#?query=works": [{"@value": "?query=works"}], + "http://example.com/rel1./rel2#link": [{"@value": "link"}] + } +] \ No newline at end of file diff --git a/tests/flatten-manifest.jsonld b/tests/flatten-manifest.jsonld index be4c3dcb..56b066af 100644 --- a/tests/flatten-manifest.jsonld +++ b/tests/flatten-manifest.jsonld @@ -263,6 +263,7 @@ "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], "name": "Flattening blank node labels", "purpose": "Blank nodes are not relabeled during expansion", + "option": {"processingMode": "json-ld-1.0"}, "input": "flatten/0038-in.jsonld", "expect": "flatten/0038-out.jsonld" }, { diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 6a9ab44c..cfac6926 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -515,6 +515,7 @@ "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], "name": "Drop blank node predicates by default", "purpose": "Triples with blank node predicates are dropped by default.", + "option": {"processingMode": "json-ld-1.0"}, "input": "toRdf/0078-in.jsonld", "expect": "toRdf/0078-out.nq" }, { @@ -796,6 +797,7 @@ "name": "produce generalized RDF flag", "purpose": "Triples with blank node predicates are not dropped if the produce generalized RDF flag is true.", "option": { + "processingMode": "json-ld-1.0", "produceGeneralizedRdf": true }, "input": "toRdf/0118-in.jsonld",