Return str rId of `reltype` to `target_part`. The rId of an existing matching relationship is used if present. Otherwise, a new relationship is added and that rId is returned.
(self, reltype: str, target_part: Part)
| 524 | return len(self._rels) |
| 525 | |
| 526 | def get_or_add(self, reltype: str, target_part: Part) -> str: |
| 527 | """Return str rId of `reltype` to `target_part`. |
| 528 | |
| 529 | The rId of an existing matching relationship is used if present. Otherwise, a new |
| 530 | relationship is added and that rId is returned. |
| 531 | """ |
| 532 | existing_rId = self._get_matching(reltype, target_part) |
| 533 | return ( |
| 534 | self._add_relationship(reltype, target_part) if existing_rId is None else existing_rId |
| 535 | ) |
| 536 | |
| 537 | def get_or_add_ext_rel(self, reltype: str, target_ref: str) -> str: |
| 538 | """Return str rId of external relationship of `reltype` to `target_ref`. |