Dear BaseXer's,
The following query
for $xqV1 in collection( 'localex' )//kRecord let $xqV2 := $xqV1/*[1] , $xqV7 := $xqV1/*[2] where ( count($xqV1/*) = 2 ) and ( for $xqV3 in $xqV1/node let $xqV4 := $xqV3/*[1] where ( count($xqV3/*) = 1 ) and ( for $xqV5 in $xqV3/uid let $xqV6 := $xqV5/*[1] where ( count($xqV5/*) = 1 ) and ( ( ( $xqV6 = <string>uid.value</string> ) or ( fn:string( fn:node-name( $xqV6 ) ) = "var" ) ) ) and ( $xqV4 = $xqV5 ) return $xqV5 ) and ( $xqV2 = $xqV3 ) return $xqV3 ) return $xqV1
returns our expected result, while
for $xqV1 in collection( 'localex' )//kRecord let $xqV2 := $xqV1/*[1] , $xqV7 := $xqV1/*[2] where ( count($xqV1/*) = 2 ) and ( for $xqV3 in $xqV1/node let $xqV4 := $xqV3/*[1] where ( count($xqV3/*) = 1 ) and ( for $xqV5 in $xqV3/uid let $xqV6 := $xqV5/*[1] where ( count($xqV5/*) = 1 ) and ( ( ( $xqV6 = <string>uid.value</string> ) or ( fn:string( fn:node-name( $xqV6 ) ) = "var" ) ) ) and ( $xqV4 = $xqV5 ) return $xqV5 ) and ( $xqV2 = $xqV3 ) return $xqV3 ) and ( true ) return $xqV1
which is the same query with an 'and ( true )' added to the outer where-clause
returns no results.
Should we expect that
for ... let ... where C return ... == for ... let ... where C and ( true ) return ...
?
Best wishes,
--greg
P.S. Meanwhile, replacing 'true' with '1 = 1' has the expected semantics. That is
for ... let ... where C return ... == for ... let ... where C and ( 1 = 1 ) return ...
At least in the case below.
On Thu, Apr 5, 2012 at 9:31 AM, Meredith Gregory lgreg.meredith@gmail.comwrote:
Dear BaseXer's,
The following query
for $xqV1 in collection( 'localex' )//kRecord let $xqV2 := $xqV1/*[1] , $xqV7 := $xqV1/*[2] where ( count($xqV1/*) = 2 ) and ( for $xqV3 in $xqV1/node let $xqV4 := $xqV3/*[1] where ( count($xqV3/*) = 1 ) and ( for $xqV5 in $xqV3/uid let $xqV6 := $xqV5/*[1] where ( count($xqV5/*) = 1 ) and ( ( ( $xqV6 = <string>uid.value</string> ) or ( fn:string( fn:node-name( $xqV6 ) ) = "var" ) ) ) and ( $xqV4 = $xqV5 ) return $xqV5 ) and ( $xqV2 = $xqV3 ) return $xqV3 ) return $xqV1
returns our expected result, while
for $xqV1 in collection( 'localex' )//kRecord let $xqV2 := $xqV1/*[1] , $xqV7 := $xqV1/*[2] where ( count($xqV1/*) = 2 ) and ( for $xqV3 in $xqV1/node let $xqV4 := $xqV3/*[1] where ( count($xqV3/*) = 1 ) and ( for $xqV5 in $xqV3/uid let $xqV6 := $xqV5/*[1] where ( count($xqV5/*) = 1 ) and ( ( ( $xqV6 = <string>uid.value</string> ) or ( fn:string( fn:node-name( $xqV6 ) ) = "var" ) ) ) and ( $xqV4 = $xqV5 ) return $xqV5 ) and ( $xqV2 = $xqV3 ) return $xqV3 ) and ( true ) return $xqV1
which is the same query with an 'and ( true )' added to the outer where-clause
returns no results.
Should we expect that
for ... let ... where C return ... == for ... let ... where C and ( true ) return ...
?
Best wishes,
--greg
-- L.G. Meredith Managing Partner Biosimilarity LLC 7329 39th Ave SW Seattle, WA 98136
+1 206.650.3740
Dear Meredith,
for ... let ... where C return ... == for ... let ... where C and ( true ) return ...
you may be surprised to hear that "true" is no boolean value, but a valid path expression, yielding all element child nodes with the name "true". Using the function "true()" will give you the expected results.
Hope this helps, Christian
Dear Christian,
Thanks! It's true(), i didn't know that! Constants as zero-ary functions is certainly consistent with Universal Algebrahttp://en.wikipedia.org/wiki/Universal_algebra. So, i'm sympathetic to this design.
Best wises,
--greg
On Thu, Apr 5, 2012 at 9:52 AM, Christian Grün christian.gruen@gmail.comwrote:
Dear Meredith,
for ... let ... where C return ... == for ... let ... where C and (
true )
return ...
you may be surprised to hear that "true" is no boolean value, but a valid path expression, yielding all element child nodes with the name "true". Using the function "true()" will give you the expected results.
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de