Are there any SPARQL methods to extract an xsd:time value from a xsd:dateTime?
I want to write queries that find dateTimes that occur before or after a given time of day. For example:
select * where {
# this doesn't work. Is there another way?
#bind (xsd:time(now()) as ?timeOfDay)
bind ("07:00:00Z"^^xsd:time as ?timeOfDay )
bind (?timeOfDay > "08:00:00Z"^^xsd:time as ?testResult)
}
Afaict the only way is to extract the components manually:
select * where {
bind(now() as ?aDateTime)
bind(hours(?aDateTime) as ?h)
bind(minutes(?aDateTime) as ?m)
bind(seconds(?aDateTime) as ?s)
bind(<http://www.w3.org/2003/11/swrlb#time>(?h, ?m, ?s) as ?aTime)
}
+-----------------------------------------------+-------+-------+--------+--------------------------+
| aDateTime | h | m | s | aTime |
+-----------------------------------------------+-------+-------+--------+--------------------------+
| "2017-08-31T17:01:11.778-05:00"^^xsd:dateTime | 17 | 1 | 11.778 | "17:01:11.778"^^xsd:time |
+-----------------------------------------------+-------+-------+--------+--------------------------+