MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / resolve_binding

Function resolve_binding

nodedb/src/engine/graph/pattern/executor/mod.rs:251–283  ·  view source on GitHub ↗
(
    binding: &NodeBinding,
    csr: &CsrIndex,
    row: &BindingRow,
    frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
)

Source from the content-addressed store, hash-verified

249}
250
251fn resolve_binding(
252 binding: &NodeBinding,
253 csr: &CsrIndex,
254 row: &BindingRow,
255 frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
256) -> Vec<u32> {
257 if let Some(ref name) = binding.name
258 && let Some(value) = row.get(name)
259 {
260 if let Some(id) = csr.node_id_raw(value) {
261 // Check label constraint if specified.
262 if let Some(ref label) = binding.label
263 && !csr.node_has_label(id, label)
264 {
265 return Vec::new();
266 }
267 return vec![id];
268 }
269 return Vec::new();
270 }
271 // No binding yet — enumerate all nodes, filtering by label and bitmap.
272 let all = 0..csr.node_count() as u32;
273 all.filter(|&id| {
274 let label_ok = binding
275 .label
276 .as_ref()
277 .is_none_or(|l| csr.node_has_label(id, l));
278 let bitmap_ok = frontier_bitmap
279 .is_none_or(|bm| bm.contains(nodedb_types::Surrogate::new(csr.node_surrogate_raw(id))));
280 label_ok && bitmap_ok
281 })
282 .collect()
283}
284
285fn binding_compatible(
286 binding: &NodeBinding,

Callers 1

execute_tripleFunction · 0.85

Calls 8

node_has_labelMethod · 0.80
collectMethod · 0.80
node_surrogate_rawMethod · 0.80
getMethod · 0.45
node_id_rawMethod · 0.45
node_countMethod · 0.45
as_refMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected