From 3d4391c7e9aaf3d9ae8f768352915e5239523a26 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 8 Nov 2024 19:33:49 +0400 Subject: [PATCH 01/16] Add `.gitignore` with JetBrains IDEs folder ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e3f4af32 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# JetBrains IDEs +.idea/ From 5fb21fa8782f646332e0085e30b5788247b794be Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 8 Nov 2024 20:54:51 +0400 Subject: [PATCH 02/16] Add `fromRdf-manifest.jsonld#t0027` to test `"+INF"^^xsd:double` --- tests/fromRdf-manifest.jsonld | 10 ++++++++++ tests/fromRdf/0027-in.nq | 5 +++++ tests/fromRdf/0027-out.jsonld | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/fromRdf/0027-in.nq create mode 100644 tests/fromRdf/0027-out.jsonld diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index 1764a682..32a8b455 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -195,6 +195,16 @@ "purpose": "Check list generation with rdf:first property and rdf:nil value.", "input": "fromRdf/0026-in.nq", "expect": "fromRdf/0026-out.jsonld" + }, { + "@id": "#t0027", + "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], + "name": "native types flag set to true is ignored if the number provided is invalid in JSON", + "purpose": "Literals with datatype xsd:boolean, xsd:integer, and xsd:double are serialized using native scalar values if possible", + "option": { + "useNativeTypes": true + }, + "input": "fromRdf/0027-in.nq", + "expect": "fromRdf/0027-out.jsonld" }, { "@id": "#tdi01", "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], diff --git a/tests/fromRdf/0027-in.nq b/tests/fromRdf/0027-in.nq new file mode 100644 index 00000000..b643a3c4 --- /dev/null +++ b/tests/fromRdf/0027-in.nq @@ -0,0 +1,5 @@ + "true"^^ . + "false"^^ . + "1"^^ . + "1.1"^^ . + "+INF"^^ . diff --git a/tests/fromRdf/0027-out.jsonld b/tests/fromRdf/0027-out.jsonld new file mode 100644 index 00000000..67a880b4 --- /dev/null +++ b/tests/fromRdf/0027-out.jsonld @@ -0,0 +1,12 @@ +[ + { + "@id": "http://example.com/Subj1", + "http://example.com/prop": [ + { "@value": true }, + { "@value": false }, + { "@value": 1 }, + { "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"}, + { "@value": "+INF", "@type": "http://www.w3.org/2001/XMLSchema#double"} + ] + } +] From 52a47a4c0c57928a271cb01e33033aec9a18948b Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 8 Nov 2024 19:33:07 +0400 Subject: [PATCH 03/16] Reformat `Serialize RDF as JSON-LD Algorithm` section a bit --- index.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f860ab89..401bc588 100644 --- a/index.html +++ b/index.html @@ -5156,17 +5156,30 @@

Overview

and generating a JSON-LD document in expanded form for all RDF literals, IRIs and blank node identifiers. + If the useNativeTypes flag is set to true, RDF literals with a datatype IRI - that equals xsd:integer or xsd:double are converted - to a JSON numbers and RDF literals + that equals + +
    +
  • + xsd:integer or xsd:double are converted + to JSON numbers, +
  • +
  • and RDF literals with a datatype IRI that equals xsd:boolean are converted to true or - false based on their + false,
  • +
+ + based on their lexical form as described in . + + + Unless the useRdfType flag is set to true, rdf:type predicates will be serialized as @type as long as the associated object is either an IRI or blank node identifier.

From 17edb1bd06860eed723b8710d1a215d8cc8d24c7 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 8 Nov 2024 19:54:58 +0400 Subject: [PATCH 04/16] Specify exceptions to `useNativeTypes` flag --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.html b/index.html index 401bc588..3414c2c6 100644 --- a/index.html +++ b/index.html @@ -5166,6 +5166,14 @@

