文件作为 plantuml 中的输入和输出

Files as input and output in plantuml

我正在尝试编写以下流程:

我描述的 activity 包含两个二进制文件。第一个接受输入一个文件,并生成几个(比方说两个)。这两个文件,加上环境中的另一个文件,被提供给第二个二进制文件,它将生成一个输出文件。

我想使用 plantuml 来描述这一点,但文档并没有真正帮助 - 它没有进入 inputs/outputs 活动。

我可以用 file myFile 绘制文件,但我没能 link 把它们画到盒子里。我应该为此使用用例图还是 activity 图?谁能告诉我如何绘制从 file(binary) 的箭头?

我现在站在

@startuml
file myFile
(firstBinary)
@enduml

这并不是我想要的。

Should I rather use a use case diagram or an activity diagram for this?

与您要描绘的内容最接近的图表是具有工作 product/artifact 依赖关系的流程图。本质上,您的二进制文件是依赖工件(文件)并创建新工件的进程。然而,并非我们想要描述的所有内容都适合特定的图表类型,也不必如此。

由于 PlantUML 使用 GraphViz 来呈现图表,因此您始终可以使用 DOT 语言直接指定这些关系。例如,

@startuml
digraph a {
    InFile1 [shape=note]
    Binary1 [shape=ellipse]
    TmpFile1 [shape=note]
    TmpFile2 [shape=note]
    TmpFile3 [shape=note]
    Binary2 [shape=ellipse]
    EnvFile [shape=note]
    OutFile [shape=note]

    InFile1 -> Binary1
    Binary1 -> TmpFile1
    Binary1 -> TmpFile2
    Binary1 -> TmpFile3

    TmpFile1 -> Binary2
    TmpFile2 -> Binary2
    TmpFile3 -> Binary2
    EnvFile -> Binary2

    Binary2 -> OutFile
}
@enduml

会产生下图。

DOT 并不比 PlantUML 的语言复杂,但是当图表变大时,良好的理解肯定是有好处的。您可以在 Graphviz 的 Documentation 站点上获得有关 DOT 语言的更多信息。