If I remember correctly, it should be possible with the Python binding [1] to pass on JSON data and specify 'json' as input type:
query.bind("$input", '{ 1: "abc" }', 'json') Hope this helps, Christian [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/python/QueryBindExample.py On Wed, Sep 22, 2021 at 8:32 PM Graydon Saunders <graydon...@gmail.com> wrote: > > Hi Christian -- > > Thank you! > > I have been finding that passing in a single XML config file and using > xquery:eval() on the XPath-syntax maps therein has been working. > > (Locally, we use Python for scripting, so I am going to save the pattern but > keep the config files for now. :) > > Much appreciated! > > -- Graydon > > On Wed, Sep 22, 2021 at 4:52 AM Christian Grün <christian.gr...@gmail.com> > wrote: >> >> Hi Graydon, >> >> I guess this question didn’t get any response so far: >> >> > How does one go about binding a literal map to an external variable? (I >> > am going to want to do this in a script later; the GUI version is strictly >> > for testing.) >> >> External variable bindings via the GUI are limited to atomic items. If >> you use Java for scripting, you could proceed as follows: >> >> import org.basex.core.*; >> import org.basex.query.*; >> import org.basex.query.value.*; >> >> public class BindMap { >> public static void main(String... whatever) throws Exception { >> Context ctx = new Context(); >> String input = "map { 'structure': '/some/path/name' }"; >> Value map = new QueryProcessor(input, ctx).value(); >> >> String query = "declare variable $map external; $map"; >> QueryProcessor qp = new QueryProcessor(query, ctx); >> System.out.println(qp.bind("map", map).value()); >> } >> } >> >> Hope this helps, >> Christian