Adam Retter
2016-01-10 19:30:08 UTC
Given this valid XQuery (1):
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
)(function($k, $v) {
"$k=" || $k
})
I am wondering, if rewriting it to the following form results in a
valid query with the same execution result (2):
function($k, $v) {
"$k=" || $k
} =>
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
)()
In my mind it does, however I can't find a current implementation
(eXist, BaseX, Saxon-EE) which will execute it, I guess this is due to
evaluation order of the expressions (although I get parser errors).
If I add some brackets to (2), to add precedence to the evaluation
order so that I have (3):
function($k, $v) {
"$k=" || $k
} =>
(
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
))()
Then it does seem to execute on BaseX and Saxon, but it feels like I
shouldn't need to add the brackets and that (2) should work! Can
someone add some comment/insight for me as to whether the XQuery spec
requires these brackets to make the parse and execution correct?
Somehow, I can't see it at the moment...
Thanks Adam.
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
)(function($k, $v) {
"$k=" || $k
})
I am wondering, if rewriting it to the following form results in a
valid query with the same execution result (2):
function($k, $v) {
"$k=" || $k
} =>
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
)()
In my mind it does, however I can't find a current implementation
(eXist, BaseX, Saxon-EE) which will execute it, I guess this is due to
evaluation order of the expressions (although I get parser errors).
If I add some brackets to (2), to add precedence to the evaluation
order so that I have (3):
function($k, $v) {
"$k=" || $k
} =>
(
map:for-each(
map {
"a" : "1",
"b" : "2",
"c" : "3"
},
?
))()
Then it does seem to execute on BaseX and Saxon, but it feels like I
shouldn't need to add the brackets and that (2) should work! Can
someone add some comment/insight for me as to whether the XQuery spec
requires these brackets to make the parse and execution correct?
Somehow, I can't see it at the moment...
Thanks Adam.
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk