aql_write
Write a 2D region of values into an Azquo database using the same AQL grammar as query_aql.
Mirrors the read shape — rowHeadings × columnHeadings × context — and adds a 2D values array.
The cell at values[r][c] is anchored to the union of rowHeadings[r] + columnHeadings[c] + context, exactly as a read at the same coordinates would resolve.
Two modes, distinguished by options.createNames:
Case 1 — TRANSACTIONAL find-or-create. Caller supplies options.rowSet + options.rowLanguage (and/or columnSet + columnLanguage) + createNames: true. Unresolved row/column headings are FIND-OR-CREATED under the target set with the language attribute set. Arrow form: rowSet = "A->B" puts new names into B as a child of A (chain is auto-created if missing). Use for: importing new transactions, customers, or any entity whose ID column is the row heading.
Case 2 — MULTI-FACETED all-or-nothing (default; createNames: false). Every heading must resolve to an existing name. Any miss is fatal — no values land. Use for: writing into a pre-structured region where the names are already known.
Structure-only mode: omit values (or pass []). The call resolves the headings, find-or-creates names if createNames=true, but writes no values. Equivalent to declaring hierarchy.
For date columns where the duplicate-name trap applies, use options.rowLanguage = "date" (bare attribute name, no "language" prefix). rowLanguage / columnLanguage always take the literal attribute name verbatim.
createNames and ignoreHeadingErrors are mutually exclusive — supply at most one.
═══ PROVENANCE — required on every write ═══ source: origin reference (file/URL/document). Lands on Provenance.name in the audit trail. agent: your AI agent name (e.g. "Claude"). Lands on Provenance.method.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent | Yes | AI agent name (e.g. "Claude"). REQUIRED. | |
| source | Yes | Origin reference — file, URL, document, or short note. REQUIRED. | |
| values | No | 2D array of cell values (string | number | boolean | null). Omit or [] for structure-only mode. | |
| context | Yes | Context expressions as a 2D array — use [[]] if no context needed | |
| options | No | Engine options — see query_aql for the full shape. Adds rowSet/columnSet/createNames for AQL-write. | |
| database | Yes | Database name to write into | |
| rowHeadings | Yes | Row heading expressions as a 2D array of strings | |
| columnHeadings | Yes | Column heading expressions as a 2D array of strings |