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>>)
| 462 | /// If it starts with `$`, look up the binding and extract node IDs. |
| 463 | /// Otherwise return it as-is. |
| 464 | fn 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 | /// |