Skip to content

Commit 4ab0df5

Browse files
gkelloggTallTed
andauthored
Updates rdf:JSON value space. (#66)
* Updates rdf:JSON value space. * Updates value space of rdf:JSON using INFRA and XSD and defines the lexical-to-value mapping for tha various JSON values into that space, as well as how to compare values. Note the sentence on the relative order of rdf:JSON literals, which may belong somewhere else. * Update RFC5785 with RFC8615. * Use I18N-GLOSSARY instead of i18n-glossary. * * Update rdf:JSON datatype to mandate that numbers be expresed as IEEE 754-2008 double precision numbers, making SHOULD NOT in I-JSON a MUST NOT. * Reduce the descriptions of number to be just xsd:double, as xsd:integer is not significant in the context of a JSON value. * Clarify how map entries are compared for equality. * Remove rdf:JSON canonical mapping. * Clarify equality of maps and map elements. * Call out to doubleLexicalMap for converting numbers into xsd:double values. * Note on numbers that have infinite values. --------- Co-authored-by: Ted Thibodeau Jr <[email protected]>
1 parent 808d642 commit 4ab0df5

File tree

1 file changed

+83
-53
lines changed

1 file changed

+83
-53
lines changed

spec/index.html

+83-53
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ <h3>RDF Vocabularies and Namespace IRIs</h3>
314314
<tr>
315315
<td>rdf</td>
316316
<td><a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#</code></a></td>
317-
<td>The RDF built-in vocabulary [[RDF-SYNTAX]]</td>
317+
<td>The RDF built-in vocabulary [[RDF12-SCHEMA]]</td>
318318
</tr>
319319
<tr><td>rdfs</td>
320320
<td><a href="http://www.w3.org/2000/01/rdf-schema#"><code>http://www.w3.org/2000/01/rdf-schema#</code></a></td>
321-
<td>The RDF Schema vocabulary [[RDF-SCHEMA]]</td>
321+
<td>The RDF Schema vocabulary [[RDF12-SCHEMA]]</td>
322322
</tr>
323323
<tr><td>xsd</td>
324324
<td><a href="http://www.w3.org/2001/XMLSchema#"><code>http://www.w3.org/2001/XMLSchema#</code></a></td>
@@ -446,7 +446,7 @@ <h3>Equivalence, Entailment and Inconsistency</h3>
446446
defines precise conditions that make these relationships hold.
447447
RDF itself recognizes only some basic cases of entailment, <a>equivalence</a>
448448
and inconsistency. Other specifications, such as
449-
[[[RDF-SCHEMA]]] [[RDF-SCHEMA]]
449+
[[[RDF12-SCHEMA]]] [[RDF12-SCHEMA]]
450450
and <a data-cite="owl2-overview#">OWL 2</a>
451451
[[OWL2-OVERVIEW]], add more powerful entailment regimes,
452452
as do some domain-specific <a>vocabularies</a>.</p>
@@ -895,7 +895,7 @@ <h3>Replacing Blank Nodes with IRIs</h3>
895895
if needed.</p>
896896

897897
<p>Systems that want Skolem IRIs to be recognizable outside of the system
898-
boundaries SHOULD use a well-known IRI [[RFC5785]] with the registered
898+
boundaries SHOULD use a well-known IRI [[RFC8615]] with the registered
899899
name <code>genid</code>. This is an IRI that uses the HTTP or HTTPS scheme,
900900
or another scheme that has been specified to use well-known IRIs; and whose
901901
path component starts with <code>/.well-known/genid/</code>.
@@ -905,7 +905,7 @@ <h3>Replacing Blank Nodes with IRIs</h3>
905905

906906
<pre>http://example.com/.well-known/genid/d26a2d0e98334696f4ad70a677abc1f6</pre>
907907

908-
<p class="note">RFC 5785 [[RFC5785]] only specifies well-known URIs,
908+
<p class="note">RFC 8615 [[RFC8615]] only specifies well-known URIs,
909909
not IRIs. For the purpose of this document, a well-known IRI is any
910910
IRI that results in a well-known <a>URI</a> after IRI-to-URI mapping [[!RFC3987]].</p>
911911
</section>
@@ -1516,58 +1516,85 @@ <h3>The <code>rdf:JSON</code> Datatype</h3>
15161516
<dt id="JSON-lexical-space">The <a>lexical space</a></dt>
15171517
<dd>is the set of all <a data-lt="string">RDF strings</a> that conform to the
15181518
<a data-cite="RFC8259#section-2">JSON Grammar</a> as described in
1519-
<a data-cite="RFC8259#section-2">Section&nbsp;2 JSON Grammar</a> of
1520-
[[RFC8259]].</dd>
1519+
<a data-cite="RFC8259#section-2">Section&nbsp;2 JSON Grammar</a> of [[RFC8259]],
1520+
which also conform to the requirements of [[[RFC7493]]] [[RFC7493]].
1521+
<div class="note">
1522+
[[[RFC8259]]] [[RFC8259]] allows strings to include
1523+
<a data-cite="I18N-GLOSSARY#dfn-surrogate" class="lint-ignore">surrogate code points</a>
1524+
not allowed in <a data-lt="string">RDF strings</a>,
1525+
which are also excluded in [[RFC7493]],
1526+
thus the lexical representation of JSON literals excludes those including
1527+
<a data-cite="I18N-GLOSSARY#dfn-surrogate" class="lint-ignore">surrogate code points</a>.
1528+
</div></dd>
15211529

15221530
<dt id="JSON-value-space">The <a>value space</a></dt>
1523-
<dd>
1524-
is the set of all <a data-lt="string">RDF strings</a> that conform to the
1525-
<a data-cite="RFC8259#section-2">JSON Grammar</a> as described in
1526-
<a data-cite="RFC8259#section-2">Section&nbsp;2 JSON Grammar</a> of
1527-
[[RFC8259]], and furthermore comply with the following constraints:
1531+
<dd>is the set of
1532+
<a>strings</a>,
1533+
numbers (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>),
1534+
<a data-cite="INFRA#ordered-map">maps</a>
1535+
(mapping <a>strings</a> to values in the <a href="#JSON-value-space">value space</a> where the order of <a data-cite="INFRA#entry">map entries</a> is not significant),
1536+
<a data-cite="INFRA#list">lists</a>
1537+
(of values in the <a href="#JSON-value-space">value space</a>), and
1538+
literal values (<a data-cite="INFRA#boolean">`true`, `false`</a>, and <a data-cite="INFRA#nulls">`null`</a>)
1539+
from [[[INFRA]]] [[INFRA]] and [[[XMLSCHEMA11-2]]] [[XMLSCHEMA11-2]].
1540+
1541+
<p>Two values (|a| and |b|) are considered equal if:
1542+
<ul>
1543+
<li>they are the same <a>string</a>,
1544+
number (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>), or
1545+
literal value;</li>
1546+
<li>they are both <a data-cite="INFRA#list">lists</a> containing <a data-cite="INFRA#list-item">items</a>
1547+
which are pairwise equal – meaning that each <a data-cite="INFRA#list-item">item</a>
1548+
in |a| is equal the <a data-cite="INFRA#list-item">item</a>
1549+
at the corresponding index in |b|,
1550+
and both |a| and |b| have the same <a data-cite="INFRA#list-size">size</a>; or</li>
1551+
<li>if they are both <a data-cite="INFRA#ordered-map">maps</a> with equal <a data-cite="INFRA#entry">entries</a>
1552+
– meaning that both |a| and |b| have the same <a data-cite="INFRA#map-size">size</a>,
1553+
and for each entry <var>e<sub>a</sub></var> in |a|
1554+
there is an entry <var>e<sub>b</sub></var> in |b|
1555+
such that the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>a</sub></var>
1556+
equals the <a data-cite="INFRA#map-key">key</a> in <var>e<sub>b</sub></var>,
1557+
and the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>a</sub></var>
1558+
equals the <a data-cite="INFRA#map-value">value</a> in <var>e<sub>b</sub></var>.
1559+
<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.
1560+
For example, `{ "a": 1, "b": 2 } and { "b": 2, "a": 1 }` are considered equal.
1561+
</div>
1562+
</li>
1563+
</ul>
1564+
</dd>
1565+
1566+
<dt id="JSON-mapping">The <a>lexical-to-value mapping</a></dt>
1567+
<dd>maps every element of the lexical space to the result of parsing it into a
1568+
<a>string</a>,
1569+
number (<a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>),
1570+
<a data-cite="INFRA#ordered-map">map</a>,
1571+
<a data-cite="INFRA#list">list</a>, or
1572+
literal value (<a data-cite="INFRA#boolean">`true`, `false`</a>, and <a data-cite="INFRA#nulls">null</a>).
1573+
15281574
<ul>
1529-
<li>They MUST NOT contain any unnecessary whitespace.</li>
1530-
<li>Keys in objects MUST be ordered lexicographically.</li>
1531-
<li>Native Numeric values MUST be serialized according to
1532-
<a data-cite="ECMASCRIPT#sec-tostring-applied-to-the-number-type">Section&nbsp;7.1.12.1</a>
1533-
of [[ECMASCRIPT]].</li>
1534-
<li>Strings MUST be serialized with Unicode code points from <code class="codepoint">U+0000</code>
1535-
through <code class="codepoint">U+001F</code> using lower case hexadecimal Unicode notation
1536-
(`\uhhhh`) except for the set of predefined JSON control characters —
1537-
`U+0008`, `U+0009`, `U+000A`, `U+000C`, and `U+000D` — which SHOULD be
1538-
serialized as `\b`, `\t`, `\n`, `\f`, and `\r`, respectively. All
1539-
other Unicode characters SHOULD be serialized "as is", except
1540-
`U+005C` (`\`) and `U+0022` (`"`), which SHOULD be serialized as
1541-
`\\` and `\"`, respectively.</li>
1575+
<li>A <a href="RFC8259#section-4">JSON Object</a> is mapped to a <a data-cite="INFRA#ordered-map">map</a>
1576+
by transforming each object member into a <a data-cite="INFRA#map-entry">map entry</a>
1577+
with the <a data-cite="INFRA#map-key">key</a> taken from the member name and
1578+
<a data-cite="INFRA#map-value">value</a> taken by performing this mapping
1579+
to the member value.
1580+
<a data-cite="INFRA#map-entry">Map entries</a> are treated as being unordered.
1581+
</li>
1582+
<li>A <a href="RFC8259#section-5">JSON Array</a> is mapped to a <a data-cite="INFRA#list">list</a>
1583+
by performing this mapping on each array value.</li>
1584+
<li>A <a href="RFC8259#section-6">JSON Number</a> is mapped to
1585+
an <a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a>
1586+
using a method consistent with <a data-cite="XMLSCHEMA11-2#f-doubleLexmap">doubleLexicalMap</a>.
1587+
<div class="note">Some numbers cannot be represented
1588+
as finite <a data-cite="XMLSCHEMA11-2#double"><strong>xsd:double</strong></a> values
1589+
and may map to `+INF` or `-INF`.
1590+
Such values cannot be represented as JSON Numbers, limiting the ability to serialize such values back to JSON.</div>
1591+
</li>
1592+
<li>A <a href="RFC8259#section-7">JSON String</a> is mapped to
1593+
a <a>string</a>.</li>
1594+
<li>A <a href="RFC8259#section-3">JSON literal name</a> is mapped to
1595+
<a data-cite="INFRA#boolean">`true`, `false`</a>, or <a data-cite="INFRA#nulls">null</a>.</li>
15421596
</ul>
1543-
<div class="issue">The JSON Canonicalization Scheme (JCS) [[RFC8785]]
1544-
is an emerging standard for JSON canonicalization. This <code>rdf:JSON</code> specification
1545-
will likely be updated to require such a canonical representation.
1546-
Users are cautioned against depending on the lexical representation of
1547-
literals with the <code>rdf:JSON</code> datatype as RDF literals,
1548-
as the specifics of serialization may change in a future revision of
1549-
this document.</div>
1550-
Despite being defined as a set of strings, this value space is
1551-
considered distinct from the value space of <code>xsd:string</code>,
1552-
in order to avoid side effects with existing specifications.
15531597
</dd>
1554-
1555-
<dt id="JSON-mapping">The <a>lexical-to-value mapping</a></dt>
1556-
<dd>
1557-
maps every element of the lexical space to the result of
1558-
<ol>
1559-
<li>parsing it into an internal representation consistent with the
1560-
[[ECMASCRIPT]] representation created by using the <code>JSON.parse</code>
1561-
function as defined in <a data-cite="ECMASCRIPT#sec-json-object">Section&nbsp;24.5 The JSON Object</a>
1562-
of [[ECMASCRIPT]],</li>
1563-
<li>then serializing it into the JSON format [[RFC8259]] in compliance
1564-
with the constraints of the value space described above.</li>
1565-
</ol>
1566-
</dd>
1567-
1568-
<dt id="JSON-canonical">The canonical mapping</dt>
1569-
<dd>maps any element of the value space to the identical string in the
1570-
lexical space.</dd>
15711598
</dl>
15721599
</section>
15731600

@@ -1821,7 +1848,10 @@ <h2>Changes between RDF 1.1 and RDF 1.2</h2>
18211848
datatypes to this appendix.</li>
18221849
<li>Added the <a>rdf:JSON</a> datatype, the definition of which is adopted
18231850
from <a data-cite="?JSON-LD11#the-rdf-json-datatype">Section&nbsp;10.2 The `rdf:JSON` Datatype</a>
1824-
in [[?JSON-LD11]].</li>
1851+
in [[?JSON-LD11]].
1852+
Note that the <a href="#JSON-value-space">value space</a> defined here
1853+
updates the <a>value space</a> of the
1854+
<a data-cite="JSON-LD11#the-rdf-json-datatype">`rdf:JSON`</a> datatype defined in [[[JSON-LD11]]] [[JSON-LD11]]</li>
18251855
<li>Clarify Unicode terminology,
18261856
using <a data-cite="I18N-GLOSSARY#dfn-code-point" class="lint-ignore">Unicode code points</a>,
18271857
and restriction to the XML <a data-cite="XML11#charsets">Char</a> production.

0 commit comments

Comments
 (0)