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/ba...
On Thu, Feb 17, 2022 at 11:32 AM Ben Engbers Ben.Engbers@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