UML 图中的可导航性是什么?

What is Navigability in UML diagrams?

UML 图中的导航性示例是什么?我的教授提供了下图,但我似乎无法理解:

这显示了可导航性。 A 可以看到(意味着它有一个属性引用)B。相比之下 B 不知道 about/reference 到 A.

UML 2.5 规范页。 18:

  • Arrow notation is used to denote association end navigability. By definition, all class-owned association ends are navigable. By convention, all association-owned ends in the metamodel are not navigable.

  • An association with neither end marked by navigability arrows means that the association is navigable in both directions.

还有更相关的 p。 200:

Navigability notation was often used in the past according to an informal convention, whereby non-navigable ends were assumed to be owned by the Association whereas navigable ends were assumed to be owned by the Classifier at the opposite end. This convention is now deprecated. Aggregation type, navigability, and end ownership are separate concepts, each with their own explicit notation. Association ends owned by classes are always navigable, while those owned by associations may be navigable or not.

所以你应该改用点符号:

UML 规范是一堆错综复杂的替代符号,可能会让您发疯。 谨慎探索!

在现实生活中,保持简单!不要使用“点符号”,也不要使用 x 表示不可通航,除非您的同行熟悉它。

使用箭头 进行导航关联。人们对它很熟悉,或者他们足够直观。