rdf4j
rdf4j copied to clipboard
Support for xsd:date cast function
Problem description
SPARQL defines a number of casting functions for various XSD datatypes as described in https://www.w3.org/TR/sparql11-query/#FunctionMapping.
When porting an application from Jena, we encountered one that is implemented there, but missing in RDF4J: xsd:date()
. This function is not described in the SPARQL standard, hence likely left out in RDF4J, but as SPARQL allows for additional casts, it would be great to have this function also in RDF4J.
Our ported code currently throws an RDF4J exception when encountering this funciton in a (generated) query.
See https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/function/CastXSD.java and https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/function/FunctionCastXSD.java for the Jena casting functions.
Preferred solution
Support for xsd:date()
casting function.
Are you interested in contributing a solution yourself?
No response
Alternatives you've considered
No response
Anything else?
No response
If you would like to contribute a fix for this you can take inspiration from the code that casts xsd:dateTime.
Don't forget to update the service file with your new class.