Overview

  • xsd:integer or xsd:double are converted to JSON numbers, +
  • and RDF literals with a datatype IRI From 0b32f750257140619d144dc422aa76cabc9cab86 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Tue, 12 Nov 2024 15:45:34 +0400 Subject: [PATCH 05/16] Format table --- index.html | 109 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index 3414c2c6..d1d186fa 100644 --- a/index.html +++ b/index.html @@ -5157,37 +5157,88 @@

    Overview

    RDF literals, IRIs and blank node identifiers. - If the useNativeTypes flag is set to true, - RDF literals with a - datatype IRI - that equals - - - - based on their - lexical form - as described in - . - + If the useNativeTypes flag is set + to true, RDF literals are converted to JSON values + based on their datatype IRI and lexical form as described + in . +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RDF datatypeValuesJSON
    (None, implying xsd:string)An RDF string literalJSON string literal
    xsd:string
    xsd:integerWhole number in the [-253 + 1, 253 + 1] range, representable as per [[IEEE-754-2008]]JSON Number
    Whole number out of that rangeJSON string literal
    Any other valueRaise an error
    xsd:doubleReal number in the [-253 + 1, 253 + 1] range, representable as per [[IEEE-754-2008]]JSON Number
    Real number out of that rangeJSON string literal
    + Non-numeric values: + +
      +
    • "NaN"^^xsd:double,
    • +
    • "+INF"^^xsd:double,
    • +
    • "-INF"^^xsd:double
    • +
    +
    Raise an error
    Any other value
    xsd:booleantruetrue
    falsefalse
    Any other valueRaise an error
    +

    Unless the useRdfType flag is set to true, rdf:type predicates will be serialized as @type as long as the associated object is either an IRI or blank node identifier.

    From 2f34954ec1e00884080b8073596cd35fb3b02db3 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Wed, 13 Nov 2024 17:35:05 +0400 Subject: [PATCH 06/16] Add some CSS formatting for `table.simple` --- index.html | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d1d186fa..a538d4b3 100644 --- a/index.html +++ b/index.html @@ -284,6 +284,48 @@ text-decoration: none; color: #666; } + + table.simple { + border-collapse: collapse; + width: 100%; + font-size: 14px; + } + + table.simple th, + table.simple td { + border: 1px solid #ddd; + padding: 8px; + vertical-align: top; /* Align text to the top */ + } + + table.simple th { + background-color: #f2f2f2; /* Light gray for headers */ + font-weight: bold; + text-align: left; + } + + table.simple tr:nth-child(even) { + background-color: #f9f9f9; /* Alternating row colors */ + } + + table.simple tr:hover { + background-color: #e9e9e9; /* Highlight on hover */ + } + + table.simple a { + color: #1a73e8; /* Make links a visible color */ + text-decoration: none; + } + + table.simple a:hover { + text-decoration: underline; + } + + table.simple td.error { + background-color: #FFA500; + color: #000; + font-weight: bold; + } @@ -5166,7 +5208,7 @@

    Overview

    - + @@ -5192,11 +5234,11 @@

    Overview

    - + - + @@ -5216,7 +5258,7 @@

    Overview

  • "-INF"^^xsd:double
  • - + @@ -5233,7 +5275,7 @@

    Overview

    - +
    RDF datatypeValuesRDF Literal JSON
    Any other valueRaise an errorRaise an error
    xsd:doublexsd:double Real number in the [-253 + 1, 253 + 1] range, representable as per [[IEEE-754-2008]] JSON Number
    Raise an errorRaise an error
    Any other value
    Any other valueRaise an errorRaise an error
    From fd224e19af6518453d132db9803427dae9468615 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Wed, 13 Nov 2024 19:28:35 +0400 Subject: [PATCH 07/16] Add 2.4.4 & 2.4.5 sections in Algorithm chapter --- index.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index a538d4b3..8b581fa7 100644 --- a/index.html +++ b/index.html @@ -5202,7 +5202,7 @@

    Overview

    If the useNativeTypes flag is set to true, RDF literals are converted to JSON values based on their datatype IRI and lexical form as described - in . + in .

    @@ -5591,10 +5591,24 @@

    Algorithm

    xsd:double and its lexical form is a valid xsd:integer or xsd:double - according [[XMLSCHEMA11-2]], set converted value + according to [[XMLSCHEMA11-2]], and if it is a numeric value + conformant to [[IEEE-754-2008]], then set converted value to the result of converting the lexical form - to a JSON number. + to a JSON number. + +
  • + Otherwise, if lexical form expresses a numerical value + outside of the range mandated by [[IEEE-754-2008]], then set + converted value to a JSON string literal containing + said lexical form. +
  • +
  • + Otherwise, if lexical form expresses a non-numeric value, + such as "+INF"^^xsd:double, an + invalid JSON literal + error has been detected and processing is aborted. +
  • Otherwise, if processing mode is not `json-ld-1.0`, From fd89aed5969275832c23cb605ac0780efaa9c7ea Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Wed, 13 Nov 2024 19:31:25 +0400 Subject: [PATCH 08/16] Add links to errors in the informative table --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 8b581fa7..dadc5b92 100644 --- a/index.html +++ b/index.html @@ -5234,7 +5234,7 @@

    Overview

  • - + @@ -5258,7 +5258,7 @@

    Overview

  • "-INF"^^xsd:double
  • - + @@ -5275,7 +5275,7 @@

    Overview

    - +
    Any other valueRaise an errorThrow invalid JSON literal
    Raise an errorThrow invalid JSON literal
    Any other value
    Any other valueRaise an errorThrow invalid JSON literal
    From 2c51796b4327438676a0002510c6150ccaae5a01 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Wed, 13 Nov 2024 19:43:49 +0400 Subject: [PATCH 09/16] Split into 0027 and 0028 tests --- tests/fromRdf-manifest.jsonld | 10 ++++++++++ tests/fromRdf/0027-in.nq | 2 +- tests/fromRdf/0027-out.jsonld | 2 +- tests/fromRdf/0028-in.nq | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/fromRdf/0028-in.nq diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index 32a8b455..4ef01d4d 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -205,6 +205,16 @@ }, "input": "fromRdf/0027-in.nq", "expect": "fromRdf/0027-out.jsonld" + }, { + "@id": "#t0028", + "@type": ["jld:NegativeEvaluationTest", "jld:FromRDFTest"], + "name": "native types flag set to true is ignored if the number provided is invalid in JSON", + "purpose": "+INF^^xsd:double causes a failure to serialize in JSON.", + "option": { + "useNativeTypes": true + }, + "input": "fromRdf/0028-in.nq", + "expectErrorCode": "invalid JSON literal" }, { "@id": "#tdi01", "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], diff --git a/tests/fromRdf/0027-in.nq b/tests/fromRdf/0027-in.nq index b643a3c4..e23fd3fd 100644 --- a/tests/fromRdf/0027-in.nq +++ b/tests/fromRdf/0027-in.nq @@ -2,4 +2,4 @@ "false"^^ . "1"^^ . "1.1"^^ . - "+INF"^^ . + "0.1e999999999999999"^^ . diff --git a/tests/fromRdf/0027-out.jsonld b/tests/fromRdf/0027-out.jsonld index 67a880b4..f41d8df9 100644 --- a/tests/fromRdf/0027-out.jsonld +++ b/tests/fromRdf/0027-out.jsonld @@ -6,7 +6,7 @@ { "@value": false }, { "@value": 1 }, { "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"}, - { "@value": "+INF", "@type": "http://www.w3.org/2001/XMLSchema#double"} + { "@value": "0.1e999999999999999", "@type": "http://www.w3.org/2001/XMLSchema#double"} ] } ] diff --git a/tests/fromRdf/0028-in.nq b/tests/fromRdf/0028-in.nq new file mode 100644 index 00000000..a4737b9e --- /dev/null +++ b/tests/fromRdf/0028-in.nq @@ -0,0 +1 @@ + "+INF"^^ . From 05139b00d2f4baba456d4c56063f9e76737956c8 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 22 Nov 2024 21:03:24 +0400 Subject: [PATCH 10/16] Update index.html Co-authored-by: Gregg Kellogg --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index dadc5b92..ba202275 100644 --- a/index.html +++ b/index.html @@ -5207,9 +5207,11 @@

    Overview

    - - - + + + + + From 7e5167e7bb79545d9e4a9ec199c6886ff1f1ffac Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sun, 24 Nov 2024 12:03:09 +0400 Subject: [PATCH 11/16] Update index.html Co-authored-by: Ted Thibodeau Jr --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ba202275..4b398ad0 100644 --- a/index.html +++ b/index.html @@ -5201,7 +5201,7 @@

    Overview

    If the useNativeTypes flag is set to true, RDF literals are converted to JSON values - based on their datatype IRI and lexical form as described + based on their datatype IRI and lexical form, as described in .

    From 35f105c079b19036bbf2a21a7c1636ec6896d5bf Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sun, 24 Nov 2024 12:04:51 +0400 Subject: [PATCH 12/16] Replace `range` with `ranges` Co-authored-by: Ted Thibodeau Jr --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 4b398ad0..ef7970dd 100644 --- a/index.html +++ b/index.html @@ -5600,8 +5600,8 @@

    Algorithm

    to a JSON number.
  • - Otherwise, if lexical form expresses a numerical value - outside of the range mandated by [[IEEE-754-2008]], then set + Otherwise, if lexical form expresses a numeric value + outside of the ranges supported by [[IEEE-754-2008]], then set converted value to a JSON string literal containing said lexical form.
  • From d02a82ba592265d1eb9904c38d8bad3b50d17583 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Sun, 24 Nov 2024 12:05:24 +0400 Subject: [PATCH 13/16] Insert a missing comma at `tests/fromRdf-manifest.jsonld` Co-authored-by: Ted Thibodeau Jr --- tests/fromRdf-manifest.jsonld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index 4ef01d4d..bd64b011 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -199,7 +199,7 @@ "@id": "#t0027", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], "name": "native types flag set to true is ignored if the number provided is invalid in JSON", - "purpose": "Literals with datatype xsd:boolean, xsd:integer, and xsd:double are serialized using native scalar values if possible", + "purpose": "Literals with datatype xsd:boolean, xsd:integer, and xsd:double are serialized using native scalar values, if possible", "option": { "useNativeTypes": true }, From d4cd1f6bd9795f85999b5387a966812c0a3365c5 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 29 Nov 2024 23:37:56 +0400 Subject: [PATCH 14/16] Update index.html Co-authored-by: Pierre-Antoine Champin --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index ef7970dd..80fd2f44 100644 --- a/index.html +++ b/index.html @@ -5205,7 +5205,8 @@

    Overview

    in .

    -
    RDF datatypeRDF LiteralJSON
    RDF datatypeRDF LiteralJSON
    +
    useNativeTypes is set to true From 5161fc4bc19ef7a9e8e73bc54cd6aa0e54919069 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 29 Nov 2024 23:38:52 +0400 Subject: [PATCH 15/16] Update index.html Co-authored-by: Pierre-Antoine Champin --- index.html | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 80fd2f44..d9cae6e6 100644 --- a/index.html +++ b/index.html @@ -5215,13 +5215,10 @@

    Overview

    - - - - - + + From a6132a4d1c50912cc7151224ad33133773156b47 Mon Sep 17 00:00:00 2001 From: Anatoly Scherbakov Date: Fri, 29 Nov 2024 23:39:17 +0400 Subject: [PATCH 16/16] Update index.html Co-authored-by: Pierre-Antoine Champin --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d9cae6e6..911a9481 100644 --- a/index.html +++ b/index.html @@ -5202,7 +5202,7 @@

    Overview

    If the useNativeTypes flag is set to true, RDF literals are converted to JSON values based on their datatype IRI and lexical form, as described - in . + in .