Hi Tim,
> Using the store module, is it possible to read and merge multiple custom stores into main memory
We could add an argument (or options) to file:read to allow entries to
be added to an existing main-memory store.
> set a particular store as context for a query?
The recommended approach is to invoke store:read before any other
operation in the query. Please note, however, that the store will be
globally available. If a second query runs on the same server and
opens another store, it will change the behavior of the first query.
For such use cases, it’s better to use databases.
> Or, do I need to serialize the stores, e.g., as JSON and then create databases for them?
You could have a look at the new db:get-value and db:put-value
functions [1]: These functions have particularly been designed to
organize XQuery items in databases, making casts to JSON or XML
obsolete.
Hope this helps,
Christian
[1] https://docs.basex.org/wiki/Database_Module#db:get-value