Skip to content

SchemaService

Schema management operations.

Proto source

graph/schema.proto

Transport

All methods are available via:

  • gRPC on port 7080 — native high-performance API
  • REST/JSON on port 7081 — HTTP/JSON transcoding via embedded structured-proxy

Methods

CreateLabel

Create a new node label with property definitions.

HTTP: POST /v1/graph/schema/labels

Request: CreateLabelRequest

FieldTypeDescription
namestringLabel name (e.g., "User", "Movie", "Memory").
propertiesPropertyDefinition[]Regular property declarations. Defines types, constraints (unique, required).
computed_propertiesComputedPropertyDefinition[]COMPUTED property specifications. The TtlReaper background worker picks up TTL specs automatically; DECAY and VECTOR_DECAY are evaluated at query time. These are stored in the label schema and apply to all nodes of this label.
schema_modeSchemaModeSchema mode controlling validation and interning. Defaults to STRICT when unspecified. Use FLEXIBLE to replicate schema-free behaviour on a declared label; use VALIDATED to accept extra properties in an overflow map.

Response: Label

FieldTypeDescription
namestring
propertiesPropertyDefinition[]Regular (non-computed) property definitions.
schema_revisionuint64Schema revision (DDL snapshot identity). Advances on ALTER operations that change write-path semantics (placement, shard_keys, mode). Distinct from data-side versioning (MVCC commit_ts, future per-row OCC _v) — "revision" is reserved for DDL identity per ADR-023.
computed_propertiesComputedPropertyDefinition[]COMPUTED property specifications declared for this label.
schema_modeSchemaModeValidation and interning mode for this label. STRICT by default.

CreateEdgeType

Create a new edge type with property definitions.

HTTP: POST /v1/graph/schema/edge-types

Request: CreateEdgeTypeRequest

FieldTypeDescription
namestring
propertiesPropertyDefinition[]

Response: EdgeType

FieldTypeDescription
namestring
propertiesPropertyDefinition[]
schema_revisionuint64Schema revision (DDL snapshot identity). See Label.schema_revision.

ListLabels

List all labels in the schema.

HTTP: GET /v1/graph/schema/labels

Request: ListLabelsRequest

Empty request (no fields).

Response: ListLabelsResponse

FieldTypeDescription
labelsLabel[]

ListEdgeTypes

List all edge types in the schema.

HTTP: GET /v1/graph/schema/edge-types

Request: ListEdgeTypesRequest

Empty request (no fields).

Response: ListEdgeTypesResponse

FieldTypeDescription
edge_typesEdgeType[]

Types

ComputedPropertyDefinition

A COMPUTED property specification within a CreateLabelRequest. COMPUTED properties are evaluated at query time from node data — no value is stored per node. The spec is stored once in the label schema and applied to all nodes of that label during MATCH/RETURN execution. Three types: TTL — background auto-delete after duration_secs DECAY — float value interpolated between initial and target over time VECTOR_DECAY — query-time multiplier on vector similarity scores

FieldTypeDescription
namestringProperty name. Must not collide with regular PropertyDefinition names in the same label. Convention: prefix TTL properties with underscore (e.g., "_ttl", "_expires").
computed_typeComputedTypeKind of computed property. Required.
formula_typeDecayFormulaTypeDecay formula variant. Required for DECAY and VECTOR_DECAY types. Ignored for TTL type.
lambdadoubleFor EXPONENTIAL formula: pre-computed λ = ln(2) / half_life_fraction. Example: half-life at 50% of duration → lambda = ln(2) / 0.5 ≈ 1.386.
taudoubleFor POWER_LAW formula: time scale as fraction of duration (τ > 0). Controls how fast the initial decay is. Smaller τ → faster initial drop.
alphadoubleFor POWER_LAW formula: decay exponent (α > 0). Larger α → faster decay overall.
initialdoubleStarting value at elapsed = 0 (for DECAY type only). Default: 1.0 (full strength at creation).
targetdoubleTarget value at elapsed ≥ duration_secs (for DECAY type only). Default: 0.0 (fully decayed at end of duration).
duration_secsuint64Duration in seconds: decay occurs over [0, duration_secs]; TTL expires after this. Required for all computed types.
anchor_fieldstringName of the TIMESTAMP property to measure elapsed time from. Must be declared as a regular TIMESTAMP property in the same CreateLabelRequest. Example: "created_at", "indexed_at", "expires_at".
scopeTtlScopeTypeWhat to delete when a TTL expires (for TTL type only). Default (UNSPECIFIED): treated as TTL_SCOPE_TYPE_NODE — delete the whole node.
target_fieldstringFor TTL_SCOPE_TYPE_SUBTREE: the DOCUMENT property to delete on expiry. The anchor_field timestamp is preserved; only this DOCUMENT property is removed. Leave empty if scope is FIELD or NODE (ignored in those cases).

CreateEdgeTypeRequest

FieldTypeDescription
namestring
propertiesPropertyDefinition[]

CreateLabelRequest

