Skip to content

change definition of rdf:JSON #229

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
Aug 14, 2025
Merged
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
54 changes: 12 additions & 42 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1842,65 +1842,34 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
<dd>is the smallest set containing
<a>strings</a>,
numbers (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>),
<a data-cite="INFRA#ordered-map">maps</a>
(mapping <a>strings</a> to values in the <a href="#JSON-value-space">value space</a> where the order of <a data-cite="INFRA#map-entry">map entries</a> is not significant),
finite unordered maps
mapping <a>strings</a> to values in the <a href="#JSON-value-space">value space</a>,
<a data-cite="INFRA#list">lists</a>
(of values in the <a href="#JSON-value-space">value space</a>), and
of values in the <a href="#JSON-value-space">value space</a>, and
literal values (<a data-cite="INFRA#boolean">`true`, `false`</a>, and <a data-cite="INFRA#nulls">`null`</a>)
from [[[INFRA]]] [[INFRA]] and [[[XMLSCHEMA11-2]]] [[XMLSCHEMA11-2]].

<p class="note">The value space of <a data-cite="INFRA#ordered-map">maps</a>
<p class="note">The value space of finite unordered maps
and <a data-cite="INFRA#list">lists</a> does not include values having themselves as members,
which cannot be represented in JSON.</p>

<p>Two values (|a| and |b|) are considered equal if any of the following are true:
<ul>
<li>They are the same <a>string</a>,
number (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>), or
literal value.</li>
<li>They are both <a data-cite="INFRA#list">lists</a> containing <a data-cite="INFRA#list-item">items</a>
which are pairwise equal – meaning that each <a data-cite="INFRA#list-item">item</a>
in |a| is equal the <a data-cite="INFRA#list-item">item</a>
at the corresponding index in |b|,
and both |a| and |b| have the same <a data-cite="INFRA#list-size">size</a>.</li>
<li>They are both <a data-cite="INFRA#ordered-map">maps</a> with equal <a data-cite="INFRA#map-entry">entries</a>
– meaning that for each entry <var>e<sub>a</sub></var> in |a|
there exists an entry <var>e<sub>b</sub></var> in |b|
such that the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>a</sub></var>
equals the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>b</sub></var>,
the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>a</sub></var>
equals the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>b</sub></var>,
and both |a| and |b| have the same <a data-cite="INFRA#map-size">size</a>.
<div class="note">Two JSON Objects containing maps which are serialized with entries in a different order will be equal under this definition when transformed to the value space.
For example, `{ "a": 1, "b": 2 } and { "b": 2, "a": 1 }` are considered equal.
As a result of the value space being defined using terminology from [[INFRA]],
property values which can contain more than one item, such as <a data-cite="INFRA#list">lists</a> and <a data-cite="INFRA#ordered-map">maps</a>,
are explicitly ordered.
All list-like value structures in [[INFRA]] are ordered,
whether or not that order is significant.
For the purposes of this specification, unless otherwise stated,
<a data-cite="INFRA#ordered-map">map</a> ordering is not important
and implementations are not expected to produce or consume deterministically ordered values.
</div>
</li>
</ul>
<p>Two values are considered equal if and only if they are the same element of the value space.</p>
</dd>

<dt id="JSON-mapping">The <a>lexical-to-value mapping</a></dt>
<dd>maps every element of the lexical space to the result of parsing it into a
<a>string</a>,
number (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>),
<a data-cite="INFRA#ordered-map">map</a>,
finite unordered map,
<a data-cite="INFRA#list">list</a>, or
literal value (<a data-cite="INFRA#boolean">`true`, `false`</a>, and <a data-cite="INFRA#nulls">`null`</a>).

<ul>
<li>A <a data-cite="RFC8259#section-4">JSON Object</a> is mapped to a <a data-cite="INFRA#ordered-map">map</a>
<li>A <a data-cite="RFC8259#section-4">JSON Object</a> is mapped to a finite unordered map
by transforming each object member into a <a data-cite="INFRA#map-entry">map entry</a>
with the <a data-cite="INFRA#map-key">key</a> taken from the member name and
<a data-cite="INFRA#map-value">value</a> taken by performing this mapping
to the member value.
<a data-cite="INFRA#map-entry">Map entries</a> are treated as being unordered.
</li>
<li>A <a data-cite="RFC8259#section-5">JSON Array</a> is mapped to a <a data-cite="INFRA#list">list</a>
such that this <a data-cite="INFRA#list">list</a> contains as many
Expand Down Expand Up @@ -1931,10 +1900,11 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
</ul>
</dd>
</dl>
<p class="issue" data-number="116">The issue refers to the use
of <a data-cite="INFRA#ordered-map">ordered map</a>
from [[INFRA]] for describing the value space of <a data-cite="RFC8259#section-4">JSON Objects</a>
and suggests defining a new datatype for unordered maps.</p>
<p class="note">
The finite unordered maps can be implemented with <a data-cite="INFRA#ordered-map">ordered maps</a> [[INFRA]]
by systematically sorting key-value pairs by key (using <a data-cite="I18N-GLOSSARY#dfn-code-point" class="lint-ignore">Unicode code point</a> order).
This ensures that lexical forms that differ only in the order of object members (e.g., <code>{"a": "b", "c": "d"}</code> and <code>{"c": "d", "a": "b"}</code>) are mapped to the same value.
</p>
</section>

</section>
Expand Down
Loading