Syntax-checker
Thursday, 17 February 2022 · 5 messages
BE
Ben Engbers17 Feb 2022 11:32 #
Hi,
After I had formulated the query in Basex-GUI, I tried to execute the same multi-line query in R/RbaseX. Nada ;-(
In R, one can use the paste function to concatenate strings. I use this function to build a string which is passed to the RbaseX-client. Example:
Stmt_1 <- "for $i in 1 to 2 return $i" => OK
Stmt_2 <- paste0("for $i in 1 to 2", => ERROR
"return $i")
It took 2 days of debugging before I found the error. Stmt_2 is concatenated to "for $i in 1 to 2return $i" and it is clear that this can't be executed. Instead of using the "paste0"-function I should have used "paste" which introdus a space between the strings to be concatenated. This works fine.
My problem is that the server/my client does not give an error-message. And this leads me to following question:
It would be helpfull if the syntax for the XQuery statement was checked before sending to the server. Where in the BaseX sources can I find the code for XQuery checking? Is it possible to translate tist code into R or is that way to difficult?
Ben Engbers
CG
Christian Grün17 Feb 2022 14:38 #
Hi Ben,
An XQuery string is parsed by the QueryParser class [1]. It’s the largest Java class in the project, so it might take some time to get it reimplemented in R.
Groetjes,
Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/QueryParser.java
Quoted text · Ben Engbers · 26 lines
On Thu, Feb 17, 2022 at 11:32 AM Ben Engbers <Ben.Engbers at be-logical.nl> wrote: > > Hi, > > After I had formulated the query in Basex-GUI, I tried to execute the > same multi-line query in R/RbaseX. Nada ;-( > In R, one can use the paste function to concatenate strings. I use this > function to build a string which is passed to the RbaseX-client. > Example: > Stmt_1 <- "for $i in 1 to 2 return $i" => OK > Stmt_2 <- paste0("for $i in 1 to 2", => ERROR > "return $i") > It took 2 days of debugging before I found the error. Stmt_2 is > concatenated to "for $i in 1 to 2return $i" and it is clear that this > can't be executed. Instead of using the "paste0"-function I should have > used "paste" which introdus a space between the strings to be > concatenated. This works fine. > > My problem is that the server/my client does not give an error-message. > And this leads me to following question: > It would be helpfull if the syntax for the XQuery statement was checked > before sending to the server. Where in the BaseX sources can I find the > code for XQuery checking? Is it possible to translate tist code into R > or is that way to difficult? > > Ben Engbers
BE
Ben Engbers17 Feb 2022 17:17 #
Hi Christian
I know that the R community is still looking for a XQuery tool. I won't say that RBaseX is the best but for the moment it is the best option I know of ;-). And bugs are becoming more and more rare (and difficult to resolve ;-().
Even after my retirement I spent a lot of time programming and working on the client gives me great fun. And introducing a syntax-checker would improve the usability.
I'll take a look at het QueryParser class and see if I can manage to implement it in R.
Gruesse,
Ben
PS. I've nearly completed a text that I mean to present to R-bloggers and in which I present my client. Would you care giving it a look?
Quoted text · Christian Grün · 9 lines
Op 17-02-2022 om 14:38 schreef Christian Grün: > Hi Ben, > > An XQuery string is parsed by the QueryParser class [1]. It’s the > largest Java class in the project, so it might take some time to get > it reimplemented in R. > > Groetjes, > Christian
CG
Christian Grün17 Feb 2022 17:21 #
Quoted text · Ben Engbers · 3 lines
> > PS. I've nearly completed a text that I mean to present to R-bloggers > and in which I present my client. Would you care giving it a look?
Feel free to share it with us.
OA
Like the R community, I too am looking for a good query tool/service -- particularly one that leverages the semantics and structure of the StratML schema. That's why I recently subscribed to this listserv, to see if BaseX might be well suited to that purpose
<https://stratml.us/carmel/iso/SMLTASwStyle.xml#_15446932-208f-11e6-a80e-7333871eb3cb>.
This group is more technically oriented than my interests. So I probably will be unsubscribing. However, if anyone has any leads on how I might engage those with the capabilities to provide a StratML-enabled query service, please let me know.
BTW, rOpenSci's about statement is now available in StratML format at https://stratml.us/drybridge/index.htm#ROS
To the degree they are aiming to build a /Truly Connected/ community of results <https://connectedcommunity.net/> (CoR), they may wish to consider the opportunity to leverage the StratML standard and supportive tools, apps, and services
<https://stratml.us/carmel/iso/SMLTASwStyle.xml> in support of realization of their mission
<https://stratml.us/carmel/iso/ROSwStyle.xml#_084e0c3e-9013-11ec-b291-a05b0a83ea00>.
Owen
https://www.linkedin.com/in/owenambur/
Quoted text · Ben Engbers · 30 lines
On 2/17/2022 11:17 AM, Ben Engbers wrote: > Hi Christian > > I know that the R community is still looking for a XQuery tool. I > won't say that RBaseX is the best but for the moment it is the best > option I know of ;-). And bugs are becoming more and more rare (and > difficult to resolve ;-(). > Even after my retirement I spent a lot of time programming and working > on the client gives me great fun. And introducing a syntax-checker > would improve the usability. > I'll take a look at het QueryParser class and see if I can manage to > implement it in R. > > Gruesse, > > Ben > > PS. I've nearly completed a text that I mean to present to R-bloggers > and in which I present my client. Would you care giving it a look? > > Op 17-02-2022 om 14:38 schreef Christian Grün: >> Hi Ben, >> >> An XQuery string is parsed by the QueryParser class [1]. It’s the >> largest Java class in the project, so it might take some time to get >> it reimplemented in R. >> >> Groetjes, >> Christian >
Written for BaseX 9.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery