我应该使用 UML 跟踪还是实现

Should I use a UML trace or realization

我有一个逻辑数据模型和多个用于不同系统的物理数据模型,所有这些模型都记录在 UML 中。我想展示物理模型中的数据如何追溯到逻辑模型,以便在对逻辑模型进行更改时,我们可以轻松确定所有受影响的物理模型。

这些关系最好用痕迹还是实现来表示?我怀疑答案是 "trace",但我想先看看其他人是怎么想的,以免在这方面投入太多时间并犯错。跟踪或实现关系是否提供了在此上下文中有用的额外语义?

到目前为止我的解释(有意引用):“我通常使它们 <<trace>> 依赖。Realization 在接口或抽象 class 和 [=22= 之间] class。物理模型是从逻辑模型派生的,不是 1:1 实现的。在大多数情况下,您在逻辑模型中无法预见的物理层面上进行修改(反规范化和各种您需要在数据库级别进行优化。不知何故,这是一种实现。"

然而,这是 纯粹的 事实,这是 UML 规范在 p.1 上所说的内容。 54:

7.8.14 Realization [Class]

Realization is a specialized Abstraction relationship between two sets of model Elements, one representing a specification (the supplier) and the other represents an implementation of the latter (the client). Realization can be used to model stepwise refinement, optimizations, transformations, templates, model synthesis, framework composition, etc.

所以你实际上可以在这里使用一个实现。 <<trace>> 比较通俗,但不一定是错误的。

这些关系最好表示为跟踪,即具有构造型 <> 的依赖关系。跟踪旨在关联不同模型中的元素,这正是您的情况。

UML 2.5.1 规范将跟踪构造型定义为 'standard profile'(第 22.3 节)的一部分,如下所示:

Specifies a trace relationship between model elements or sets of model elements that represent the same concept in different models. Traces are mainly used for tracking requirements and changes across models. As model changes can occur in both directions, the directionality of the dependency can often be ignored. The mapping specifies the relationship between the two, but it is rarely computable and is usually informal.

尽管 UML 规范定义的实现关系也足够广泛以适合您的目的,但是 UML 规范中的示例(例如图 7.21)以及我看到这种关系在现实世界项目中的使用方式让我想到结论是这种类型的关系主要用于关联同一模型中的元素,特别是具有实现这些接口的 类 的接口元素。