Skip to main content

ExpressionContext

Trait ExpressionContext 

Source
pub trait ExpressionContext {
Show 20 methods // Required methods fn get_variable(&self, name: &str) -> Option<Value>; fn set_variable(&mut self, name: String, value: Value); // Provided methods fn get_parameter(&self, _name: &str) -> Option<Value> { ... } fn get_session_variable(&self, name: &str) -> Result<Value, ExpressionError> { ... } fn get_variable_by_slot(&self, _slot: SlotId) -> Option<Value> { ... } fn get_function(&self, name: &str) -> Option<OwnedFunctionRef> { ... } fn get_graph_storage(&self) -> Option<GraphStorageRef> { ... } fn get_sequence_manager(&self) -> Option<Arc<SequenceManager>> { ... } fn supports_cache(&self) -> bool { ... } fn get_cache(&mut self) -> Option<&mut ()> { ... } fn execute_subquery( &mut self, body: &SubqueryBody, ) -> Result<Vec<Value>, ExpressionError> { ... } fn execute_exists( &mut self, body: &SubqueryBody, ) -> Result<bool, ExpressionError> { ... } fn contains_subquery( &mut self, body: &SubqueryBody, value: &Value, ) -> Result<Value, ExpressionError> { ... } fn execute_scalar_subquery( &mut self, body: &SubqueryBody, ) -> Result<Value, ExpressionError> { ... } fn evaluate_label(&self, label: &str) -> Result<Value, ExpressionError> { ... } fn evaluate_list_comprehension( &mut self, variable: &str, source: &Expression, filter: Option<&Expression>, map: Option<&Expression>, ) -> Result<Value, ExpressionError> where Self: Sized { ... } fn evaluate_label_tag_property( &mut self, tag: &Expression, property: &str, ) -> Result<Value, ExpressionError> where Self: Sized { ... } fn evaluate_predicate( &mut self, func: &str, args: &[Expression], ) -> Result<Value, ExpressionError> where Self: Sized { ... } fn evaluate_reduce( &mut self, accumulator: &str, initial: &Expression, variable: &str, source: &Expression, mapping: &Expression, ) -> Result<Value, ExpressionError> where Self: Sized { ... } fn evaluate_path_build( &mut self, items: &[Expression], ) -> Result<Value, ExpressionError> where Self: Sized { ... }
}
Expand description

The “expression evaluation context trait”

Provide a unified context interface for evaluating graph database expressions.

Note: This trait is used for the evaluation of runtime expressions. For compilation-time analysis, please use ExpressionAnalysisContext.

Required Methods§

Source

fn get_variable(&self, name: &str) -> Option<Value>

Obtain the value of the variable

Source

fn set_variable(&mut self, name: String, value: Value)

Setting variable values

Provided Methods§

Source

fn get_parameter(&self, _name: &str) -> Option<Value>

Obtain the value of a query parameter (@name). Default implementation returns None — contexts without parameter support simply ignore parameter references.

Source

fn get_session_variable(&self, name: &str) -> Result<Value, ExpressionError>

Obtain the value of a session variable ($name).

Default implementation reports an error: an undefined session variable is a query error, not NULL. Row contexts backed by a session snapshot override this to return the actual value.

Source

fn get_variable_by_slot(&self, _slot: SlotId) -> Option<Value>

Obtain the value of a variable by slot ID (fast path). Default implementation falls back to name-based lookup.

Source

fn get_function(&self, name: &str) -> Option<OwnedFunctionRef>

Obtain a function reference

Source

fn get_graph_storage(&self) -> Option<GraphStorageRef>

Obtain the graph storage accessor for graph algorithm functions

Source

fn get_sequence_manager(&self) -> Option<Arc<SequenceManager>>

Obtain the sequence catalog manager for curr_val / next_val. Default implementation returns None — contexts without sequence support report the functions’ missing-context error.

Source

fn supports_cache(&self) -> bool

Check whether the context supports caching.

Source

fn get_cache(&mut self) -> Option<&mut ()>

Obtain the cache manager (if available).

The caching function has been removed; the result is “None”.

Source

fn execute_subquery( &mut self, body: &SubqueryBody, ) -> Result<Vec<Value>, ExpressionError>

Execute a subquery body and return the result values.

Used for EXISTS and IN subquery expressions. Returns the list of values from the subquery’s RETURN clause.

Source

fn execute_exists( &mut self, body: &SubqueryBody, ) -> Result<bool, ExpressionError>

EXISTS semantics: whether the subquery produces at least one row.

Default implementation runs Self::execute_subquery and tests for a non-empty result; streaming contexts override it to short-circuit and to cache non-correlated results.

Source

fn contains_subquery( &mut self, body: &SubqueryBody, value: &Value, ) -> Result<Value, ExpressionError>

IN semantics: whether value occurs in the subquery result.

A NULL left operand, or NULL values inside the result set, never match — consistent with the conjunctive keys_match path.

Source

fn execute_scalar_subquery( &mut self, body: &SubqueryBody, ) -> Result<Value, ExpressionError>

Scalar-subquery semantics: the first result value, or NULL when the subquery returns no rows. Streaming contexts override this to dispatch through the hosting operator’s subquery executor.

Source

fn evaluate_label(&self, label: &str) -> Result<Value, ExpressionError>

Evaluate a :Label expression against the current row binding.

The label expression is a bare tag reference with no bound variable, so contexts that cannot resolve it report an error naming the label instead of a generic “require runtime context” message.

Source

fn evaluate_list_comprehension( &mut self, variable: &str, source: &Expression, filter: Option<&Expression>, map: Option<&Expression>, ) -> Result<Value, ExpressionError>
where Self: Sized,

Evaluate a list comprehension [variable IN source WHERE filter | map].

Generic default: iterates the source collection, binds variable in this context, and applies the optional filter and map expressions. Works with any context that supports get_variable/set_variable.

Source

fn evaluate_label_tag_property( &mut self, tag: &Expression, property: &str, ) -> Result<Value, ExpressionError>
where Self: Sized,

Evaluate a dynamic tag-property access tag.property where tag is itself an expression.

Generic default: evaluates the tag expression and performs property access on the resulting vertex value.

Source

fn evaluate_predicate( &mut self, func: &str, args: &[Expression], ) -> Result<Value, ExpressionError>
where Self: Sized,

Evaluate a predicate expression func(variable IN list WHERE predicate) with func in {ALL, ANY, SINGLE, NONE}.

Generic default: iterates the collection, binds variable, and applies the predicate with the standard Cypher quantifier semantics.

Source

fn evaluate_reduce( &mut self, accumulator: &str, initial: &Expression, variable: &str, source: &Expression, mapping: &Expression, ) -> Result<Value, ExpressionError>
where Self: Sized,

Evaluate a REDUCE expression reduce(acc = initial, variable IN source | mapping).

Generic default: seeds accumulator with initial, iterates the source collection binding variable, and accumulates the result of evaluating mapping at each step.

Source

fn evaluate_path_build( &mut self, items: &[Expression], ) -> Result<Value, ExpressionError>
where Self: Sized,

Evaluate a path construction expression path(v1, e1, v2, e2, v3).

Generic default: evaluates each element and assembles a Path from an alternating vertex/edge sequence starting with a vertex.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§