[Michael Kay] RE: <enumeration> of duration types

At 9:45 AM +0100 050418, Henry S. Thompson wrote:
>Has this now been fixed, or not?

>  > The spec lays out the order in 3.2.6.2 [1] and clarifies
>>  normalization.
>>
>>  P12M is indeed P1Y but the comparison to P365D fails.
>>
>>  [1] http://www.w3.org/TR/xmlschema-2/#duration-order
>>
>
>I agree that this implies that durations are normalized for the purpose of
>ordering, but it's not clear that the order relation and equality matching
>(e.g. for matching the enumeration facet) have anything to do with each
>other. It's clearly stated elsewhere in the spec that equality is based on
>identity in the value space, and the value space for duration appears to
>treat P1Y and P12M as distinct values.
>
>I would like you to be right, but I don't see this in the spec.
>
>Michael Kay

It is true that in 1.0, P1Y and P12M are distinct duration values and
equality is identity.  The general concensus was that this situation
was unacceptable; it implies that P1Y and P12M are incomparable (not
less-than, not greater-than, and not identical/equal).  This situation
has been changed in 1.1.

In 1.1:

Durations have only a month property and a second property.  P1Y and
P12M are identical; both are (12,0).  OTOH,

Equality in 1.1 is not always identity, and in particular for duration
both equality and order are determined by adding the durations to four
standard dateTime values and checking the four resulting pairs of
dateTime values.

The rule is:  If all four resulting dateTime value pairs are equal,
then the durations are equal.  If all four resulting dateTime values
are ordered the same way, then the durations are ordered that way.
If some of the resulting dateTime values are equal and others not,
or if the order is not always the same direction, then the durations
are incomparable.  Clearly then the order is properly tied to equality.
This is the same algorithm used for order (but not equality) in 1.0.

It's an interesting question whether equality so defined is in fact
identity.  I believe it is, but I've never sat down and proved it.

-- 
Dave Peterson
SGMLWorks!

davep@iit.edu

Received on Monday, 18 April 2005 12:40:51 UTC