law_query
A deterministic LawQL query over the CLIR of a formalization: a question about the model of the act itself, not about a case. Relations (14): anchors, edges, fields, imports, interpretations, labels, links, literals, nodes, norms, positions, rules, variables, windows. Full field lists: law query --schema. Functions (9): anchor/1, labels/1..2, short/1, contains/2, overlaps/2, starts_with/2, ends_with/2, position/2, derivation/2. exists/not exists over a bound variable; equality and membership only, no arithmetic and no ordering comparisons. Scope: corpus by package.name (for example kz.corpus.labour_code, not a file name) or a glob; without corpus, the whole profile slice; a scope outside the profile is empty (CORPUS_EMPTY). Examples: from r in rules where r.head_predicate == "urn:…#eligible" select r.id as producer, r.strength as strength, anchor(r.id) as anchors — who produces; from l in literals where l.predicate == "urn:…#eligible" select l.node as reader, l.context as context — who reads; query eligible over "pkg" { for x: Person; where applicant(x); select eligible(x); } — inference by the core. This is orchestration over the CLIR and the core; no new legal semantics is implemented here. Instead of text, a question from the catalog with arguments: anchors-of, imports-of, links-of, producers, readers, type-step (see law query --list for the set) (predicate/node/type parameters are URNs, pkg is a package.name or a glob). A structural answer is a queryPage: resultHash of the full queryResult, snapshot (hash of the scope package list), rowCount, rows by rowLimit (20, at most 5000) and rowOffset, next with the snapshot for continuation; full: true returns the full queryResult when the scope is one package. Every row carries provenance (CLIR nodes); an empty answer carries the explain funnel (emptyAt names the clause); errors carry LDC-Qxxxx codes with hints; a source product too wide is refused before execution (QUERY_TOO_BROAD), a continuation on another snapshot as SNAPSHOT_CHANGED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| case | No | the case for query-over; it replaces the case clause | |
| full | No | return the full queryResult instead of a page; only when the scope is one package | |
| limit | No | an explicit cap on eval() materialisations (it does NOT bound the rows — see rowLimit) | |
| query | No | inline LawQL | |
| corpus | No | the snapshot scope: a package.name (for example kz.corpus.labour_code) or a glob over package.name; without corpus, the whole profile slice | |
| engine | No | there is one engine — the core; the reference implementation is called by its own command | lawc |
| question | No | the name of a question from the named-query catalog (producers, readers, anchors-of, imports-of, links-of, type-step) or of a lint; instead of query | |
| rowLimit | No | how many rows in structuredContent (20; the budget may lower it) | |
| snapshot | No | the snapshot hash from next.snapshot of the previous page: a continuation on another snapshot is refused (SNAPSHOT_CHANGED) | |
| arguments | No | the question parameters: an object of name → string (predicate, node, type — URNs; pkg — a package.name or a glob) | |
| rowOffset | No | from which row (0); continuation comes from next together with snapshot; structural queries only |