单向关系箭头是什么意思

What means a unidirectional relationship arrow

我不明白链接图片中两个表之间的关系是什么意思。我该如何编码?

它与

virtual public Propriete Proprietes { get; set; }

类(不是表格)之间的关联末尾的箭头表示此端是可导航的。

这被定义为在属性结尾的一个操作。 UML 2.5 规范中的定义说:

isNavigable() : Boolean The query isNavigable() indicates whether it is possible to navigate across the property.

body: not classifier->isEmpty() or association.navigableOwnedEnd->includes(self)

此外,它还谈到了关联符号:

An open arrowhead on the end of an Association indicates the end is navigable. A small x on the end of an Association indicates the end is not navigable.

关于关联的可导航性

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.

总结一些要记住的事情,因为这个约定仍然经常使用:

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.

所以现在你应该知道这是什么意思了吧。如何编码取决于编程语言、公司标准、架构层、您的创造力等。

Geert 写的是真实的东西,但我认为,你需要更多实用的建议。

那个单向箭头表示 Enquette class 有一个属于 class Propriete 的字段或方法。在 99% 中,它是该类型的简单字段。现代标准为此提供了在线另一侧的一个点。

事实上,箭头上没有名称,这通常意味着该字段的名称是专有的,或 Propriete,根据语言和您的公司接受的样式。 (它在 UML 标准中不是必需的,但它被广泛使用)。从问题的最后一段看,贵公司好像也是用这个规则。

事实上,线的另一端没有箭头,并不意味着 Propriete class 中没有字段或方法具有 class Enquette。 (尽管这意味着在 90 年代)。这只是意味着我们还没有决定是否有这样的领域。或许,我们认为它不重要。 IE。它是未定义的。已知缺乏这种联系必须用十字而不是箭头来表示。

所以,在 Enquette 的某个地方,你有一行:

Propriete propriete;

Propriete* Propriete; //if you are in C++

甚至可能

Propriete** Propriete;

或被您引用

virtual public Propriete Proprietes { get; set; } // apparently, C#

它可以是 static/class 字段或实例字段 - 它未在图中定义。

并且在 class Propriete 中可以存在以下行:

Enquete enquete; // or some of the mentioned variants

并且您将决定它是否存在的问题留给了编码人员。

注意,没有箭头的线意味着两端确实有字段(或方法)。如果该行应该显示两个箭头,我们根本不绘制箭头。

所以,真的,你的问题有误。这不是单向关系。它是一个显示关系的单向箭头,可能是单向的。