Java and XQuery
Thursday, 3 November 2016 · 4 messages · last reply 4 Nov 2016
M
meumapple3 Nov 2016 16:51 #
Since BaseX is written in Java, I was wondering if ,given a XQuery script, one could get the corresponding "Java translation". Thanks!
Giuseppe
CG
Christian Grün3 Nov 2016 17:14 #
Quoted text · meumapple · 1 line
> Since BaseX is written in Java, I was wondering if ,given a XQuery script, one could get the corresponding "Java translation". Thanks!
I tend to say »no«; but maybe I need more information. How do you
think could a Java translation of, let’s say, "for $x in 1 to 10
return /a/b/c[$x]" look like?M
meumapple4 Nov 2016 02:02 #
I would expect the corresponding Java code which produces the same result of the XQuery code. Isn't this what happens in the background?
Quoted text · Christian Grün · 3 lines
> Il giorno 03 nov 2016, alle ore 17:14, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Since BaseX is written in Java, I was wondering if ,given a XQuery script, one could get the corresponding "Java translation". Thanks!
I tend to say »no«; but maybe I need more information. How do you
think could a Java translation of, let’s say, "for $x in 1 to 10
return /a/b/c[$x]" look like?CG
Christian Grün4 Nov 2016 08:12 #
Quoted text · meumapple · 1 line
> I would expect the corresponding Java code which produces the same result of the XQuery code. Isn't this what happens in the background?
In the background, BaseX has a query processor which creates an abstract representation of the original query string. By using the -x flag or looking into the GUI query view, you get a glimpse of this structure. So, looking at your original query,
Quoted text · meumapple · 1 line
> one could get the corresponding "Java translation".
the XQuery string is obviously translated into something that can be interpreted by Java, and you can surely get this representation by looking into our code. Did you try that?
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery