Return rId of external relationship of `reltype` to `target_ref`, newly added if not already present in collection.
(self, reltype: str, target_ref: str)
| 38 | return rel |
| 39 | |
| 40 | def get_or_add_ext_rel(self, reltype: str, target_ref: str) -> str: |
| 41 | """Return rId of external relationship of `reltype` to `target_ref`, newly added |
| 42 | if not already present in collection.""" |
| 43 | rel = self._get_matching(reltype, target_ref, is_external=True) |
| 44 | if rel is None: |
| 45 | rId = self._next_rId |
| 46 | rel = self.add_relationship(reltype, target_ref, rId, is_external=True) |
| 47 | return rel.rId |
| 48 | |
| 49 | def part_with_reltype(self, reltype: str) -> Part: |
| 50 | """Return target part of rel with matching `reltype`, raising |KeyError| if not |