List of functions created in xquery:eval-update show unexpected behavior
Sunday, 14 August 2022 · 3 messages · last reply 15 Aug 2022
WS
Wiemer, Sebastian14 Aug 2022 13:09 #
Hi,
I ran over an unexpected bahavior of BaseX 9.7.3
Can anyone explain?
Note: BaseX 9.7.3 is running with MIXUPDATES=true
file1.xq: create to functions in a list and call each function with a list comprehension ----
declare function local:bla(){<bla id=""/> };
declare function local:blubb(){<blubb id=""/> };
(local:bla#0,local:blubb#0)!.()
----
Result: as expected
<bla id=""/>
<blubb id=""/>file2.xq: same as above, but in an
xquery:eval
---
xquery:eval(
'
declare function local:bla(){<bla id=""/>};
declare function local:blubb(){<blubb id=""/> };
local:bla#0,local:blubb#0
'
)!.()
---Result: as expected
<bla id=""/>
<blubb id=""/>file3.xq: same as file1, but with a little "twist"
---
declare function local:bla(){<bla/> update {insert node attribute id {} into .}}; declare function local:blubb(){<blubb/> update {insert node attribute id {} into .}}; (local:bla#0,local:blubb#0)!.()
---
Result: as expected
<bla id=""/>
<blubb id=""/>file4.xq trying to call the same with
xquery:eval will not work ([xquery:update] No updating expression allowed.), so we use xquery:eval-update() ---
xquery:eval-update(
'
declare function local:bla(){<bla/> update insert node attribute id {} into .}; declare function local:blubb(){<blubb/> update insert node attribute id {} into .}; local:bla#0,local:blubb#0
'
)!.()--
Result: expected
<bla id=""/>
<blubb id=""/>
But the result is:
local:bla#0
local:blubb#0
file5.xq:
---
xquery:eval-update(
'
declare function local:bla(){<bla/> update insert node attribute id {} into .}; declare function local:blubb(){<blubb/> update insert node attribute id {} into .}; local:bla#0
'
)()
---
Result: as expected
<bla id=""/>
Is this a bug? A for-loop will not work either.
Best regards,
Sebastian
IT-Tacheles – IT-Themen auf den Punkt
Folge 38: Datenplattformen
https://www.adesso.de/de/news/it-tacheles/folge-38.jsp?pk_campaign=ittacheles&pk_source=email&pk_medium=banner&pk_content=38_datenplattformen
-------------------------------------------------------Quoted text · 1 line
>>> business. people. technology. <<<
-------------------------------------------------------
adesso SE mit Sitz in Dortmund
Vorstand: Michael Kenfenheuer (Vors.), Dirk Pothen, Andreas Prenneis, Stefan Riedel, Jörg Schroeder, Torsten Wegener Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn
Amtsgericht Dortmund HRB 20663
CG
Christian Grün14 Aug 2022 13:54 #
Hi Sebastian,
Thanks for the observation. I’ve created an issue to track this down [1].
Best,
Christian
[1] https://github.com/BaseXdb/basex/issues/2136
Quoted text · Sebastian · 113 lines
On Sun, Aug 14, 2022 at 1:09 PM Wiemer, Sebastian < Sebastian.Wiemer at adesso.de> wrote: > Hi, > > I ran over an unexpected bahavior of BaseX 9.7.3 > Can anyone explain? > > Note: BaseX 9.7.3 is running with MIXUPDATES=true > > file1.xq: create to functions in a list and call each function with a list > comprehension > ---- > declare function local:bla(){<bla id=""/> }; > declare function local:blubb(){<blubb id=""/> }; > (local:bla#0,local:blubb#0)!.() > ---- > > Result: as expected > <bla id=""/> > <blubb id=""/> > > > > > file2.xq: same as above, but in an xquery:eval > --- > xquery:eval( > ' > declare function local:bla(){<bla id=""/>}; > declare function local:blubb(){<blubb id=""/> }; > local:bla#0,local:blubb#0 > ' > )!.() > > --- > > Result: as expected > <bla id=""/> > <blubb id=""/> > > file3.xq: same as file1, but with a little "twist" > --- > declare function local:bla(){<bla/> update {insert node attribute id {} > into .}}; > declare function local:blubb(){<blubb/> update {insert node attribute id > {} into .}}; > (local:bla#0,local:blubb#0)!.() > --- > > Result: as expected > <bla id=""/> > <blubb id=""/> > > file4.xq trying to call the same with xquery:eval will not work > ([xquery:update] No updating expression allowed.), so we use > xquery:eval-update() > --- > > xquery:eval-update( > ' > declare function local:bla(){<bla/> update insert node attribute id {} > into .}; > declare function local:blubb(){<blubb/> update insert node attribute id > {} into .}; > local:bla#0,local:blubb#0 > ' > )!.() > > -- > > Result: expected > <bla id=""/> > <blubb id=""/> > > But the result is: > local:bla#0 > local:blubb#0 > > file5.xq: > --- > xquery:eval-update( > ' > declare function local:bla(){<bla/> update insert node attribute id {} > into .}; > declare function local:blubb(){<blubb/> update insert node attribute id > {} into .}; > local:bla#0 > ' > )() > --- > Result: as expected > <bla id=""/> > > > Is this a bug? A for-loop will not work either. > > Best regards, > Sebastian > > > > > <https://www.adesso.de/de/news/it-tacheles/folge-38.jsp?pk_campaign=ittacheles&pk_source=email&pk_medium=banner&pk_content=38_datenplattformen> > ------------------------------------------------------- > >>> business. people. technology. <<< > ------------------------------------------------------- > > adesso SE mit Sitz in Dortmund > Vorstand: Michael Kenfenheuer (Vors.), Dirk Pothen, Andreas Prenneis, > Stefan Riedel, Jörg Schroeder, Torsten Wegener > Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn > Amtsgericht Dortmund HRB 20663 >
CG
Christian Grün15 Aug 2022 11:47 #
The problems related to the
MIXUPDATES option have been fixed; a new snapshot is online [1].
Best,
Christian
[1] https://files.basex.org/releases/latest/Quoted text · Christian Grün · 11 lines
On Sun, Aug 14, 2022 at 1:54 PM Christian Grün <christian.gruen at gmail.com> wrote: > Hi Sebastian, > > Thanks for the observation. I’ve created an issue to track this down [1]. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/issues/2136 >
Written for BaseX 10.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery