nasty bug with xquery empty sequence ()
Sunday, 30 May 2010 · 2 messages
SS
Sandra Maria Silcot30 May 2010 04:04 #
To basex developers,
The following xquery returns 464 <persName> elements with saxonHE but fails to produce any <persName> elements when the query is run in basex (6.1.3).
for $RT in ("c31a")
let $theseRecs := //c31a[sourceVol="CON 31/2"]
let $ctr := count($theseRecs)
let $pList := <listPersName n="{$ctr}">{
for $p at $i in $theseRecs
let $conref := if ( $RT = "c37v" ) then <hi/> else ()
return <persName id="{$p/@xml:id}">{$i}</persName>
}</listPersName>
return ( $pList,<hello/> )If the xquery null sequence () in line 6 is changed to an empty string: else ""
I get the expected 464 results. With () in the else I get only this:
<listPersName n="464"/>
<hello/>I had a devil of a time detecting this. I also have encountered bad behaviour when running queries against attributes which exist but have no value, like this:
<el attr="">In Saxon I can search for //el[@attr=""] and get results but basex does not find these cases.
Hoping these bugs can be quickly squashed.
regards,
Sandra
CG
Christian Grün30 May 2010 15:21 #
Sandra,
thanks for your profound feedback, which is always valuable. Your bugs should now be fixed; please try:
http://www.basex.org/maven/org/basex/basex/6.1.4
Quoted text · Sandra Maria Silcot · 3 lines
> The following xquery returns 464 <persName> elements with saxonHE but > fails to produce any <persName> elements when the query is run in basex > (6.1.3).
I could break down the problem to the following query…
for $a in 1
let $b := ()
return $a…in which the FLWOR clause was optimized away. We didn't notice this bug before as the optimization worked well on queries like the following:
let $a := 1
let $b := ()
return $a
for $a in 1
for $b in ()
return $aQuoted text · Sandra Maria Silcot · 5 lines
> I had a devil of a time detecting this. I also have encountered bad > behaviour when running queries against attributes which exist but have no > value, like this: > > <el attr="">
Yep… The index now remembers empty strings as well. Please rebuild your indexes to get this one working.
All the best,
Christian
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery