如何在 UML 序列图中表示 Actor generalization/specialization?

How to represent Actor generalization/specialization in a UML Sequence Diagram?

我有一个用例图,其中包含三个参与者:用户、图书管理员和员工。

Staff 和 Librarian actor 是 User actor 的特化,在用例图中,它们每个都有一些仅与它们关联的扩展用例。

  1. 在序列图中,如何显示 Librarian actor 是 User actor 的特化?

  2. 专业演员(图书管理员和员工)可以在序列图中有自己的时间线吗?

  3. 我是否必须显示广义参与者的时间表,即使它没有额外的用例或超过其专业化的行动?

  4. 在将序列图提取到自己的图中后,是否可以使用主序列图中的交互使用框重新安排序列图的时间线?

  1. In the sequence diagram, how do I show that the Librarian actor is a specialization of the User actor?

没有办法(据我所知)。您可以在 UML Use Case Diagram and even better in UML Class Diagram

中显示此关系
  1. Can the specialized actors (Librarian and Staff) have their own timelines in the Sequence diagram?

是的,假设它们都在序列图捕获的场景中发挥作用并相互作用

  1. Do I have to show a timeline for the generalized actor, even if it has no extra uses cases or actions over its specializations?

不,您不必在图表中显示形式上正确但无用的工件,除非后续代码生成(或 MDA)工具强制您这样做

  1. Is it OK to re-arrange the Timelines of a sequence diagram once it has been extracted out into its own diagram, using an Interaction Use box in the main sequence diagram?

我不确定,但可能是的,如果你保持输入和输出的绑定以及标识生命线的信息清晰有效。一些可能隐藏正确答案的文章:

  • Source: uml-diagrams.org: UML Sequence Diagrams → Interaction Use

    ...One constraint imposed by UML specification that is sometimes difficult to follow is that the interaction use must cover all involved lifelines represented on the enclosing interaction. This means that all those lifelines should be somehow located near each other. If we have another interaction use on the same diagram it could be very tricky to rearrange all involved lifelines as required by UML

  • Source: www.omg.org/spec/UML/2.5/Beta2

    17.7 Interaction Uses → Semantics → Part Decompositions

    Decomposition of a lifeline within one Interaction by an Interaction (owned by the type of the Lifeline’s associated ConnectableElement), is interpreted exactly as an InteractionUse. The messages that go into (or go out from) the decomposed lifeline are interpreted as actual gates that are matched by corresponding formal gates on the decomposition.

    As the decomposed Lifeline is interpreted as an InteractionUse, the semantics of a PartDecomposition is the semantics of the Interaction referenced by the decomposition where the gates and parameters have been matched...

    17.7 Interaction Uses → Notation → PartDecomposition

    PartDecomposition is designated by a referencing clause in the head of the Lifeline as can be seen in the notation sub clause 17.3.4 (Lifeline) (see also Figure 17.21).

    If the part decomposition is denoted inline under the decomposed lifeline and the decomposition clause is “strict,” this indicates that the constructs on all sub lifelines within the inline decomposition are ordered in strict sequence (see 17.6.4 (Strict interactionOperator)...

    Figure 17.21 PartDecomposition - the decomposed part

    ...