datumwise

Learn · Reference

The shipped grammar

Read this before writing a Manifold. Every keyword the shipped parser accepts, with its exact signature — generated from columna-core 0.14.0 at build time, and every example on this page is executed against that parser when the site is built. If an example stopped parsing, this page would not exist.

§2b / C-2 insulation

A .cml source document co-locates TWO layers. The LOGICAL declarations are what the Manifold is — what an agent sees over describe and the wire. The MAP clauses are how it binds to physical storage, and they are engine-visible ONLY: describe emits logical names, never a realized_by, a VIA bridge, a FROM table, or an expression. This is enforced, not intended — a standing insulation test asserts that physical identifiers never cross describe or the wire.

map-side clauses: = <column> · FROM · AS · VALUE · VIA · REJECT · ATTR

structure columna_core.parser.__doc__ grammar block (teaching shape)

completeness columna_core.parser._KW (lexing set)

A lexing set is not a grammar taxonomy: _KW says what may BEGIN A LINE and is used here only to assert coverage; the page's SHAPE comes from the docstring.

MANIFOLD

MANIFOLD <name> VERSION <n>

the document header — a name and a version (both required)

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE

UNIVERSE

UNIVERSE <name> = <dim> * <dim> ... [WHERE <predicate>]

a population: the product of its base dimensions

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE

LEVEL

LEVEL <name> = <column> [BASE] [ATTR <name> = <table>.<column> [, ...]]

a coordinate. The `= <column>` is a MAP clause — engine-side, never crosses describe

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE

with an inline ATTR clause — also map-side (note ATTR is a CLAUSE of LEVEL, not a statement)

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE
LEVEL region = region ATTR name = stores.region_name

HIERARCHY

HIERARCHY <lineage> { <a> -> <b> VIA <table>(<a_col>, <b_col>) [-> <c> VIA ...] ; <path> ... }

a functional roll-up lineage; braces required, and each hop carries its own VIA

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE
LEVEL region = region
HIERARCHY location { store -> region VIA stores(store_id, region) }

RELATE

RELATE <a> <-> <b> VIA <table> [NOTE "<text>"]

MEASURE

MEASURE <name> ON <universe> FROM <table> AS <agg>(<expr>)
MEASURE <name> ON <universe> FROM <table> VALUE <expr>

inline clauses

[M_ANCHOR { <col>, ... }]
[FAMILY { <agg> [: <tier>] [BLOCKED { <lineage>, ... }] ... }]

a quantity, aggregated. `FROM <table> AS <agg>(<expr>)` is a MAP clause

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE
MEASURE revenue ON sales FROM tx AS sum(amount)

DERIVED

DERIVED <name> = <expr>

a quantity defined from other measures — no map clause; it is pure logic

MANIFOLD demo VERSION 1
UNIVERSE sales = store * day
LEVEL store = store_id BASE
LEVEL day = day BASE
MEASURE revenue ON sales FROM tx AS sum(amount)
MEASURE orders ON sales FROM tx AS distinct(order_id)
DERIVED aov = revenue / orders

Clauses any declaration may carry

Any declaration may carry (case-demo b/d):
-- "<text>"                     a DESCRIPTION (folklore) — LOGICAL, flows to describe + the wire
REJECT <table>.<col> "<reason>" an attested rejected/aside physical incarnation — PHYSICAL,map-side
map-artifact-ONLY, NEVER crosses describe or the wire (§2b)

Coverage

Every token the parser will accept at the start of a line appears above, as a statement or as an inline clause: MANIFOLD · UNIVERSE · LEVEL · RELATE · MEASURE · DERIVED · HIERARCHY · ATTR. The build asserts this — a keyword added to the package cannot go silently undocumented here.