RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
41 stars 17 forks source link

`normalizeDate` examples #194

Open namedgraph opened 1 year ago

namedgraph commented 1 year ago

Issue type: :question: Question

I came across the normalizeDate function but cannot find any examples on how to use it. If I have $(date) values such as 2014 and 2014-05, can it be used parse them both as YYYY-MM-DD and make them a valid xsd:date values?

bjdmeest commented 1 year ago

The tests of the JAVA code are at https://github.com/FnOio/idlab-functions-java/blob/main/src/test/java/be/ugent/knows/idlabFunctions/IDLabFunctionsTest.java#L170 and there are some RML tests at https://github.com/RMLio/rmlmapper-java/blob/15c9c02c78aa743df02f7e773c2b1a229c3bc377/src/test/resources/rml-fno-test-cases/RMLFNOTCF009/mapping.ttl#L33, but no YARRRML tests indeed. This function currently only supports 'complete dates', as there's some ambiguity on how to solve this for partial dates: how would you expect 2014 to be parsed? as "2014"^^xsd:gYear or eg as "2014-01-01"^^xsd:date?

(I'm not really sure how to handle functions that can return different datatypes in the rest of the mapper, but that's complementary to this issue)