[Bug 1414] [XQuery] Semantics: Treatment of untyped values with value comparisons

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





------- Additional Comments From jonathan.robie@datadirect.com  2005-05-17 22:31 -------
(In reply to comment #0)

> The argument of providing transitivity on the user-level syntax for lt, eq, 
> and friends is too weak to introduce the current inconsistency between the 
> general and value comparison treatment of untypedAtomic values. Instead, 
> logical discourse on the transitivity needs to be held on the expanded 
> expressions that have added the implied casts.

One of the important reasons for transitivity in these comparisons is to give us
a way to sort values. We use the 'gt' operator for this, and if we adopted your
proposal, it would cast untypedAtomic values in the same way as the > operator. 

Query:

let $a := <i>100</i>, 
    $b := <i>4</i>,
    $c := 5
return
    <compare>
        <ab>{ $a > $b }</ab>
        <bc>{ $b > $c }</bc>
        <ac>{ $a > $c }</ac>
    </compare>

Output:

<compare>
    <ab>false</ab>     (: "100" > "4" :)
    <bc>false</bc>     (: "4" > 5 :)
    <ac>true</ac>      (: "100" > 5 :)
</compare>


Some of these comparisons are done lexicographically, others numerically,
because of the casting rules, which makes the result intransitive. Suppose an
order by clause requires us to sort these three values. What order should they
appear in?

Received on Wednesday, 18 May 2005 00:11:44 UTC