(also asked at 
http://answers.semanticweb.com/questions/15915/comparing-xsddate-and-xsddatetime)

AFAICT from the specs, xsd:date and xsd:dateTimes are not comparable but 
consider this SPARQL 1.1 query which binds a bunch of dates and dateTimes (with 
and without timezones) and then compares them for equality and inequality.

prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix aaa: <http://example.com:80/#>

select ?dtzdtz ?dtzdt ?dtzdz ?dtzd ?ndtzdtz ?ndtzdt ?ndtzdz ?ndtzd?dtzZdt 
?ndtzZdt {
  bind('1999-05-31T13:20:00-05:00'^^xsd:dateTime as ?dtz1)
  bind('1999-05-31T13:20:00Z'^^xsd:dateTime as ?dtz1z)
  bind('2000-05-31T13:20:00-05:00'^^xsd:dateTime as ?dtz2)
  bind('2001-05-31T13:20:00-05:00'^^xsd:dateTime as ?dtz3)

  bind('1999-05-31T13:20:00'^^xsd:dateTime as ?dt1)
  bind('2000-05-31T13:20:00'^^xsd:dateTime as ?dt2)
  bind('2001-05-31T13:20:00'^^xsd:dateTime as ?dt3)

  bind('1999-05-31-05:00'^^xsd:date as ?dz1)
  bind('2000-05-31-05:00'^^xsd:date as ?dz2)
  bind('2001-05-31-05:00'^^xsd:date as ?dz3)

  bind('1999-05-31'^^xsd:date as ?d1)
  bind('2000-05-31'^^xsd:date as ?d2)
  bind('2001-05-31'^^xsd:date as ?d3)

  bind(?dtz1 = ?dtz2 as ?dtzdtz)
  bind(?dtz1 = ?dt1 as ?dtzdt)
  bind(?dtz1 = ?dz1 as ?dtzdt)
  bind(?dtz1 = ?d1 as ?dtzdt)

  bind(?dtz1 != ?dtz2 as ?ndtzdtz)
  bind(?dtz1 != ?dt1 as ?ndtzdt)
  bind(?dtz1 != ?dz1 as ?ndtzdz)
  bind(?dtz1 != ?d1 as ?ndtzd)

  bind(?dtz1z = ?dt1 as ?dtzZdt)
  bind(?dtz1z != ?dt1 as ?ndtzZdt)
}
In ARQ 2.8.8, this results in

#----------------------------------------------------------------------------------------
#| dtzdtz | dtzdt | dtzdz | dtzd | ndtzdtz | ndtzdt | ndtzdz | ndtzd | dtzZdt | 
ndtzZdt |
#========================================================================================
#| false  | false |       |      | true    |        | true   | true  |        | 
        |
#----------------------------------------------------------------------------------------
which indicates that ARQ thinks I can compare a zoned dateTime with an unzoned 
dateTime for equality but not for inequality which seems inconsistent.

Is there a way to think about this that doesn't cause my head to explode! :-)

thanks,
--
Gary Warren King, metabang.com 
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter

Reply via email to