Skip to content

Commit 9444be3

Browse files
pchampinpfps
authored andcommitted
change definition of rdf:JSON to try and solve #116
1 parent c976b42 commit 9444be3

File tree

1 file changed

+9
-35
lines changed

1 file changed

+9
-35
lines changed

spec/index.html

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,47 +1844,17 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
18441844
<a>strings</a>,
18451845
numbers (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>),
18461846
<a data-cite="INFRA#ordered-map">maps</a>
1847-
(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),
1847+
mapping <a>strings</a> to values in the <a href="#JSON-value-space">value space</a> where the key-value pairs are ordered by key (using <a data-cite="I18N-GLOSSARY#dfn-code-point" class="lint-ignore">Unicode code points</a> order),
18481848
<a data-cite="INFRA#list">lists</a>
1849-
(of values in the <a href="#JSON-value-space">value space</a>), and
1849+
of values in the <a href="#JSON-value-space">value space</a>, and
18501850
literal values (<a data-cite="INFRA#boolean">`true`, `false`</a>, and <a data-cite="INFRA#nulls">`null`</a>)
18511851
from [[[INFRA]]] [[INFRA]] and [[[XMLSCHEMA11-2]]] [[XMLSCHEMA11-2]].
18521852

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

1857-
<p>Two values (|a| and |b|) are considered equal if any of the following are true:
1858-
<ul>
1859-
<li>They are the same <a>string</a>,
1860-
number (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>), or
1861-
literal value.</li>
1862-
<li>They are both <a data-cite="INFRA#list">lists</a> containing <a data-cite="INFRA#list-item">items</a>
1863-
which are pairwise equal – meaning that each <a data-cite="INFRA#list-item">item</a>
1864-
in |a| is equal the <a data-cite="INFRA#list-item">item</a>
1865-
at the corresponding index in |b|,
1866-
and both |a| and |b| have the same <a data-cite="INFRA#list-size">size</a>.</li>
1867-
<li>They are both <a data-cite="INFRA#ordered-map">maps</a> with equal <a data-cite="INFRA#map-entry">entries</a>
1868-
– meaning that for each entry <var>e<sub>a</sub></var> in |a|
1869-
there exists an entry <var>e<sub>b</sub></var> in |b|
1870-
such that the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>a</sub></var>
1871-
equals the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>b</sub></var>,
1872-
the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>a</sub></var>
1873-
equals the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>b</sub></var>,
1874-
and both |a| and |b| have the same <a data-cite="INFRA#map-size">size</a>.
1875-
<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.
1876-
For example, `{ "a": 1, "b": 2 } and { "b": 2, "a": 1 }` are considered equal.
1877-
As a result of the value space being defined using terminology from [[INFRA]],
1878-
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>,
1879-
are explicitly ordered.
1880-
All list-like value structures in [[INFRA]] are ordered,
1881-
whether or not that order is significant.
1882-
For the purposes of this specification, unless otherwise stated,
1883-
<a data-cite="INFRA#ordered-map">map</a> ordering is not important
1884-
and implementations are not expected to produce or consume deterministically ordered values.
1885-
</div>
1886-
</li>
1887-
</ul>
1857+
<p>Two values are considered equal if and only if they are the same element of the value space.</p>
18881858
</dd>
18891859

18901860
<dt id="JSON-mapping">The <a>lexical-to-value mapping</a></dt>
@@ -1900,8 +1870,9 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
19001870
by transforming each object member into a <a data-cite="INFRA#map-entry">map entry</a>
19011871
with the <a data-cite="INFRA#map-key">key</a> taken from the member name and
19021872
<a data-cite="INFRA#map-value">value</a> taken by performing this mapping
1903-
to the member value.
1904-
<a data-cite="INFRA#map-entry">Map entries</a> are treated as being unordered.
1873+
to the member value,
1874+
and sorting the entryes by key ()
1875+
(using <a data-cite="I18N-GLOSSARY#dfn-code-point" class="lint-ignore">Unicode code points</a> order).
19051876
</li>
19061877
<li>A <a data-cite="RFC8259#section-5">JSON Array</a> is mapped to a <a data-cite="INFRA#list">list</a>
19071878
such that this <a data-cite="INFRA#list">list</a> contains as many
@@ -1932,6 +1903,9 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
19321903
</ul>
19331904
</dd>
19341905
</dl>
1906+
<p class="note">
1907+
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 <code>{"a": "b", "c": "d"}</code> and <code>{"c": "d", "a": "b"}</code> 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.
1908+
</p>
19351909
<p class="issue" data-number="116">The issue refers to the use
19361910
of <a data-cite="INFRA#ordered-map">ordered map</a>
19371911
from [[INFRA]] for describing the value space of <a data-cite="RFC8259#section-4">JSON Objects</a>

0 commit comments

Comments
 (0)