| 487 | } |
| 488 | |
| 489 | fn relationship_inference(input: &str) -> IResult<&str, Inference> { |
| 490 | map( |
| 491 | tuple(( |
| 492 | delimited( |
| 493 | ws(char('(')), |
| 494 | separated_list1(ws(char(',')), preceded(char('$'), identifier)), |
| 495 | ws(char(')')), |
| 496 | ), |
| 497 | ws(tag("forms")), |
| 498 | ws(identifier), |
| 499 | opt(delimited( |
| 500 | ws(char('(')), |
| 501 | separated_list0(ws(char(',')), attribute_value), |
| 502 | ws(char(')')), |
| 503 | )), |
| 504 | )), |
| 505 | |(roles, _, relationship_type, attributes)| Inference::RelationshipInference { |
| 506 | roles: roles |
| 507 | .into_iter() |
| 508 | .map(|r| RoleAssignment { |
| 509 | role: r.to_string(), |
| 510 | entity: r.to_string(), |
| 511 | }) |
| 512 | .collect(), |
| 513 | relationship_type: relationship_type.to_string(), |
| 514 | attributes: attributes.unwrap_or_default(), |
| 515 | }, |
| 516 | )(input) |
| 517 | } |
| 518 | |
| 519 | fn extend_entity_inference(input: &str) -> IResult<&str, Inference> { |
| 520 | map( |