Hi Christian,
Seems to work fine with latest snapshot with some straightforward cases but I do get an error in some cases which I cannot understand. Though I appreciate that it may be difficult to support all types of dynamic calls.
The error is: [bxerr:BXXQ0001] No updating expression allowed.
I am not using updating expressions. I also tried this in my little test project and it runs against the same error. I haven't been able to pinpoint it yet as it happens deep in the bowels of the code. When I'm able to I will let you know.
You can use a simple/small set of unit tests to verify [1]. I've %unit:ignored the last test that causes the error above.
Cheers, --Marc
[1] https://github.com/xokomola/origami-examples/blob/master/check/test-eval.xqm
On Fri, Jan 15, 2016 at 6:57 PM, Christian GrĂ¼n christian.gruen@gmail.com wrote:
Hi Marc,
This was a deliberate restriction: As maps and arrays are function items, and as they can contain references to other functions that have been declared in the evaluated query, it is generally tricky to evaluate and return them dynamically.
However, I spent some more thoughts on the underlying semantics, and I may have found a solution that overcomes some of the earlier limitations.
A new snapshot is available [1], which now allows you to return function items (incl. maps and arrays) as result of xquery:eval. Your testing feedback will be welcome.
Christian
[1] http://files.basex.org/releases/latest/
On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel marc.van.grootel@gmail.com wrote:
Hi,
I'm trying to return a map or an array from xquery:eval. Seems this is not possible, yet the signature says it returns item()*
xquery:eval('1 + 1') => 2 xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*)
have no string representation. xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type map(*) have no string representation.
BTW: I saw that xquery:eval#3 is documented as returning item() while the other arities return item()*
Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I figure.
-- --Marc