SPARQL date conversion

We created the SPARQL endpoint with dotnetrdf, and I'm new to when connected to SPARQL. Date fields are stored as strings in format MM/DD/YYYY. Now there is a requirement for comparing dates ( > <), for which the string must be converted to xsd:datetimeor xsd:datein the SPARQL query. Is there any way to do this? Any other alternative?

Are there any good examples for date related SPARQL queries in dotnetrdf?

Thank.

+5
source share
1 answer

I think the answer is that you can, but probably don't want to!

You must do this with the SPARQL 1.1 function SUBSTRalong with concatand strdt.

Something along the lines

strdt(concat(substr(?x, 7, 4), '-', substr(?x, 1, 2), '-', substr(?x, 4, 2), 'T00:00:00'), xsd:dateTime)

?x MM/DD/YYYY. xsd:dateTime, .

, MM/DD/YYYY, xsd:dates xsd:dateTimes.

+4

All Articles