Skip to content

Update round-tripping of numbers #79

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 3 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4737,8 +4737,10 @@ <h2>Data Round Tripping</h2>
representation as defined in [[XMLSCHEMA11-2]].</p>

<p>The <a>canonical lexical form</a> of an <em>integer</em>, i.e., a
<a>number</a> with no non-zero fractional part or a <a>number</a>
coerced to <code>xsd:integer</code>, is a finite-length sequence of decimal
<a>number</a> with no non-zero fractional part
<span class="changed">and an exponent less than <code>21</code>,</span>
or a <a>number</a> coerced to <code>xsd:integer</code>,
is a finite-length sequence of decimal
digits (<code>0-9</code>) with an optional leading minus sign; leading
zeros are prohibited. In JavaScript, implementers can use the following
snippet of code to convert an integer to
Expand All @@ -4753,7 +4755,9 @@ <h2>Data Round Tripping</h2>
</pre>

<p>The <a>canonical lexical form</a> of a <em>double</em>, i.e., a
<a>number</a> with a non-zero fractional part or a <a>number</a>
<a>number</a>
<span class="changed">which cannot be represented as an <em>integer</em></span>,
or a <a>number</a>
coerced to <code>xsd:double</code>, consists of a mantissa followed by the
character <code>E</code>, followed by an exponent. The mantissa is a
decimal number and the exponent is an integer. Leading zeros and a
Expand Down
8 changes: 8 additions & 0 deletions tests/toRdf-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,14 @@
"name": "literal_with_numeric_escape4",
"purpose": "literal with numeric escape4 \\u from N-Triples",
"input": "toRdf/nt16-in.jsonld"
}, {
"@id": "#trt01",
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
"name": "Representing numbers >= 1e21",
"purpose": "numbers with no fractions but that are >= 1e21 are represented as xsd:double",
"option": {"specVersion": "json-ld-1.1"},
"input": "toRdf/rt01-in.jsonld",
"expect": "toRdf/rt01-out.nq"
}
]
}
6 changes: 6 additions & 0 deletions tests/toRdf/rt01-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"number": {"@id": "http://example.com/number"}
},
"number": [-0e0, 8, 9.9, 1e21 ]
}
4 changes: 4 additions & 0 deletions tests/toRdf/rt01-out.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_:b0 <http://example.com/number> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <http://example.com/number> "8"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <http://example.com/number> "9.9E0"^^<http://www.w3.org/2001/XMLSchema#double> .
_:b0 <http://example.com/number> "1.0E21"^^<http://www.w3.org/2001/XMLSchema#double> .