F&O WD - duration and dateTime comparisons

Hi,

Re: Section 6.3 - Comparisons of Duration and Datetime Values

I think that the limitations that are placed on comparisons, as
described in this section, are overly severe. Just because durations
and date times of different kinds are not totally ordered, doesn't
mean that you can't have a shot at comparing some of them.

For example, you might not be able to give an absolute answer to:

  P1M > P30D

but you can easily answer:

  P1M > P15D

Similarly, you might not be able to give an absolute answer to:

  2002-01-15T19:16:00 > 2002-01-15T18:16:00+01:00

but you can easily answer:

  2002-01-15T19:16:00 > 2001-12-20T15:00:00+01:00

It seems very unhelpful to not allow even those comparisons for which
the answer is clear cut.


In XML Schema, there is nothing stopping you from using duration
values that include years and months for a data type that has been
restricted with a min/maxIn/Exclusive facet that uses days, hours,
minutes and seconds. Similarly, you can supply a dateTime that has a
timezone for a derived type whose limits have been defined with
dateTimes without a timezone.

The way XML Schema deals with these situations is to have
indeterminable comparisons return false. I therefore think that it
would be more consistent with XML Schema if indeterminable comparisons
between durations and between dateTimes returned false rather than
being an error.


If you do decide to draw a line between the two types of durations and
between the two types of dateTimes (and times), I suggest that you
indicate this by deriving two separate types from each of these
primitive types and describing them separately.


On a related matter, I note that equality comparisons of durations as
defined in XML Schema compare each component within the duration
separately. Thus:

  P1D != PT24H != PT1440M != PT86400S

I think that this might be confusing, so I'd suggest adding a note
and/or example in Section 6.3.1 (op:duration-equal) Section 6.3.6
(op:duration-not-equal) to point it out.

I also think that this highlights Issue 25 (Is a normalize function
needed for duration types?), to which I think the answer is "yes". I'd
suggest that normalization specifies a number of months and number of
seconds. A good alternative would be that it normalizes such that the
number of months is less than 13, the number of hours less than 24,
the number of minutes less than 60 and the number of seconds less than
60.

Cheers,

Jeni
---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 15 January 2002 14:40:30 UTC