From cc3b920b4ca22acc66495bedd08e325ef40f33a2 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 15 Apr 2019 15:33:57 -0700 Subject: [PATCH 1/3] Update round-tripping of numbers to consider non-fractional numbers >= 0e21 and add test. --- index.html | 10 +++++++--- tests/toRdf-manifest.jsonld | 8 ++++++++ tests/toRdf/rt01-in.jsonld | 6 ++++++ tests/toRdf/rt01-out.nq | 4 ++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/toRdf/rt01-in.jsonld create mode 100644 tests/toRdf/rt01-out.nq diff --git a/index.html b/index.html index bff1300f..98a777af 100644 --- a/index.html +++ b/index.html @@ -4737,8 +4737,10 @@

Data Round Tripping

representation as defined in [[XMLSCHEMA11-2]].

The canonical lexical form of an integer, i.e., a - number with no non-zero fractional part or a number - coerced to xsd:integer, is a finite-length sequence of decimal + number with no non-zero fractional part + and an exponent less than or equal to 21, + or a number coerced to xsd:integer, + is a finite-length sequence of decimal digits (0-9) 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 @@ -4753,7 +4755,9 @@

Data Round Tripping

The canonical lexical form of a double, i.e., a - number with a non-zero fractional part or a number + number + which cannot be represented as an integer, + or a number coerced to xsd:double, consists of a mantissa followed by the character E, followed by an exponent. The mantissa is a decimal number and the exponent is an integer. Leading zeros and a diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index a273e9e2..1e8b012d 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -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" } ] } diff --git a/tests/toRdf/rt01-in.jsonld b/tests/toRdf/rt01-in.jsonld new file mode 100644 index 00000000..9aaa87be --- /dev/null +++ b/tests/toRdf/rt01-in.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "number": {"@id": "http://example.com/number"} + }, + "number": [-0e0, 8, 9.9, 1e21 ] +} diff --git a/tests/toRdf/rt01-out.nq b/tests/toRdf/rt01-out.nq new file mode 100644 index 00000000..65c50746 --- /dev/null +++ b/tests/toRdf/rt01-out.nq @@ -0,0 +1,4 @@ +_:b0 "0"^^ . +_:b0 "8"^^ . +_:b0 "9.9E0"^^ . +_:b0 "1.0E21"^^ . From 4a3e1d8affd8c44e80bd191bf7390906509fb1f1 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Mon, 15 Apr 2019 15:43:07 -0700 Subject: [PATCH 2/3] Update index.html Co-Authored-By: gkellogg --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 98a777af..980276bf 100644 --- a/index.html +++ b/index.html @@ -4738,7 +4738,7 @@

Data Round Tripping

The canonical lexical form of an integer, i.e., a number with no non-zero fractional part - and an exponent less than or equal to 21, + and an exponent less than or equal to 21, or a number coerced to xsd:integer, is a finite-length sequence of decimal digits (0-9) with an optional leading minus sign; leading From fde59dedbba79b8e9f7e64570f2d6166e5c4b0a5 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Mon, 15 Apr 2019 16:49:00 -0700 Subject: [PATCH 3/3] Update index.html Co-Authored-By: gkellogg --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 980276bf..c0eec129 100644 --- a/index.html +++ b/index.html @@ -4738,7 +4738,7 @@

Data Round Tripping

The canonical lexical form of an integer, i.e., a number with no non-zero fractional part - and an exponent less than or equal to 21, + and an exponent less than 21, or a number coerced to xsd:integer, is a finite-length sequence of decimal digits (0-9) with an optional leading minus sign; leading