Kārlis Čerāns
2015-03-09 11:57:32 UTC
Dear D2RQ creators and users,
is there any way, how to calculate a difference (in days) between two
datetime (or date) values over D2RQ SPARQL endpoint?
I am trying something like (on D2RQ master branch snapshot 0.8.2.-dev):
SELECT DISTINCT ?n ?p ?c ?d WHERE {
?s a ont:Student.
?s ont:personName ?n.
?r a ont:Registration.
?r ont:datePaid ?p.
?r ont:dateCompleted ?c.
BIND ( ?c - ?p AS ?d).
}
This is OK with parsing, however, I get empty results for ?d:
n p c d
"Dave"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Eve"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Charlie"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Ivan"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
It would be easy to calculate "approximate" duration values, using YEAR,
MONTH and DATE functions; the question is, if the actual date difference
can be computed.
Thanks,
Karlis Cerans
is there any way, how to calculate a difference (in days) between two
datetime (or date) values over D2RQ SPARQL endpoint?
I am trying something like (on D2RQ master branch snapshot 0.8.2.-dev):
SELECT DISTINCT ?n ?p ?c ?d WHERE {
?s a ont:Student.
?s ont:personName ?n.
?r a ont:Registration.
?r ont:datePaid ?p.
?r ont:dateCompleted ?c.
BIND ( ?c - ?p AS ?d).
}
This is OK with parsing, however, I get empty results for ?d:
n p c d
"Dave"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Eve"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Charlie"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
"Ivan"^^xsd:string "2013-01-10T00:00:00"^^xsd:dateTime
"2013-06-22T00:00:00"^^xsd:dateTime -
It would be easy to calculate "approximate" duration values, using YEAR,
MONTH and DATE functions; the question is, if the actual date difference
can be computed.
Thanks,
Karlis Cerans