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

Method node_matches_properties

graphlite/src/exec/executor.rs:6144–6179  ·  view source on GitHub ↗

Execute full-text search operation

(
        &self,
        node: &crate::storage::Node,
        property_filters: &HashMap<String, Expression>,
    )

Source from the content-addressed store, hash-verified

6142
6143 /// Execute full-text search operation
6144 fn node_matches_properties(
6145 &self,
6146 node: &crate::storage::Node,
6147 property_filters: &HashMap<String, Expression>,
6148 ) -> Result<bool, ExecutionError> {
6149 for (prop_name, expected_expr) in property_filters {
6150 // Evaluate the expected value expression
6151 let expected_value = match expected_expr {
6152 Expression::Literal(literal) => self.literal_to_value(literal),
6153 Expression::Variable(var) => {
6154 // For variables, we'd need to look them up in context
6155 // For now, treat as string literal of the variable name
6156 Value::String(var.name.clone())
6157 }
6158 _ => {
6159 // For complex expressions, skip this property check for now
6160 continue;
6161 }
6162 };
6163
6164 // Check if the node has this property with the expected value
6165 match node.properties.get(prop_name) {
6166 Some(actual_value) => {
6167 if actual_value != &expected_value {
6168 return Ok(false);
6169 }
6170 }
6171 None => {
6172 // Node doesn't have this property
6173 return Ok(false);
6174 }
6175 }
6176 }
6177
6178 Ok(true) // All properties match
6179 }
6180
6181 /// Execute a hash-based expand operation with specific graph
6182 fn execute_hash_expand_with_graph(

Callers 1

Calls 3

cloneMethod · 0.80
literal_to_valueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected