Expand description
AST validation per ADR-008 §Validation Rules.
validate normalises an AST in place and rejects queries that violate the
closed taxonomies or attempt to subvert namespace scoping:
- Edge relations must parse to one of the 13 canonical
EdgeRelationvariants (ADR-002). Aliases and case differences are normalised to the canonical snake_case form stored in the database. Applies to edge patterns andWHERE e.relation = '…'constraints. - Node kinds must parse to one of the 6
EntityKindvariants (ADR-001). Common aliases (paper→document,benchmark→dataset) are normalised. Applies to node labels andWHERE a.kind = '…'constraints. - Namespace scoping is a trusted parameter only. Queries must not name
namespacein node property maps orWHEREconditions — the only valid source of namespace filtering isCompileOptions::scopes. This matches ADR-008 §Validation: “never trust query strings to set namespaces.” - Traversal depth is capped at
MAX_DEPTH(10 hops). Requests above the cap are clamped, not rejected — this matches the cap the compiler applies when generating recursive CTEs.
Constants§
- MAX_
DEPTH - Maximum traversal depth allowed by the query layer (ADR-008 §Validation).
Functions§
- validate
- Validate and normalise an AST in place.