Hi
I'm wondering if this is at all possible... I defined an array variable in my XQUERY:
declare variable $ca as array(xs:integer) external := [];
How can I assign a value (e.g [1,2]) to this variable through the URL? I have already tried: http://host:port/rest/dbname?run=query.xq&$ca%5B%5D=1&$ca%5B%5D=2 That didn't work. Neither did this: http://host:port/rest/dbname?run=query.xq&$ca=1,2
Any hints are much appreciated. Thanks Csaba
On 03/11/2023 08:30, Csaba Fekete wrote:
I defined an array variable in my XQUERY:
declare variable $caas array(xs:integer)external := [];
How can I assign a value (e.g [1,2]) to this variable through the URL? I have already tried: http://host:port/rest/dbname?run=query.xq&$ca%5B%5D=1&$ca%5B%5D=2 That didn't work. Neither did this: http://host:port/rest/dbname?run=query.xq&$ca=1,2
Perhaps
$ca=[1,2]
? Not sure whether square brackets in a URL query part need some escaping, however.
Hi Csaba,
The variable types of the REST API are limited to atomic values. With BaseX 11, however, it will be possible to bind multiple values [1]:
http://localhost:8080/rest?run=query&n=3&n=4&n=5
(: XQuery file: query.xq :) declare variable $n as xs:integer* external; array { $n }
You can try the latest stable snapshot [2].
Best, Christian
[1] https://docs.basex.org/wiki/REST#GET_Method_2 [2] https://files.basex.org/releases/latest/
On Fri, Nov 3, 2023 at 8:30 AM Csaba Fekete feketecsaba@gmail.com wrote:
Hi
I'm wondering if this is at all possible... I defined an array variable in my XQUERY:
declare variable $ca as array(xs:integer) external := [];
How can I assign a value (e.g [1,2]) to this variable through the URL? I have already tried: http://host:port/rest/dbname?run=query.xq&$ca%5B%5D=1&$ca%5B%5D=2 That didn't work. Neither did this: http://host:port/rest/dbname?run=query.xq&$ca=1,2
Any hints are much appreciated. Thanks Csaba
Hi Christian Thanks for your reply. In the meantime I've found a workaround:
http://localhost:8080/rest?run=query&n=3,4,5
declare variable $n as xs:string external := ""; declare variable $n_arr as xs:integer* := tokenize($n, ",") ! xs:integer(.);
Regards Csaba
On Fri, 3 Nov 2023 at 16:02, Christian Grün christian.gruen@gmail.com wrote:
Hi Csaba,
The variable types of the REST API are limited to atomic values. With BaseX 11, however, it will be possible to bind multiple values [1]:
http://localhost:8080/rest?run=query&n=3&n=4&n=5
(: XQuery file: query.xq :) declare variable $n as xs:integer* external; array { $n }
You can try the latest stable snapshot [2].
Best, Christian
[1] https://docs.basex.org/wiki/REST#GET_Method_2 [2] https://files.basex.org/releases/latest/
On Fri, Nov 3, 2023 at 8:30 AM Csaba Fekete feketecsaba@gmail.com wrote:
Hi
I'm wondering if this is at all possible... I defined an array variable in my XQUERY:
declare variable $ca as array(xs:integer) external := [];
How can I assign a value (e.g [1,2]) to this variable through the URL? I have already tried: http://host:port/rest/dbname?run=query.xq&$ca%5B%5D=1&$ca%5B%5D=2 That didn't work. Neither did this: http://host:port/rest/dbname?run=query.xq&$ca=1,2
Any hints are much appreciated. Thanks Csaba
basex-talk@mailman.uni-konstanz.de