[basex-talk] Server-side XQuery scripts understanding their "context"

2020-01-20 Thread ERRINGTON Luke
Hi all, I'm trying to use the REST API to call server-side XQuery scripts. As I understand it, these scripts are not part of a database, but reside in the filesystem where BaseX is "installed" (or where RESTPATH points to). However, when I execute an XQuery I would like it to run on a particula

[basex-talk] Help

2020-01-20 Thread Pedro Sousa
Hello guys. I need to develop one API that must compare prices of laptops of two websites Fnac and Worten. I don't know to much about XML ( it's a college degree and it's one of last summarys that's i had left) Here it is what i need to do: It is intended to develop an application that allows yo

Re: [basex-talk] Help with a Query/Performance

2020-01-20 Thread Christian Grün
I missed to do the obvious next step. The following query is evaluated in a few milliseconds: declare variable $OFFSET1 := 3; declare variable $OFFSET2 := 2; let $container := db:open('tr-test')/Container let $message := $container/*:MessageA[$OFFSET1] let $detail := $message/MessageADe

Re: [basex-talk] Help with a Query/Performance

2020-01-20 Thread Christian Grün
Dear Tom, If you have large elements, it will usually be faster to create new elements. Here’s one way to do it: let $offset1 := 3 let $offset2 := 2 let $container := db:open('tr-test')/Container return element Container { (: add meta data elements :) $container/*[starts-with(name

Re: [basex-talk] How to escape/encode a search term using BaseX REST XQ

2020-01-20 Thread Christian Grün
Hi Ivan, A more common approach is to supply search terms as query parameters (URL?query=...); in that case, your path won’t have new segments. If you prefer paths, you can use a regular expression in your RESTXQ path pattern [1]: "search/{$query=.+}" In both cases, encodeURIComponent should b

Re: [basex-talk] Help with a Query/Performance

2020-01-20 Thread Zimmel, Daniel
Hi Tom, I think that trying to copy/modify a huge tree is definitely the bottleneck here. Why don’t you copy only your third Message element and then reconstruct the wrapping Container with ContainerMetaData? Since the wanted result is a transformation, perhaps a typeswitch expression might be

[basex-talk] How to escape/encode a search term using BaseX REST XQ

2020-01-20 Thread Ivan Kanakarakis
Hello everyone, I am using BaseX 8.44 and the REST XQ interface (ie, http://docs.basex.org/wiki/RESTXQ). I have an endpoint that, when invoked with GET, it does a full text search (using "$db-nodes[text() contains text { $term } all]"), gets the results, constructs a JSON response and sends it bac

[basex-talk] Help with a Query/Performance

2020-01-20 Thread Tom Rauchenwald (UNIFITS)
Hi list, I'm struggling with a query. We have XML documents with a structure similar to this: FOO FOO FOO FOO FOO FOO FOO FOO FOO FOO FOO FOO FOO FOO