I am using Jena's SPARQL engine and trying to write a query to filter on a date range as I need to find the value of a property after a fixed date.
My date property is in the following format:
Fri May 23 10:20:13 IST 2014
How do I write a SPARQL query to get other properties with dates greater than this?
With your data in that format you can't filter on a range of it without adding a custom extension function to ARQ (which is intended for advanced users) since you would need to parse and interpret the date time string.
What you should instead be doing is translating your data into the standard date time format
xsd:dateTime
that all SPARQL implementations are required to support. See the XML Schema Part 2: Datatypes specification for details of this format.Your specific example date would translate as follows:
And you must ensure that you declare it to be a typed literal of type
xsd:dateTime
when you use it in data and queries. For example in the readable Turtle RDF syntax:You could then write a SPARQL query that filters by range of dates like so:
This finds all records where
?date
is after the given date