slash operator in Basex 9.0.2

Friday, 6 July 2018 · 4 messages · last reply 7 Jul 2018
GC
Giuseppe Celano6 Jul 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
CG
Christian Grün7 Jul 2018 01:25 #
Looks like a too eager optimization. Did you have a chance to look at the resulting query plan? Giuseppe Celano <celano at informatik.uni-leipzig.de> schrieb am Fr., 6. Juli 2018, 22:40:
Quoted text · Giuseppe Celano · 14 lines
> 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 > >
GC
Giuseppe Celano7 Jul 2018 01:41 #
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 at informatik.uni-leipzig.de E-mail: giuseppegacelano at gmail.com Web site 1: http://www.dh.uni-leipzig.de/wo/team/ Web site 2: https://sites.google.com/site/giuseppegacelano/
Quoted text · Christian Grün · 18 lines
> On Jul 7, 2018, at 1:25 AM, Christian Grün <christian.gruen at gmail.com> wrote: > > Looks like a too eager optimization. Did you have a chance to look at the resulting query plan? > > > > Giuseppe Celano <celano at informatik.uni-leipzig.de <mailto:celano at 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 >
CG
Christian Grün7 Jul 2018 01:58 #
Giuseppe, Grazie per la tua pronta risposta. In the latest snapshot, the last step of a path expression will only be rewritten to the right operand of a map expression if the second last step is guaranteed to yield nodes [1,2]. Gute Nacht, Christian [1] https://github.com/BaseXdb/basex/commit/a3b3d866925d4908466cc2cd27c7f617dc5ee5a5 [2] http://files.basex.org/releases/latest/
Quoted text · Giuseppe Celano · 41 lines
On Sat, Jul 7, 2018 at 1:41 AM Giuseppe Celano <celano at informatik.uni-leipzig.de> wrote: > > 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 at informatik.uni-leipzig.de > E-mail: giuseppegacelano at 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 at gmail.com> wrote: > > Looks like a too eager optimization. Did you have a chance to look at the resulting query plan? > > > > Giuseppe Celano <celano at 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 >> >

⚡Generated with XQuery