here's the plan (it actually wrongly translates / into !):

Optimized Query:
(element j { ("fgrtu") }/data(.) ! replace(., "g", "h"))
Query:
<j>fgrtu</j>/data(.)/replace(., "g", "h")


Universität Leipzig
Institute of Computer Science, NLP
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: celano@informatik.uni-leipzig.de
E-mail: giuseppegacelano@gmail.com
Web site 1: http://www.dh.uni-leipzig.de/wo/team/
Web site 2: https://sites.google.com/site/giuseppegacelano/

On Jul 7, 2018, at 1:25 AM, Christian Grün <christian.gruen@gmail.com> wrote:

Looks like a too eager optimization. Did you have a chance to look at the resulting query plan?



Giuseppe Celano <celano@informatik.uni-leipzig.de> schrieb am Fr., 6. Juli 2018, 22:40:
I have noticed that in BaseX 9.0.2 a query like

<j>fgrtu</j>/data(.)/replace(., "g", "h")

gets evaluated (returning "fhrtu"), while in BaseX 8.x, Exist, and Zorba I get an error message (since, as expected, replace() is preceded not by a node but a string).

Is this a bug?

Ciao,
Giuseppe