From 8246cebce08859f5c58165bdf6ee453db84b32db Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Thu, 7 Aug 2025 15:59:46 +0200 Subject: [PATCH 1/4] change definition of rdf:JSON to try and solve #116 --- spec/index.html | 44 +++++++++----------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/spec/index.html b/spec/index.html index 7b4a369..28cfaf5 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1843,9 +1843,9 @@

The rdf:JSON Datatype

strings, numbers (xsd:double), maps - (mapping strings to values in the value space where the order of map entries is not significant), + mapping strings to values in the value space where the key-value pairs are ordered by key (using Unicode code points order), lists - (of values in the value space), and + of values in the value space, and literal values (`true`, `false`, and `null`) from [[[INFRA]]] [[INFRA]] and [[[XMLSCHEMA11-2]]] [[XMLSCHEMA11-2]]. @@ -1853,37 +1853,7 @@

The rdf:JSON Datatype

and lists does not include values having themselves as members, which cannot be represented in JSON.

-

Two values (|a| and |b|) are considered equal if any of the following are true: -

+

Two values are considered equal if and only if they are the same element of the value space.

The lexical-to-value mapping
@@ -1899,8 +1869,9 @@

The rdf:JSON Datatype

by transforming each object member into a map entry with the key taken from the member name and value taken by performing this mapping - to the member value. - Map entries are treated as being unordered. + to the member value, + and sorting the entryes by key () + (using Unicode code points order).
  • A JSON Array is mapped to a list such that this list contains as many @@ -1931,6 +1902,9 @@

    The rdf:JSON Datatype

    +

    + The constraint to order map entries in the value space is only meant to make the order of object-member the lexical space irrelevant. In other word, it ensures that both lexical values {"a": "b", "c": "d"} and {"c": "d", "a": "b"} are mapped to the same element of the value space. Implementations may omit to sort the entries, as long as they treat the maps in the value space as unordered. +

    The issue refers to the use of ordered map from [[INFRA]] for describing the value space of JSON Objects From 215a18e1792aadb67d1b414a2148afa49fa27067 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Mon, 11 Aug 2025 10:10:54 +0200 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Gregg Kellogg Co-authored-by: Ted Thibodeau Jr --- spec/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/index.html b/spec/index.html index 28cfaf5..44dbea6 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1843,7 +1843,7 @@

    The rdf:JSON Datatype

    strings, numbers (xsd:double), maps - mapping strings to values in the value space where the key-value pairs are ordered by key (using Unicode code points order), + mapping strings to values in the value space where the key-value pairs are ordered by key (using Unicode code point order), lists of values in the value space, and literal values (`true`, `false`, and `null`) @@ -1870,7 +1870,7 @@

    The rdf:JSON Datatype

    with the key taken from the member name and value taken by performing this mapping to the member value, - and sorting the entryes by key () + and sorting the entries by key () (using Unicode code points order).
  • A JSON Array is mapped to a list From 05268539231a300179f3f95cc3ecf11a8bef6984 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Mon, 11 Aug 2025 10:45:02 +0200 Subject: [PATCH 3/4] apply @pfps' suggestion https://github.com/w3c/rdf-concepts/pull/229#issuecomment-3165111969 --- spec/index.html | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/spec/index.html b/spec/index.html index 44dbea6..6188dca 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1842,14 +1842,14 @@

    The rdf:JSON Datatype

    is the smallest set containing strings, numbers (xsd:double), - maps - mapping strings to values in the value space where the key-value pairs are ordered by key (using Unicode code point order), + finite unordered maps + mapping strings to values in the value space, lists of values in the value space, and literal values (`true`, `false`, and `null`) from [[[INFRA]]] [[INFRA]] and [[[XMLSCHEMA11-2]]] [[XMLSCHEMA11-2]]. -

    The value space of maps +

    The value space of finite unordered maps and lists does not include values having themselves as members, which cannot be represented in JSON.

    @@ -1860,18 +1860,16 @@

    The rdf:JSON Datatype

    maps every element of the lexical space to the result of parsing it into a string, number (xsd:double), - map, + finite unordered map, list, or literal value (`true`, `false`, and `null`).
      -
    • A JSON Object is mapped to a map +
    • A JSON Object is mapped to a finite unordered map by transforming each object member into a map entry with the key taken from the member name and value taken by performing this mapping - to the member value, - and sorting the entries by key () - (using Unicode code points order). + to the member value.
    • A JSON Array is mapped to a list such that this list contains as many @@ -1903,12 +1901,11 @@

      The rdf:JSON Datatype

    - The constraint to order map entries in the value space is only meant to make the order of object-member the lexical space irrelevant. In other word, it ensures that both lexical values {"a": "b", "c": "d"} and {"c": "d", "a": "b"} are mapped to the same element of the value space. Implementations may omit to sort the entries, as long as they treat the maps in the value space as unordered. + The finite unordered maps can be implemented with ordered maps [[INFRA]] + by systematically sorting key-value pairs by key (using Unicode code point order). + This ensures that lexical forms that differ only in the order of object members are mapped to the same element of the value space + (e.g. {"a": "b", "c": "d"} and {"c": "d", "a": "b"}).

    -

    The issue refers to the use - of ordered map - from [[INFRA]] for describing the value space of JSON Objects - and suggests defining a new datatype for unordered maps.

    From 670191f4608d572f9bfbb445b60325785e98b864 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Mon, 11 Aug 2025 14:59:38 +0200 Subject: [PATCH 4/4] Update spec/index.html Co-authored-by: Peter F. Patel-Schneider --- spec/index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/index.html b/spec/index.html index 6188dca..8387ad5 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1903,8 +1903,7 @@

    The rdf:JSON Datatype

    The finite unordered maps can be implemented with ordered maps [[INFRA]] by systematically sorting key-value pairs by key (using Unicode code point order). - This ensures that lexical forms that differ only in the order of object members are mapped to the same element of the value space - (e.g. {"a": "b", "c": "d"} and {"c": "d", "a": "b"}). + This ensures that lexical forms that differ only in the order of object members (e.g., {"a": "b", "c": "d"} and {"c": "d", "a": "b"}) are mapped to the same value.