| 316 | } |
| 317 | |
| 318 | fn relationship_pattern(input: &str) -> IResult<&str, Pattern> { |
| 319 | map( |
| 320 | tuple(( |
| 321 | opt(tuple((ws(char('$')), ws(identifier)))), |
| 322 | delimited( |
| 323 | ws(char('(')), |
| 324 | separated_list1(ws(char(',')), role_assignment), |
| 325 | ws(char(')')), |
| 326 | ), |
| 327 | ws(tag("forms")), |
| 328 | ws(identifier), |
| 329 | opt(delimited( |
| 330 | ws(char('(')), |
| 331 | separated_list0(ws(char(',')), attribute_value), |
| 332 | ws(char(')')), |
| 333 | )), |
| 334 | )), |
| 335 | |(variable, roles, _, relationship_type, attributes)| Pattern::RelationshipPattern { |
| 336 | variable: variable.map(|(_, v)| v.to_string()), |
| 337 | roles, |
| 338 | relationship_type: relationship_type.to_string(), |
| 339 | attributes: attributes.unwrap_or_default(), |
| 340 | }, |
| 341 | )(input) |
| 342 | } |
| 343 | |
| 344 | #[derive(Debug, Clone)] |
| 345 | struct Query { |