From a3d1ddf7a30c6fee4b62c2f32cc92bc7bffb443a Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 20 Sep 2022 10:33:46 -0400 Subject: [PATCH 1/3] Regenerate Make-managed files pySHACL 0.20.0, recently released, includes support for incorporating ill-typedness of literals in review of SHACL Datatype Constraints. For unknown reasons, this is now causing some `xsd:decimal` literals to be flggged as non-conformant. This is being discussed further in pySHACL PR 157. References: * https://github.com/RDFLib/pySHACL/pull/157 Signed-off-by: Alex Nelson --- .../Oresteia/Oresteia_validation-develop.ttl | 38 +++++++++++++++++++ .../Oresteia/Oresteia_validation-unstable.ttl | 38 +++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl b/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl index b8541d92..25c9bf4f 100644 --- a/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl +++ b/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl @@ -2486,6 +2486,44 @@ location:longitude "2.331199"^^xsd:decimal ; ] ; ] , + [ + a sh:ValidationResult ; + sh:focusNode [ + a location:LatLongCoordinatesFacet ; + location:latitude "48.860346"^^xsd:decimal ; + location:longitude "2.331199"^^xsd:decimal ; + ] ; + sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; + sh:resultPath location:latitude ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape [ + sh:datatype xsd:decimal ; + sh:maxCount "1"^^xsd:integer ; + sh:nodeKind sh:Literal ; + sh:path location:latitude ; + ] ; + sh:value "48.860346"^^xsd:decimal ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode [ + a location:LatLongCoordinatesFacet ; + location:latitude "48.860346"^^xsd:decimal ; + location:longitude "2.331199"^^xsd:decimal ; + ] ; + sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; + sh:resultPath location:longitude ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape [ + sh:datatype xsd:decimal ; + sh:maxCount "1"^^xsd:integer ; + sh:nodeKind sh:Literal ; + sh:path location:longitude ; + ] ; + sh:value "2.331199"^^xsd:decimal ; + ] , [ a sh:ValidationResult ; sh:focusNode [ diff --git a/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl b/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl index b8541d92..25c9bf4f 100644 --- a/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl +++ b/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl @@ -2486,6 +2486,44 @@ location:longitude "2.331199"^^xsd:decimal ; ] ; ] , + [ + a sh:ValidationResult ; + sh:focusNode [ + a location:LatLongCoordinatesFacet ; + location:latitude "48.860346"^^xsd:decimal ; + location:longitude "2.331199"^^xsd:decimal ; + ] ; + sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; + sh:resultPath location:latitude ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape [ + sh:datatype xsd:decimal ; + sh:maxCount "1"^^xsd:integer ; + sh:nodeKind sh:Literal ; + sh:path location:latitude ; + ] ; + sh:value "48.860346"^^xsd:decimal ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode [ + a location:LatLongCoordinatesFacet ; + location:latitude "48.860346"^^xsd:decimal ; + location:longitude "2.331199"^^xsd:decimal ; + ] ; + sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; + sh:resultPath location:longitude ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape [ + sh:datatype xsd:decimal ; + sh:maxCount "1"^^xsd:integer ; + sh:nodeKind sh:Literal ; + sh:path location:longitude ; + ] ; + sh:value "2.331199"^^xsd:decimal ; + ] , [ a sh:ValidationResult ; sh:focusNode [ From 90cf70f61101e7d069191e13bbe94e80108ba0f9 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 20 Sep 2022 11:51:21 -0400 Subject: [PATCH 2/3] Prevent default typing as xsd:double JSON-LD has a default conversion of non-integer literals to `xsd:double`, per Section B.1.3 of the JSON-LD 1.1 specification. What does not appear to be explained in the specification---at least, in that section---is what to do when there is an `@type` annotation accompanying a non-string `@value`. RDFLib, at least as of 6.2.0, does not use the `@type` annotation. This makes the pySHACL output look quite mysterious. This patch converts the `@value` to a string so `@type` will be respected. A follow-on patch will regenerate Make-managed files. References: * https://w3c.github.io/json-ld-syntax/#conversion-of-native-data-types Signed-off-by: Alex Nelson --- examples/illustrations/Oresteia/Oresteia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/illustrations/Oresteia/Oresteia.json b/examples/illustrations/Oresteia/Oresteia.json index fe6e61b3..ad605901 100644 --- a/examples/illustrations/Oresteia/Oresteia.json +++ b/examples/illustrations/Oresteia/Oresteia.json @@ -300,11 +300,11 @@ "@type": "uco-location:LatLongCoordinatesFacet", "uco-location:latitude": { "@type": "xsd:decimal", - "@value": 48.860346 + "@value": "48.860346" }, "uco-location:longitude": { "@type": "xsd:decimal", - "@value": 2.331199 + "@value": "2.331199" } } ] From 9a8cbdf7d330c4a30e7fc88e16bf72295211d93e Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 20 Sep 2022 11:52:14 -0400 Subject: [PATCH 3/3] Regenerate Make-managed files References: * https://w3c.github.io/json-ld-syntax/#conversion-of-native-data-types Signed-off-by: Alex Nelson --- .../Oresteia/Oresteia_validation-develop.ttl | 38 ------------------- .../Oresteia/Oresteia_validation-unstable.ttl | 38 ------------------- 2 files changed, 76 deletions(-) diff --git a/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl b/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl index 25c9bf4f..b8541d92 100644 --- a/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl +++ b/examples/illustrations/Oresteia/Oresteia_validation-develop.ttl @@ -2486,44 +2486,6 @@ location:longitude "2.331199"^^xsd:decimal ; ] ; ] , - [ - a sh:ValidationResult ; - sh:focusNode [ - a location:LatLongCoordinatesFacet ; - location:latitude "48.860346"^^xsd:decimal ; - location:longitude "2.331199"^^xsd:decimal ; - ] ; - sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; - sh:resultPath location:latitude ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; - sh:sourceShape [ - sh:datatype xsd:decimal ; - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:path location:latitude ; - ] ; - sh:value "48.860346"^^xsd:decimal ; - ] , - [ - a sh:ValidationResult ; - sh:focusNode [ - a location:LatLongCoordinatesFacet ; - location:latitude "48.860346"^^xsd:decimal ; - location:longitude "2.331199"^^xsd:decimal ; - ] ; - sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; - sh:resultPath location:longitude ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; - sh:sourceShape [ - sh:datatype xsd:decimal ; - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:path location:longitude ; - ] ; - sh:value "2.331199"^^xsd:decimal ; - ] , [ a sh:ValidationResult ; sh:focusNode [ diff --git a/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl b/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl index 25c9bf4f..b8541d92 100644 --- a/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl +++ b/examples/illustrations/Oresteia/Oresteia_validation-unstable.ttl @@ -2486,44 +2486,6 @@ location:longitude "2.331199"^^xsd:decimal ; ] ; ] , - [ - a sh:ValidationResult ; - sh:focusNode [ - a location:LatLongCoordinatesFacet ; - location:latitude "48.860346"^^xsd:decimal ; - location:longitude "2.331199"^^xsd:decimal ; - ] ; - sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; - sh:resultPath location:latitude ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; - sh:sourceShape [ - sh:datatype xsd:decimal ; - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:path location:latitude ; - ] ; - sh:value "48.860346"^^xsd:decimal ; - ] , - [ - a sh:ValidationResult ; - sh:focusNode [ - a location:LatLongCoordinatesFacet ; - location:latitude "48.860346"^^xsd:decimal ; - location:longitude "2.331199"^^xsd:decimal ; - ] ; - sh:resultMessage "Value is not Literal with datatype xsd:decimal" ; - sh:resultPath location:longitude ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; - sh:sourceShape [ - sh:datatype xsd:decimal ; - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:path location:longitude ; - ] ; - sh:value "2.331199"^^xsd:decimal ; - ] , [ a sh:ValidationResult ; sh:focusNode [