When crafting an input to
query we have a few options as to how the values get bound: namely a “binding” (scalar/vector/tuple/relation), a “source” variable, a rules variable or a pattern name binding.
We are successfully passing non-
Database values to “source” inputs (i.e. input variables starting with
$). I see this hinted at in the documentation (emphasis mine):
Often you will have only a single, or primary, data source (usually a database). In this case you can call that data source
$, and elide it in the data clauses
Specifically, passing an
[[e a v]] relation (i.e. a List of Lists) seems to work quite well as a source. This is useful for a couple use cases such as making arbitrary non-persisted reference data available to queries, and for unit testing queries.
[[e a v t]] also works and I assume
[[e a v t added?]] might work, although I’m not sure how the
basis-t would be determined for such a source.
Are there any documented details on how non-Database sources are handled, what is “supported”? I haven’t tried, but I also imagine implementing parts of the
Database API could work (e.g. to give query some leverage over indexes) but generally creating such things using memory databases and/or
with seem like a better route in that case.