FieldTypeDescription
namestringLabel name (e.g., "User", "Movie", "Memory").
propertiesPropertyDefinition[]Regular property declarations. Defines types, constraints (unique, required).
computed_propertiesComputedPropertyDefinition[]COMPUTED property specifications. The TtlReaper background worker picks up TTL specs automatically; DECAY and VECTOR_DECAY are evaluated at query time. These are stored in the label schema and apply to all nodes of this label.
schema_modeSchemaModeSchema mode controlling validation and interning. Defaults to STRICT when unspecified. Use FLEXIBLE to replicate schema-free behaviour on a declared label; use VALIDATED to accept extra properties in an overflow map.

EdgeType

An edge type definition.

FieldTypeDescription
namestring
propertiesPropertyDefinition[]
schema_revisionuint64Schema revision (DDL snapshot identity). See Label.schema_revision.

Label

A node label definition returned by CreateLabel and ListLabels.

FieldTypeDescription
namestring
propertiesPropertyDefinition[]Regular (non-computed) property definitions.
schema_revisionuint64Schema revision (DDL snapshot identity). Advances on ALTER operations that change write-path semantics (placement, shard_keys, mode). Distinct from data-side versioning (MVCC commit_ts, future per-row OCC _v) — "revision" is reserved for DDL identity per ADR-023.
computed_propertiesComputedPropertyDefinition[]COMPUTED property specifications declared for this label.
schema_modeSchemaModeValidation and interning mode for this label. STRICT by default.

ListEdgeTypesRequest

No fields.

ListEdgeTypesResponse

FieldTypeDescription
edge_typesEdgeType[]

ListLabelsRequest

No fields.

ListLabelsResponse

FieldTypeDescription
labelsLabel[]

PropertyDefinition

A property definition within a label or edge type.

FieldTypeDescription
namestringProperty name.
typePropertyTypeDeclared type. COMPUTED properties are represented separately via ComputedPropertyDefinition; use PropertyType for regular properties only.
requiredboolWhether this property is required (NOT NULL). Writes missing this property are rejected in STRICT and VALIDATED schema modes.
uniqueboolWhether a UNIQUE B-tree index is maintained for this property. Duplicate values across nodes of this label are rejected.

Enums

ComputedType

The kind of COMPUTED property.

ValueNumberDescription
COMPUTED_TYPE_UNSPECIFIED0Unspecified — invalid, rejected by server.
COMPUTED_TYPE_TTL1timestamp is older than duration_secs.
COMPUTED_TYPE_DECAY2Evaluated inline at query time: value = initial + (target - initial) × formula(elapsed).
COMPUTED_TYPE_VECTOR_DECAY3vector_similarity() results.

DecayFormulaType

Decay formula variant for DECAY and VECTOR_DECAY computed types. All formulas map normalized time t ∈ [0, 1] to weight ∈ [0, 1].

ValueNumberDescription
DECAY_FORMULA_TYPE_UNSPECIFIED0
DECAY_FORMULA_TYPE_LINEAR1f(t) = max(0, 1 - t). Constant rate, hard cutoff at duration.
DECAY_FORMULA_TYPE_EXPONENTIAL2λ = ln(2) / half_life_fraction; pre-computed by client from desired half-life.
DECAY_FORMULA_TYPE_POWER_LAW3Recent items decay fast; residual value persists longer than exponential.
DECAY_FORMULA_TYPE_STEP4Semantically equivalent to TTL but evaluated at query time (no background delete).

PropertyType

ValueNumberDescription
PROPERTY_TYPE_UNSPECIFIED0
PROPERTY_TYPE_INT641
PROPERTY_TYPE_FLOAT642
PROPERTY_TYPE_STRING3
PROPERTY_TYPE_BOOL4
PROPERTY_TYPE_BYTES5
PROPERTY_TYPE_TIMESTAMP6
PROPERTY_TYPE_VECTOR7
PROPERTY_TYPE_LIST8
PROPERTY_TYPE_MAP9

SchemaMode

Schema validation and flexibility mode for a node label. Controls how the write path handles properties at CREATE and SET time. Applied per label via CreateLabelRequest.schema_mode.

ValueNumberDescription
SCHEMA_MODE_UNSPECIFIED0Unspecified — defaults to STRICT on the server.
SCHEMA_MODE_STRICT1interning is applied (up to 80% key storage reduction).
SCHEMA_MODE_VALIDATED2+10–20% storage overhead for undeclared properties.
SCHEMA_MODE_FLEXIBLE3schema-free default behaviour on labels without a declared schema.

TtlScopeType

What to delete when a TTL COMPUTED property expires.

ValueNumberDescription
TTL_SCOPE_TYPE_UNSPECIFIED0
TTL_SCOPE_TYPE_FIELD1Delete only the anchor_field property from the node. Node remains alive.
TTL_SCOPE_TYPE_SUBTREE2target_field to be set in ComputedPropertyDefinition.
TTL_SCOPE_TYPE_NODE3Delete the entire node and all its outgoing/incoming edges (DETACH DELETE).