Understanding General Comparison as described in XQuery Formal Se mantics section 4.5.2

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 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
		GeneralOp ($u1, $u2)

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?

Thanks & Cheers,
Daniel
 

Received on Tuesday, 13 April 2004 10:49:47 UTC