[Bug 2789] Substitutability of duration subtypes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2789





------- Additional Comments From mike@saxonica.com  2006-02-17 19:34 -------
The discussion on this bug has explored some interesting side alleys, but I'm
now trying to fulfil action A-288-29 by proposing changes for how durations
should be compared for equality (that is, eq and ne).

1. In the XPath/XQuery book, appendix B.2, delete the lines

A eq B 	xdt:yearMonthDuration 	xdt:yearMonthDuration 	
A eq B 	xdt:dayTimeDuration 	xdt:dayTimeDuration 
A ne B 	xdt:yearMonthDuration 	xdt:yearMonthDuration 	
A ne B 	xdt:dayTimeDuration 	xdt:dayTimeDuration	

2. In F+O delete sections 10.4.1 (op:yearMonthDuration-equal) and 10.4.4
(op:dayTimeDuration-equal)

3. To 10.4.7 op:duration-equal add after the second paragraph:

Note that this function (like any other) may be applied to arguments that are
derived from the types given in the function signature, including the two
subtypes xdt:dayTimeDuration and xdt:yearMonthDuration. With the exception of
the zero-length duration, no instance of xdt:dayTimeDuration will ever be equal
to an instance of xdt:yearMonthDuration.

Change the definition of the semantics of the function to read:

The semantics of the function are defined by the following expression:

xdt:yearMonthDuration($arg1) div xdt:yearMonthDuration('P1M')
 eq
xdt:yearMonthDuration($arg2) div xdt:yearMonthDuration('P1M')
    and
xdt:dayTimeDuration($arg1) div xdt:dayTimeDuration('PT1S')
 eq
xdt:dayTimeDuration($arg2) div xdt:dayTimeDuration('PT1S')

that is, the months and seconds components of the two durations are each equal.
 

To the examples, add

op:duration-equal(xdt:yearMonthDuration('P0Y'), xdt:dayTimeDuration('PT0D'))
returns true

op:duration-equal(xdt:yearMonthDuration('P1Y'), xdt:dayTimeDuration('PT365D'))
returns false

Received on Friday, 17 February 2006 19:34:17 UTC