MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / resolve_node_ids

Function resolve_node_ids

atomic-repository/src/query_plan.rs:381–390  ·  view source on GitHub ↗

Resolve a node_id that may be a `$variable` reference. If it starts with `$`, look up the binding and extract node IDs. Otherwise return it as-is.

(id: &str, bindings: &HashMap<String, Vec<KgNode>>)

Source from the content-addressed store, hash-verified

379/// If it starts with `$`, look up the binding and extract node IDs.
380/// Otherwise return it as-is.
381fn resolve_node_ids(id: &str, bindings: &HashMap<String, Vec<KgNode>>) -> Vec<String> {
382 if let Some(var_name) = id.strip_prefix('$') {
383 bindings
384 .get(var_name)
385 .map(|nodes| nodes.iter().map(|n| n.id.clone()).collect())
386 .unwrap_or_default()
387 } else {
388 vec![id.to_string()]
389 }
390}
391
392/// Resolve a source path that may be a `$variable` reference.
393///

Callers 4

execute_planFunction · 0.85

Calls 3

getMethod · 0.65
iterMethod · 0.45
cloneMethod · 0.45