W3C home > Mailing lists > Public > public-schemaorg@w3.org > June 2020

Validating dates

From: Odessa Turner <odessa.paige.turner@gmail.com>
Date: Wed, 10 Jun 2020 13:55:07 -0400
Message-ID: <CALVZjRNPsATS0yvr8pRp2pmgQTaX9Zagrb-izHB-YS9NuWzw0w@mail.gmail.com>
To: public-schemaorg@w3.org
I have been trying to use SCHACL to validate dates as follows:

schacl_shape
{
  "@context": {
    "sh": "http://www.w3.org/ns/shacl#",
    "sch": "http://schema.org/",
    "t102": "http://tent102.org/",
    "xsd": "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#",
    "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 Friday, 12 June 2020 02:52:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 12 June 2020 02:52:39 UTC