Reputation: 706
I am trying to apply a range query on a property of the RDF which is of xsd:dateTime
format. This is my query:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?x WHERE { ?y <DATE:> ?x .
FILTER(?x>"2014-06-05T10:10:10+0530"^^xsd:dateTime) }
It gives warning and nothing as result:
WARN [main] (Log.java:78) - Datatype format exception: "2014-06-11T12:44:22+0530"^^xsd:dateTime
I don't understand what the problem is? I have stored the property in xsd:dateTime
format only.
Upvotes: 3
Views: 1575
Reputation: 85883
I have stored the property in xsd:dateTime format only.
The simple answer is that no, you have not stored the value as an xsd:dateTime. The standard xsd:dateTime says:
The lexical space of dateTime consists of finite-length sequences of characters of the form:
'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
Part of your dateTime matches that, viz., 2014-06-05T10:10:10
. However,
zzzzzz
(if present) represents the timezone (as described below).
When we look below, we see
The lexical representation of a timezone is a string of the form:
(('+' | '-') hh ':' mm) | 'Z'
, where
hh
is a two-digit numeral (with leading zeros as required) that represents the hours,mm
is a two-digit numeral that represents the minutes,'+'
indicates a nonnegative duration,'-'
indicates a nonpositive duration,'Z'
indicates a zero-timezone offset (UTC+0).
Your timezone doesn't match that. I think you probably meant +05:30
. and thus should have
"2014-06-05T10:10:10+05:30"^^xsd:dateTime
Sure enough, if we use Jena's command line tool qparse
:
$ qparse --query query.rq # the original query, warnigns
14:12:22 WARN NodeValue :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
14:12:22 WARN NodeValue :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
14:12:22 WARN NodeValue :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?x
WHERE
{ ?y <DATE:> ?x
FILTER ( ?x > "2014-06-05T10:10:10+0530"^^xsd:dateTime )
}
$ qparse --query query.rq # the updated query, no warnings
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?x
WHERE
{ ?y <DATE:> ?x
FILTER ( ?x > "2014-06-05T10:10:10+05:30"^^xsd:dateTime )
}
Upvotes: 2