[redland-dev] Adding date/time datatypes to Rasqal
dave.beckett at bristol.ac.uk
Wed Jul 14 21:30:51 BST 2004
On Thu, 8 Jul 2004 19:14:32 +0200 René Puls <kianga at gmail.com> wrote:
> would it be possible to add support for date and times to Rasqal? I
> would like to do queries like the following:
> SELECT ?subject ?created
> WHERE (?subject dc:created ?date)
> AND date > "2004-07-08T16:15:10Z"^^xsd:dateTime
> USING dc FOR <http://purl.org/dc/elements/1.1/>
> (I'm not sure if that would be the right syntax, but you get the
It would be possible, however ...
> I would be willing to help, if I can get some directions where to
> start. My guess is that I need to add a new literal datatype
> RASQAL_LITERAL_DATETIME, but I'm not sure where I need to hook it up
> aside from the rasqal_literal_compare() function. Or would it be
> easier to just convert dates to simple timestamps (in seconds) and
> compare them as integers?
Yeah, that's the kind of thing that would be needed. You'd need
conversions to/from strings ot allow it to be returned to redland or
whatever. I'm guessing comparisons could be done by strings but
wouldn't be quite what you'd want. You'd also likely want
specialised date comparison operators (near(date, "7 days")). W3C
XML Schema datatypes has some of that I think.
The however... is a warning since datetimes are hard to get right,
and especially hard to internationalise. Simplified dates for
computers such as the ISO formats are OK, but have lots of
assumptions. Requiring a timezone or not? Allowing abbreviations of
datetime or not? Dates before the Gregorian year period? And so on.
I'm not sure how much supporting C code for dates would be needed.
Is converting it all to Unix dates sufficient?
Of course, it is often something people ask for in query languages!
More information about the redland-dev