From f6c7a2aceb2ee85999d3668f331f6dca2e92045d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Wed, 7 Jun 2023 13:34:05 +0200 Subject: [PATCH 1/6] Fix context processing for reverse terms Fixes #565. --- index.html | 4 ++-- tests/expand-manifest.html | 28 ++++++++++++++++++++++++++++ tests/expand-manifest.jsonld | 8 ++++++++ tests/expand/0131-in.jsonld | 16 ++++++++++++++++ tests/expand/0131-out.jsonld | 26 ++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 tests/expand/0131-in.jsonld create mode 100644 tests/expand/0131-out.jsonld diff --git a/index.html b/index.html index 730a7ee3..33b07779 100644 --- a/index.html +++ b/index.html @@ -1664,10 +1664,10 @@

Algorithm

  • Set the term definition of term in active context to definition and the value associated with defined's entry term to - true and return.
  • + true. -
  • If value contains the entry @id and its value +
  • Otherwise if value contains the entry @id and its value does not equal term:
    1. If the @id entry of value diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html index a1b2fea9..61fc01d7 100644 --- a/tests/expand-manifest.html +++ b/tests/expand-manifest.html @@ -3215,6 +3215,34 @@

      +
      +Test t0131 Reverse term with property based indexed container +
      +
      +
      +
      id
      +
      #t0131
      +
      Type
      +
      jld:PositiveEvaluationTest, jld:ExpandTest
      +
      Purpose
      +
      Expanding a reverse term using @container: @index and @index set to a property
      +
      input
      +
      +expand/0131-in.jsonld +
      +
      expect
      +
      +expand/0131-out.jsonld +
      +
      Options
      +
      +
      +
      specVersion
      +
      json-ld-1.1
      +
      +
      +
      +
      Test tc001 adding new term
      diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 57bc6b85..9f66743d 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -978,6 +978,14 @@ "purpose": "Verify URI resolution relative to base (without trailing slash, with path) according to RFC 3986", "input": "expand/0130-in.jsonld", "expect": "expand/0130-out.jsonld" + }, { + "@id": "#t0131", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Reverse term with property based indexed container", + "purpose": "Expanding a reverse term using @container: @index and @index set to a property", + "input": "expand/0131-in.jsonld", + "expect": "expand/0131-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/0131-in.jsonld b/tests/expand/0131-in.jsonld new file mode 100644 index 00000000..de7969bb --- /dev/null +++ b/tests/expand/0131-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@base": "https://example.org/", + "@vocab": "https://example.net/ns#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "statement": {"@reverse": "rdf:subject", "@container": "@index", "@index": "predicate"}, + "predicate": {"@id": "rdf:predicate", "@type": "@vocab"}, + "term": {"@id": "rdf:object", "@type": "@vocab"}, + "addedIn": {"@type": "@id"} + }, + "@id": "item/1", + "statement": { + "rdf:type": {"term": "A", "addedIn": "v1"} + } +} diff --git a/tests/expand/0131-out.jsonld b/tests/expand/0131-out.jsonld new file mode 100644 index 00000000..a1113421 --- /dev/null +++ b/tests/expand/0131-out.jsonld @@ -0,0 +1,26 @@ +[ + { + "@id": "https://example.org/item/1", + "@reverse": { + "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject": [ + { + "https://example.net/ns#addedIn": [ + { + "@id": "https://example.org/v1" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#object": [ + { + "@id": "https://example.net/ns#A" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate": [ + { + "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + } + ] + } + ] + } + } +] From 026131a104a2613b3c95ca94a604c398b5a3ab98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Wed, 7 Jun 2023 13:42:26 +0200 Subject: [PATCH 2/6] Add compact#t0114 roundtrip test of expand#t0131 --- tests/compact-manifest.html | 34 ++++++++++++++++++++++++++++++++++ tests/compact-manifest.jsonld | 9 +++++++++ 2 files changed, 43 insertions(+) diff --git a/tests/compact-manifest.html b/tests/compact-manifest.html index f3ee01fa..8291bfe8 100644 --- a/tests/compact-manifest.html +++ b/tests/compact-manifest.html @@ -3212,6 +3212,40 @@

      +
      +Test t0114 Reverse term with property based indexed container +
      +
      +
      +
      id
      +
      #t0114
      +
      Type
      +
      jld:PositiveEvaluationTest, jld:CompactTest
      +
      Purpose
      +
      With reverse term using @container: @index and @index set to a property, ensure round-tripping from expaned form
      +
      input
      +
      +expand/0131-out.jsonld +
      +
      context
      +
      +expand/0131-in.jsonld +
      +
      expect
      +
      +expand/0131-in.jsonld +
      +
      Options
      +
      +
      +
      base
      +
      https://example.org/
      +
      specVersion
      +
      json-ld-1.1
      +
      +
      +
      +
      Test tc001 adding new term
      diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index c0c429ac..984704b6 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -957,6 +957,15 @@ "input": "compact/0113-in.jsonld", "context": "compact/0113-context.jsonld", "expect": "compact/0113-out.jsonld" + }, { + "@id": "#t0114", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Reverse term with property based indexed container", + "purpose": "With reverse term using @container: @index and @index set to a property, ensure round-tripping from expaned form", + "input": "expand/0131-out.jsonld", + "context": "expand/0131-in.jsonld", + "expect": "expand/0131-in.jsonld", + "option": {"base": "https://example.org/", "specVersion": "json-ld-1.1"} }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], From a6a1dcb8af02b7a589e85be5a6c391c71f18412d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Wed, 28 Jun 2023 16:00:28 +0200 Subject: [PATCH 3/6] Use separate test files for compact#t0114 --- tests/compact-manifest.html | 8 ++++---- tests/compact-manifest.jsonld | 8 ++++---- tests/compact/0114-context.jsonld | 12 ++++++++++++ tests/compact/0114-in.jsonld | 26 ++++++++++++++++++++++++++ tests/compact/0114-out.jsonld | 16 ++++++++++++++++ 5 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 tests/compact/0114-context.jsonld create mode 100644 tests/compact/0114-in.jsonld create mode 100644 tests/compact/0114-out.jsonld diff --git a/tests/compact-manifest.html b/tests/compact-manifest.html index 8291bfe8..71091512 100644 --- a/tests/compact-manifest.html +++ b/tests/compact-manifest.html @@ -3222,18 +3222,18 @@

      Type
      jld:PositiveEvaluationTest, jld:CompactTest
      Purpose
      -
      With reverse term using @container: @index and @index set to a property, ensure round-tripping from expaned form
      +
      Compaction using a reverse term with @container indexed on a property (round-trip test of expand#t0131)
      input
      -expand/0131-out.jsonld +compact/0114-in.jsonld
      context
      -expand/0131-in.jsonld +compact/0114-context.jsonld
      expect
      -expand/0131-in.jsonld +compact/0114-out.jsonld
      Options
      diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index 984704b6..54fe6a12 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -961,10 +961,10 @@ "@id": "#t0114", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], "name": "Reverse term with property based indexed container", - "purpose": "With reverse term using @container: @index and @index set to a property, ensure round-tripping from expaned form", - "input": "expand/0131-out.jsonld", - "context": "expand/0131-in.jsonld", - "expect": "expand/0131-in.jsonld", + "purpose": "Compaction using a reverse term with @container indexed on a property (round-trip test of expand#t0131)", + "input": "compact/0114-in.jsonld", + "context": "compact/0114-context.jsonld", + "expect": "compact/0114-out.jsonld", "option": {"base": "https://example.org/", "specVersion": "json-ld-1.1"} }, { "@id": "#tc001", diff --git a/tests/compact/0114-context.jsonld b/tests/compact/0114-context.jsonld new file mode 100644 index 00000000..7facc291 --- /dev/null +++ b/tests/compact/0114-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@base": "https://example.org/", + "@vocab": "https://example.net/ns#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "statement": {"@reverse": "rdf:subject", "@container": "@index", "@index": "predicate"}, + "predicate": {"@id": "rdf:predicate", "@type": "@vocab"}, + "term": {"@id": "rdf:object", "@type": "@vocab"}, + "addedIn": {"@type": "@id"} + } +} diff --git a/tests/compact/0114-in.jsonld b/tests/compact/0114-in.jsonld new file mode 100644 index 00000000..a1113421 --- /dev/null +++ b/tests/compact/0114-in.jsonld @@ -0,0 +1,26 @@ +[ + { + "@id": "https://example.org/item/1", + "@reverse": { + "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject": [ + { + "https://example.net/ns#addedIn": [ + { + "@id": "https://example.org/v1" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#object": [ + { + "@id": "https://example.net/ns#A" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate": [ + { + "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + } + ] + } + ] + } + } +] diff --git a/tests/compact/0114-out.jsonld b/tests/compact/0114-out.jsonld new file mode 100644 index 00000000..de7969bb --- /dev/null +++ b/tests/compact/0114-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@base": "https://example.org/", + "@vocab": "https://example.net/ns#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "statement": {"@reverse": "rdf:subject", "@container": "@index", "@index": "predicate"}, + "predicate": {"@id": "rdf:predicate", "@type": "@vocab"}, + "term": {"@id": "rdf:object", "@type": "@vocab"}, + "addedIn": {"@type": "@id"} + }, + "@id": "item/1", + "statement": { + "rdf:type": {"term": "A", "addedIn": "v1"} + } +} From 8bfdf285ef6836cb80534ac2f8da95c9cc644bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Wed, 28 Jun 2023 16:11:36 +0200 Subject: [PATCH 4/6] Add entry in "Changes since Recommendation" section --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index 33b07779..edaf7021 100644 --- a/index.html +++ b/index.html @@ -7109,6 +7109,12 @@

      Changes since Recommendation of 16 July 2020

      Compaction Algorithm step 12.8.9.6.1 to first expand container key before compacting it.

    2. +
    3. + Changed the Create Term Definition + in section 4.2 of the Context Processing Algorithms, to ensure that all + possible features for reverse term definitions are processed. The change + was to remove and return from the end of step 13, and revise step + 14 to begin with Otherwise.
    4. Date: Wed, 28 Jun 2023 16:31:37 +0200 Subject: [PATCH 5/6] Add toRdf#t0133 test of expand#t0131 --- tests/toRdf-manifest.html | 21 +++++++++++++++++++++ tests/toRdf-manifest.jsonld | 7 +++++++ tests/toRdf/0133-in.jsonld | 26 ++++++++++++++++++++++++++ tests/toRdf/0133-out.nq | 4 ++++ 4 files changed, 58 insertions(+) create mode 100644 tests/toRdf/0133-in.jsonld create mode 100644 tests/toRdf/0133-out.nq diff --git a/tests/toRdf-manifest.html b/tests/toRdf-manifest.html index dfc0aced..76d65d00 100644 --- a/tests/toRdf-manifest.html +++ b/tests/toRdf-manifest.html @@ -1270,6 +1270,27 @@

      +
      +Test t0133 Reverse term with property based indexed container +
      +
      +
      +
      id
      +
      #t0133
      +
      Type
      +
      jld:PositiveEvaluationTest, jld:ToRDFTest
      +
      Purpose
      +
      Expanding a reverse term using @container: @index and @index set to a property (from expand#t0131)
      +
      input
      +
      +toRdf/0133-in.jsonld +
      +
      expect
      +
      +toRdf/0133-out.nq +
      +
      +
      Test tc001 adding new term
      diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index e13eab49..a971456e 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -396,6 +396,13 @@ "purpose": "IRI resolution according to RFC3986.", "input": "toRdf/0132-in.jsonld", "expect": "toRdf/0132-out.nq" + }, { + "@id": "#t0133", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Reverse term with property based indexed container", + "purpose": "Expanding a reverse term using @container: @index and @index set to a property (from expand#t0131)", + "input": "toRdf/0133-in.jsonld", + "expect": "toRdf/0133-out.nq" }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/0133-in.jsonld b/tests/toRdf/0133-in.jsonld new file mode 100644 index 00000000..a1113421 --- /dev/null +++ b/tests/toRdf/0133-in.jsonld @@ -0,0 +1,26 @@ +[ + { + "@id": "https://example.org/item/1", + "@reverse": { + "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject": [ + { + "https://example.net/ns#addedIn": [ + { + "@id": "https://example.org/v1" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#object": [ + { + "@id": "https://example.net/ns#A" + } + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate": [ + { + "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + } + ] + } + ] + } + } +] diff --git a/tests/toRdf/0133-out.nq b/tests/toRdf/0133-out.nq new file mode 100644 index 00000000..caee8969 --- /dev/null +++ b/tests/toRdf/0133-out.nq @@ -0,0 +1,4 @@ +_:b0 . +_:b0 . +_:b0 . +_:b0 . From f6f6ac46a7651b457e6a91e062d386cfb1aad2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Lindstr=C3=B6m?= Date: Wed, 12 Jul 2023 10:09:03 +0200 Subject: [PATCH 6/6] Fix punctuation Co-authored-by: Ted Thibodeau Jr --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index edaf7021..b7834458 100644 --- a/index.html +++ b/index.html @@ -1667,7 +1667,7 @@

      Algorithm

      true.

  • -
  • Otherwise if value contains the entry @id and its value +
  • Otherwise, if value contains the entry @id and its value does not equal term:
    1. If the @id entry of value