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

Function resolve_node_ids

atomic-repository/src/query_plan.rs:464–473  ·  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

462/// If it starts with `$`, look up the binding and extract node IDs.
463/// Otherwise return it as-is.
464fn resolve_node_ids(id: &str, bindings: &HashMap<String, Vec<KgNode>>) -> Vec<String> {
465 if let Some(var_name) = id.strip_prefix('$') {
466 bindings
467 .get(var_name)
468 .map(|nodes| nodes.iter().map(|n| n.id.clone()).collect())
469 .unwrap_or_default()
470 } else {
471 vec![id.to_string()]
472 }
473}
474
475/// Resolve a source path that may be a `$variable` reference.
476///

Calls 4

getMethod · 0.65
collectMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45