Re: Validating dates

Hi

I asked Holger Knublauch who responded:

" suspect that's the same as

https://stackoverflow.com/questions/62330878/validate-xsddatetime-with-schacl/62353919#62353919

i.e. a JSON-LD syntax misunderstanding (which then propagated in the TTL
too). In particular,

"sh:dataType": {
      "@type": "@id"
    }

isn't supposed to be camelCase :)"

On Fri, 12 Jun 2020 at 03:55, Odessa Turner <odessa.paige.turner@gmail.com>
wrote:

> I have been trying to use SCHACL to validate dates as follows:
>
> schacl_shape
> {
>   "@context": {
>     "sh": "http://www.w3.org/ns/shacl# <http://www.w3..org/ns/shacl#>",
>     "sch": "http://schema.org/",
>     "t102": "http://tent102.org/",
>     "xsd": "http://www.w3.org/2001/XMLSchema#
> <http://www..w3.org/2001/XMLSchema#>",
>     "sh:path": {
>       "@type": "@id"
>     },
>     "sh:class": {
>       "@type": "@id"
>     },
>     "sh:targetClass": {
>       "@type": "@id"
>     },
>     "sh:nodeKind": {
>       "@type": "@id"
>     },
>     "sh:dataType": {
>       "@type": "@id"
>     }
>   },
>   "@graph": [
>     {
>       "@id": "t102:tentShape",
>       "@type": "sh:NodeShape",
>       "sh:targetClass": "t102:Tent",
>       "sh:property": [
>         {
>           "sh:path": "t102:tentVersion",
>           "sh:datatype": "xsd:string",
>           "sh:maxCount": 1
>         },
>         {
>           "sh:path": "t102:tentDateCommenced",
>           "sh:datatype": "xsd:dateTime",
>           "sh:message": "No date ('tentDateCommenced') has been specified,
> or is malformed."
>         }
>       ]
>     }
>   ]
> }
>
> data_graph
> {
>   "@context": {
>     "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
>     "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
>     "xsd": "http://www.w3.org/2001/XMLSchema#
> <http://www..w3.org/2001/XMLSchema#>",
>     "sch": "http://schema.org/",
>     "mne": "http://example.com/",
>     "t102": "http://tent102.org/",
>     "tentVersion": "t102:TentVersion",
>     "tentDateCommenced": {
>       "@id": "c64:tentDateCommenced",
>       "@type": "xsd:dateTime"
>     },
>     "tentDatePublished": {
>       "@id": "t102:tentDatePublished",
>       "@type": "xsd:dateTime"
>     },
>     "tentEnvironment": "t102:tentEnvironment"
>   },
>   "@graph": [
>     {
>       "@id": "c64:c4f49712-ab23-11ea-b1a7-f21898818f70",
>       "@type": "c64:Tent",
>       "tentVersion": "0.1",
>       "tentDateCommenced": "2020-06-10T14:07:50",
>       "tentDatePublished": "2020-06-10T14:07:50",
>       "tentEnvironment": "beach"
>     }
>   ]
> }
>
> I'm getting the following result:
>
> Constraint Violation in DatatypeConstraintComponent (
> http://www.w3.org/ns/shacl#DatatypeConstraintComponent):
> Severity: sh:Violation
> Source Shape: [ sh:datatype Literal("xsd:dateTime") ; sh:message
> Literal("No date ('tentCommenced') has been specified, or is malformed.") ;
> sh:path c64:tentCommenced ]
> Focus Node: c64:c4f49712-ab23-11ea-b1a7-f21898818f70
> Value Node: Literal("2020-06-10T14:07:50" = 2020-06-10 14:07:50,
> datatype=xsd:dateTime)
> Result Path: c64:tentDateCommenced
> Message: No date ('tentDateCommenced') has been specified, or is malformed.
>
> It seems that it's complaining about the "T" between the date and time,
> with follows the 8601 convention.
>
> Any thoughts on what I might be doing wrong here?
>
> Thanks,
>
> Dessa
>

Received on Sunday, 14 June 2020 12:52:50 UTC