On 18/04/12 16:05, Gary King wrote:
It still seems odd to me, however, that dates and dateTimes can not be ordered (at least in ARQ
and in my reading of the specs, both> and< "return" type errors and produce
no bindings) but can be checked for equality. Does anyone have chapter and verse for how this
is specified in the standard?
Chapter:
http://www.w3.org/TR/xpath-functions/
and verse: the comparison algorithm in 3.2.7.3
http://www.w3.org/TR/xmlschema-2/#dateTime
You can compare dateTimes with and without timezone if the magnitude is
more than 14 hours (whatever the TZ might be you can be sure they are
ordered).
"=" and "!=" are a bit different to "<"
Consider:
'2000-01-01T00:00:00Z'^^xsd:dateTime != '2001-01-01'^^xsd:date
xsd:dateTime and xsd:date are different value spaces, so the system can
know they can not be the same value i.e. this is true, without knowing
how to compare them. Ditto "=" can determine that two literals can't be
equal and return false if the system knows they are from different value
spaces.
Apples do not equal oranges but you can't compare them for less than.
A comparison needs "same value space" - if different the "<" operator is
a type error.
Andy