dbpedia / databus

A digital factory platform for managing files online with stable IDs, high-quality metadata, powerful API and tools for building on data: find, access, make interoperable, re-use
Apache License 2.0
40 stars 17 forks source link

Dateformat of Issued and modified #96

Open kurzum opened 1 year ago

kurzum commented 1 year ago

Milliseconds are now in the issued and modified field. Should be caught by SHACL.

PREFIX dct: <http://purl.org/dc/terms/>
PREFIX databus: <https://dataid.dbpedia.org/databus#>
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dcat: <http://www.w3.org/ns/dcat#>

select * where { 
 ?latestDatasets a databus:Version .
 ?latestDatasets dct:issued ?issued.
 ?latestDatasets dcterms:modified ?modified

} ORDER BY DESC(?issued) 
LIMIT 100

Also for distributions:

PREFIX dct: <http://purl.org/dc/terms/>
PREFIX databus: <https://dataid.dbpedia.org/databus#>
PREFIX dataid: <http://dataid.dbpedia.org/ns/core#>
PREFIX dcat: <http://www.w3.org/ns/dcat#>

select * where { 
 [] dcat:distribution ?dist .
 ?dist dct:issued ?issued.

} ORDER BY DESC(?issued) 
LIMIT 100

Screenshot from 2023-07-19 15-21-49

holycrab13 commented 1 year ago

Using JS DateTime "toISOString()" for all time-related fields now (ISO 8601)

kurzum commented 1 year ago

We should add the DateTime regex to SHACL issued and modified and other datettime @manonthegithub could you find the correct/official regex for datetime?

I tested at https://shacl.org/playground/ with

@prefix dash: <http://datashapes.org/dash#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

schema:PersonShape
    a sh:NodeShape ;
    sh:targetClass schema:Person ;
    sh:property [
        sh:path schema:birthDate ;
        sh:datatype xsd:dateTime ;
        sh:maxCount 1 ;
    ] .
@prefix ex: <http://example.org/ns#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:Bob
    a schema:Person ;
    schema:birthDate "Nonesense"^^xsd:dateTime .

Could you test the regex in the playground and post it here? We can change it in our SHACL php generator then.

manonthegithub commented 1 year ago

Testing the inputs in Jena from store repo gives errors as expected.... The problem is not in shacl, but in the library used. I suggest either using another shacl library or just the service GStore already provides.

manonthegithub commented 1 year ago

I am against using regexes

but Petra suggests the following:

^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$
manonthegithub commented 1 year ago

Lets duplicate official in the old docs:

-?([1-9][0-9]{3,}|0[0-9]{3})
-(0[1-9]|1[0-2])
-(0[1-9]|[12][0-9]|3[01])
T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?