Skip to main content

Module schema

Module schema 

Source
Expand description

Optional, schema-first type layer for the graph (HelixDB-inspired, ADR-252 P1/P2).

RuVector’s graph is schemaless by default and its Cypher engine is interpreted at runtime. This module adds an opt-in schema that catches type errors before execution — declared node labels, typed edges with from/to label constraints, indexed properties, and vector types bound to a node label + property (so a vector hit can be traversed back into the graph as a first-class, validated relationship rather than a runtime string + property name).

The module is pure-Rust with no storage/HNSW dependency, so it compiles for WASM. It coexists with schemaless mode: only declared labels/edges are checked, and undeclared ones pass through untouched.

Structs§

EdgeSchema
Schema for an edge type (E:: in HelixQL) with from/to label constraints.
GraphSchema
A complete, optional graph schema.
NodeSchema
Schema for a node label (N:: in HelixQL).
PropertySchema
Declaration for a single property.
VectorSchema
Schema for a vector type (V:: in HelixQL), bound to a node label + property.

Enums§

DistanceMetric
Distance metric for a vector type. Search always ranks by a higher-is-better score, so Euclidean is surfaced as the negated distance.
PropertyType
Declared type of a node/edge property.

Functions§

extract_vector
Coerce a property value into a dense Vec<f32> if it is vector-shaped.
reciprocal_rank_fusion
Reciprocal Rank Fusion over several ranked id lists (ADR-252 P4 core).
score_property
Score a vector-shaped property against a query without allocating in the common FloatArray case (zero-copy slice scoring). Returns None if the property is not vector-shaped or its dimension does not match the query.