Core Mechanisms

PathMap (Triemap Storage)

MORK's foundational data structure is a prefix-compressed triemap (radix tree) that stores S-expressions as paths. Where a traditional graph database scatters nodes and links across memory, MORK organizes them into a structured hierarchy where shared prefixes are stored once. This provides:

  • Content addressing: Each atom is identified by its path in the trie (hash-consing), yielding structural sharing and \(O(1)\) pointer equality
  • Near-constant-time neighbor lookups: PathMap supplies a path algebra (prefix scans, union/intersection of posting lists, anti-join) that directly supports join planning and streaming candidate generation
  • Automatic deduplication: Identical subexpressions share storage automatically
  • Slot-centric views: For \(k\)-ary relations, MORK maintains at most \(k\) slot-anchored prefix views rather than \(k!\) permutations

Zipper Abstract Machine (ZAM)

The execution model that exploits PathMap: given a query with one or more legs (rows of guarded reads), ZAM chooses selective path prefixes, fetches posting lists from the trie, computes intersections incrementally, and streams only the compatible frontier to the unifier. This pushes most pruning before unification. ZAM uses zippers (cursor-based navigation) for efficient, parallel logical inference with near-linear performance scaling across cores.

MM2 (Minimal MeTTa 2)

A low-level dataflow language for defining performance-critical components directly on MORK's data structures. MM2 uses a "Gather-Process-Scatter" paradigm with priority-based execution, sources (inputs), and sinks (outputs). The language is formally decomposed into four semantic segments: a monotonic base (metagraph rewrites where automatic pattern reordering is safe — enabling 1000× speedups without changing semantics), sinks (non-monotonic output operations), sources (input/data loading), and syncs (conjunctions of sources and sinks). Operations include fork/join patterns, set operations, and macro-based partial evaluation. MM2 is where PLN factor-graph message passing, ECAN attention sweeps, pattern mining iterations, and tensor operations run at database-engine speeds.

MORKL

A declarative query language providing "bare metal" access to MORK's trie structures for structural manipulation using S-expression syntax. Think of it as SQL for MORK — whereas MM2 is for dynamic algorithms at scale.