Expand a quantified path element (handles {n,m}, ?, etc.)
(
&self,
current_path: &[String],
element: &PathElement,
path_type: &PathType,
graph: &Arc<GraphCache>,
visited_nodes: &mut std::collections::HashSet<St
| 6433 | |
| 6434 | /// Expand a quantified path element (handles {n,m}, ?, etc.) |
| 6435 | fn expand_quantified_element( |
| 6436 | &self, |
| 6437 | current_path: &[String], |
| 6438 | element: &PathElement, |
| 6439 | path_type: &PathType, |
| 6440 | graph: &Arc<GraphCache>, |
| 6441 | visited_nodes: &mut std::collections::HashSet<String>, |
| 6442 | visited_edges: &mut std::collections::HashSet<String>, |
| 6443 | ) -> Result<Vec<Vec<String>>, ExecutionError> { |
| 6444 | match &element.quantifier { |
| 6445 | None => { |
| 6446 | // No quantifier, process normally (exactly once) |
| 6447 | self.expand_single_element( |
| 6448 | current_path, |
| 6449 | element, |
| 6450 | path_type, |
| 6451 | graph, |
| 6452 | visited_nodes, |
| 6453 | visited_edges, |
| 6454 | 1, |
| 6455 | 1, |
| 6456 | ) |
| 6457 | } |
| 6458 | Some(PathQuantifier::Optional) => { |
| 6459 | // Optional: 0 or 1 occurrence |
| 6460 | let mut result = Vec::new(); |
| 6461 | |
| 6462 | // Add path with 0 occurrences (skip this element) |
| 6463 | result.push(current_path.to_vec()); |
| 6464 | |
| 6465 | // Add paths with 1 occurrence |
| 6466 | let expanded = self.expand_single_element( |
| 6467 | current_path, |
| 6468 | element, |
| 6469 | path_type, |
| 6470 | graph, |
| 6471 | visited_nodes, |
| 6472 | visited_edges, |
| 6473 | 1, |
| 6474 | 1, |
| 6475 | )?; |
| 6476 | result.extend(expanded); |
| 6477 | |
| 6478 | Ok(result) |
| 6479 | } |
| 6480 | Some(PathQuantifier::Exact(n)) => { |
| 6481 | // Exactly n occurrences |
| 6482 | self.expand_single_element( |
| 6483 | current_path, |
| 6484 | element, |
| 6485 | path_type, |
| 6486 | graph, |
| 6487 | visited_nodes, |
| 6488 | visited_edges, |
| 6489 | *n, |
| 6490 | *n, |
| 6491 | ) |
| 6492 | } |
no test coverage detected