- From: Kirmse, Daniel <daniel.kirmse@sap.com>
- Date: Mon, 26 Apr 2004 10:02:48 +0200
- To: "'www-ql@w3.org'" <www-ql@w3.org>
- Message-ID: <9A33D7528D46DF47B0C0630618F3E6847A8454@dewdfe12.wdf.sap.corp>
Hi,
I have a question to the formal semantics of the general comparison. In <http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/#sec_general_comparisons> http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/#sec_general_comparisons it is described as follows:
[Expr1 GeneralOp Expr2]Expr
==
some $v1 in fn:data([Expr1]Expr) satisfies
some $v2 in fn:data([Expr2]Expr) satisfies
let $u1 := fs:convert-operand($v1, $v2) return
let $u2 := fs:convert-operand($v2, $v1) return
[GeneralOp]GeneralOp ($u1, $u2)
assuming Expr1 and Expr2 being sequences, there is a nested loop like this:
for all elements in Expr1
for all elements in Expr 2
let $u1 := fs:convert-operand($v1, $v2) return
let $u2 := fs:convert-operand($v2, $v1) return
if (GeneralOp ($u1, $u2) == true)
leave
As described, $v1 will be converted to the type of $v2 or string depending on the type of $v2.
And then $v2 will be converted to the type of $v2??? Does this make any sense at all? Or should it rather be $v2 is converted to the type of $u1? In case of $v2 has type not equal xdt:untypedAtomic $u1 has the same type as $v2 and in the other case $u1 has type string and converting $v1 with $expected = type($u2) = xdt:string would yield $u2 having type string as well.
Am I right in assuming the correct equation to be:
[Expr1 GeneralOp Expr2]Expr
==
some $v1 in fn:data([Expr1]Expr) satisfies
some $v2 in fn:data([Expr2]Expr) satisfies
let $u1 := fs:convert-operand($v1, $v2) return
let $u2 := fs:convert-operand($v2, $u1) return
[GeneralOp]GeneralOp ($u1, $u2)
or am I just plain wrong?
Dealing with the same issue:
Considering function fs:convert-operand as described in <http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/> http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/#sec_convert_operand.
When having <http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/> statEnv. <http://www.w3.org/TR/2004/WD-xquery-semantics-20040220/> xpath1.0_compatibility = false, type($actual) = String and type($expected) = Integer no conversion is done, right?
Considering a general comparison of a string and an integer value. According to the formal semantics of the general comparison, convert-operand would be called for both values but no conversion would take place actually. So I end up with a comparison of a string and an integer that is not defined (no overloaded comparison function exists taken these two types). That would force me to throw a XP0004 or XP0006 error due top the incompatible types, right?
Thanks & Cheers
Daniel
Received on Monday, 26 April 2004 04:04:18 UTC