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: nodes(id,kind,package,package_name,path), edges(from,to,role), anchors(node,anchor,act,locator,path), labels(node,lang,text,status), fields(node,field,value,value_kind), rules(id,strength,head_predicate,head_polarity,head_variables,body_variables,body_predicates), norms(id,modality,goal_kind,condition_predicates), positions(norm,kind,bearer_type), windows(norm,kind,deadline), imports(package,imported,semantic_hash), links(from,to,kind: imports|alias|subtype|produces|reads|anchored), literals(node,context,predicate,polarity), variables(node,context,name,type), interpretations(id,predicate,role). Functions: anchor, labels, short, contains, overlaps, starts_with, ends_with, position, derivation; 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: producers, readers, anchors-of, imports-of, links-of, type-step (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 corpus/ql/questions 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 |