xyzDB

Statement reference

Every xyTalk statement the parser accepts, grouped by purpose. Syntax is exact; one line of meaning each.

Declaration

LOBE "name" [HINT="…"]

Pre-declare a lobe (idempotent; auto-created on first PUT).

ANCHOR "field" UNIQUE IN "lobe"

Uniqueness constraint + O(1) dictionary lookup.

AUTOANCHOR APPLY "field" IN "lobe"

Retroactively index existing records into the anchor (idempotent).

GRAVITY BY field | lower(field) | (a, b) IN "lobe"

Declare the lobe's gravity: raw, normalized or composite.

VECTOR field IN "lobe"

Declare the searchable f32 vector field.

PUT {…} IN "lobe" [LINK TO … AS "rel"] [ON CONFLICT UPDATE]

Write one record; optional link and upsert.

PUT BATCH IN "lobe" [ {…}, … ]

Write up to 10,000 records atomically.

LINK "src" [WHERE …] TO "tgt" [WHERE …] AS "rel"

Relate records via a _link_<rel> field for PULL.

CREATE GHOST "name" FROM "lobe" WHERE … [| GROUP BY …] [| AGGREGATE …] | TAKE BY target [DESC|ASC] [| EMBED …]

Permanent self-maintaining view; order step mandatory (clause form ORDER BY … is a live alias).

REFRESH GHOST "name"

Drop and rebuild a ghost.

DROP GHOST "name"

Delete a ghost permanently.

Query

FIND "lobe" [WHERE …] [LIMIT n] [CURSOR "…"] | FIND LID("…")

Lookup via anchor → gravity → scan, or a direct LID. AND-only — OR/NOT teaches SCAN.

FETCH "lobe1", "lobe2", … WHERE … [AS {name1, name2, …}]

Read several co-located lobes in one call, one named section per lobe.

SCAN "lobe" [WHERE …] [ORDER BY f ASC|DESC] [LIMIT n] [CURSOR "…"]

Filtered lobe walk, full boolean WHERE; ORDER BY requires LIMIT.

SCAN GHOST "name" [WHERE …] [LIMIT n]

Scan a ghost directly, bypassing the router.

… | PULL [depth=N] [only=Type]

Traverse the co-located subtree and links.

… | SET field = value [, …]

Partial update (updated_at refreshed; gravity not recalculated).

… | DELETE [CASCADE]

Remove the matched records (upstream selection).

DELETE "lobe" WHERE …

Standalone form — WHERE required, or use PURGE to empty the whole lobe.

PURGE "lobe"

Empty a lobe on purpose — the explicit alternative to a WHERE-less DELETE.

… | GROUP BY f [, …] | AGGREGATE count(), sum(f), avg(f), min(f), max(f)

Group then roll up; precomputed ghosts answer with zero scan.

… | TAKE n BY metric [DESC|ASC] | n

Top-N over a grouped aggregate, or truncate any stream (alias TOP).

… | SHAPE {field1, field2, …}

Project each record down to the named fields.

… | NEAREST k BY field TO query [USING metric]

Exact top-k over the gravity bucket (function-call alias, §NEAREST).

… | FOLLOW field TO "lobe" ON target_field

Resolve a reference into another lobe.

Cache & projection

INCACHE "lobe" [WHERE …]

Load matching records into the record cache (needs --record-cache-size).

OUTCACHE "lobe"

Evict a lobe from the record cache.

PIN field1, field2 IN "lobe"

Always include these fields in ghost projections (persisted).

UNPIN field1 IN "lobe"

Remove a pin.

Introspection & maintenance

SHOW LOBES | ANCHORS IN "lobe" | GHOSTS | CACHE | SCAN STATS | PROFILE "lobe" | THROTTLE

Introspect the instance.

ANALYZE "lobe"

Sample field cardinality; suggest anchors/gravity/ghosts. Prefer the CLI.

COMPACT

Major-compact every keyspace. Prefer the CLI.

SCRUB

Verify on-disk checksums and MANIFEST (read-only).

MIGRATE ["lobe"]

Rewrite records to the latest on-disk format. Prefer the CLI.

BULKMODE ON | OFF

Toggle bulk-load mode (relaxed durability). Prefer the CLI.