具有双向关联的 UML 组合(组合对象具有反向指针)

UML composition with bidirectional association (composing object has back-pointer)

我似乎无法在互联网上找到合适的答案,但我确定之前有人问过它。

基本上,我有一个由另一个对象组成的对象 - 所以黑色菱形和线条。当父对象死亡时,它所组成的对象也随之死亡。但是,由它组成的对象有一个指向父对象的指针。这在 UML 中看起来像什么?

编辑:例如,建筑物可能由房间组成,但房间包含指向建筑物对象的指针

谢谢

您可以使用 owned end notation,它在关联连接器中的所有者 class 附近显示一个点。

An end Property of an Association that is owned by an end Class or that is a navigableOwnedEnd of the Association indicates that the Association is navigable from the opposite ends; otherwise, the Association is not navigable from the opposite ends. Navigability means that instances participating in links at runtime (instances of an Association) can be accessed efficiently from instances at the other ends of the Association. The precise mechanism by which such efficient access is achieved is implementation specific. If an end is not navigable, access from the other ends may or may not be possible, and if it is, it might not be efficient.

来自上层建筑 ptc-13-09-05 p. 207