MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / validate_basic_query_variables

Function validate_basic_query_variables

graphlite/src/ast/validator.rs:898–936  ·  view source on GitHub ↗
(
    query: &BasicQuery,
    ctx: &mut ValidationContext,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

896}
897
898fn validate_basic_query_variables(
899 query: &BasicQuery,
900 ctx: &mut ValidationContext,
901 errors: &mut Vec<ValidationError>,
902) {
903 // Collect all variables declared in MATCH clause
904 for pattern in &query.match_clause.patterns {
905 for element in &pattern.elements {
906 match element {
907 PatternElement::Node(node) => {
908 if let Some(ref identifier) = node.identifier {
909 ctx.declared_variables.insert(identifier.clone());
910 ctx.variable_types
911 .insert(identifier.clone(), GqlType::Reference { target_type: None });
912 // Node as reference type
913 }
914 }
915 PatternElement::Edge(edge) => {
916 if let Some(ref identifier) = edge.identifier {
917 ctx.declared_variables.insert(identifier.clone());
918 ctx.variable_types
919 .insert(identifier.clone(), GqlType::Reference { target_type: None });
920 // Edge as reference type
921 }
922 }
923 }
924 }
925 }
926
927 // Validate variables used in WHERE clause
928 if let Some(ref where_clause) = query.where_clause {
929 validate_expression_variables(&where_clause.condition, ctx, errors);
930 }
931
932 // Validate variables used in RETURN clause
933 for item in &query.return_clause.items {
934 validate_expression_variables(&item.expression, ctx, errors);
935 }
936}
937
938/// Validate path patterns (alternating nodes and edges)
939fn validate_path_patterns(

Callers 2

validate_procedure_queryFunction · 0.85

Calls 3

cloneMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected