With the 6.0 released version of BaseX.exe in Windows 7 (x64) I am encountering a serious problem, or problems. All of them relate to handling of empty sequences.
A simple example is of the form:
let $vcheck:=($versions,$v0)
If, e.g., $versions is a non-empty sequence, but $v0 is an empty sequence, I get [XPTY0004] Invalid cast from empty-sequence to node: ()
To try to route around this problem I even tried something such as:
let $vcheck:=if (empty($v0)) then $versions else($versions,$v0)
Not even this works - I get the same error originating from the 'else' clause. In my view this probably exposes a second bug as well: the "else" clause is clearly being evaluated despite the fact that the 'if' test is true. In addition to being inefficient, this is guaranteed to cause problems in many cases, e.g., if the result of the 'else' evaluation led to something such as division by zero.
Right now, I can't figure out a way to get around the problem of handling an empty sequence in any way as a workaround. (The 'union' operator also fails when one of the operands is an empty sequence, which also seems wrong.) I've tested the () sequencing in Altova XMLSpy (as an XPath 2.0 expression against a document) and it behaves as expected, simply ignoring empty sequences.
Because I can't find a way to work around it presently, I would classify this as a major problem.
..all feedback is welcome. If you still believe that this might be an error in the implementation, please don't hesitate to give me an update.
Christian
On Mon, Mar 8, 2010 at 12:27 PM, Phil newintellectual@gmail.com wrote:
With the 6.0 released version of BaseX.exe in Windows 7 (x64) I am encountering a serious problem, or problems. All of them relate to handling of empty sequences.
A simple example is of the form:
let $vcheck:=($versions,$v0)
If, e.g., $versions is a non-empty sequence, but $v0 is an empty sequence, I get [XPTY0004] Invalid cast from empty-sequence to node: ()
To try to route around this problem I even tried something such as:
let $vcheck:=if (empty($v0)) then $versions else($versions,$v0)
Not even this works - I get the same error originating from the 'else' clause. In my view this probably exposes a second bug as well: the "else" clause is clearly being evaluated despite the fact that the 'if' test is true. In addition to being inefficient, this is guaranteed to cause problems in many cases, e.g., if the result of the 'else' evaluation led to something such as division by zero.
Right now, I can't figure out a way to get around the problem of handling an empty sequence in any way as a workaround. (The 'union' operator also fails when one of the operands is an empty sequence, which also seems wrong.) I've tested the () sequencing in Altova XMLSpy (as an XPath 2.0 expression against a document) and it behaves as expected, simply ignoring empty sequences.
Because I can't find a way to work around it presently, I would classify this as a major problem.
___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
basex-talk@mailman.uni-konstanz.de