要件図
要件図は、要件とその相互間の接続関係、および他のドキュメント要素との関係を可視化して提供します。
コピー
埋め込み
requirementDiagram
requirement test_req {
id: 1
text: the test text.
risk: high
verifymethod: test
}
element test_entity {
type: simulation
}
test_entity - satisfies -> test_req
構文
要件図には 3 つのコンポーネントが含まれます:要件、要素、関係です。
山括弧で表される単語は列挙キーワードで、例えば などであり、そのオプションは表で詳しく説明されています。user_defined... はユーザー入力が必要なあらゆる場所に使用されます。
ユーザーテキストに関する重要な説明:すべての入力は二重引用符で囲むことも、二重引用符なしにすることもできます。ただし、ユーザーは引用符なしの入力を使用する際に注意する必要があります。他のキーワードが検出されると、エディタはレンダリングに失敗します。
要件
要件定義には、要件タイプ、名前、ID、テキスト、リスク、検証方法が含まれます。構文は以下のとおりです:
コピー
埋め込み
<type> user_defined_name {
id: user_defined_id
text: user_defined text
risk: <risk>
verifymethod: <method>
}
タイプ、リスク、メソッドは SysML で定義された列挙です。
| キーワード | オプション |
|---|---|
| タイプ | 要件、機能要件、インターフェース要件、性能要件、物理要件、設計制約 |
| リスク | 低、中、高 |
| 検証方法 | 分析、検査、テスト、デモンストレーション |
要素
要素定義には要素名、タイプ、ドキュメント参照が含まれ、これら 3 つはすべてユーザー定義です。要素機能は軽量に保つことを目的としつつ、要件を他のドキュメントの一部の内容と関連付けられるようにします。
コピー
埋め込み
element myElement {
type: string
docref: some/doc/path
}
Markdown 形式
ユーザーがテキストをカスタマイズできる場所(名前、要件テキスト、要素のドキュメント参照など)では、次のことができます:
- テキストを二重引用符で囲む
- 二重引用符内で markdown 形式を使用する
コピー
埋め込み
requirementDiagram
requirement "__test_req__" {
id: 1
text: "*italicized text* **bold text**"
risk: high
verifymethod: test
}
関係
関係はソースノード、ターゲットノード、関係タイプで構成されます。
以下の定義形式に従います:
コピー
埋め込み
{name of source} - <type> -> {name of destination}
または
コピー
埋め込み
{name of destination} <- <type> - {name of source}
"ソースノード" と "ターゲットノード" は、他の場所で定義された要件または要素ノードの名前である必要があります。
関係タイプは、含む、コピー、派生、満たす、検証、詳細化、またはトレースのいずれかにできます。
詳細なケース
この例では、この図のすべての機能を使用しています。
コピー
埋め込み
requirementDiagram
requirement test_req {
id: 1
text: the test text.
risk: high
verifymethod: test
}
functionalRequirement test_req2 {
id: 1.1
text: the second test text.
risk: low
verifymethod: inspection
}
performanceRequirement test_req3 {
id: 1.2
text: the third test text.
risk: medium
verifymethod: demonstration
}
interfaceRequirement test_req4 {
id: 1.2.1
text: the fourth test text.
risk: medium
verifymethod: analysis
}
physicalRequirement test_req5 {
id: 1.2.2
text: the fifth test text.
risk: medium
verifymethod: analysis
}
designConstraint test_req6 {
id: 1.2.3
text: the sixth test text.
risk: medium
verifymethod: analysis
}
element test_entity {
type: simulation
}
element test_entity2 {
type: word doc
docRef: reqs/test_entity
}
element test_entity3 {
type: "test suite"
docRef: github.com/all_the_tests
}
test_entity - satisfies -> test_req2
test_req - traces -> test_req2
test_req - contains -> test_req3
test_req3 - contains -> test_req4
test_req4 - derives -> test_req5
test_req5 - refines -> test_req6
test_entity3 - verifies -> test_req5
test_req <- copies - test_entity2
方向
direction 文を使用して図を異なる方向でレンダリングするように設定できます。有効な値は:
- TB - 上から下(デフォルト)
- BT - 下から上
- LR - 左から右
- RL - 右から左
コピー
埋め込み
requirementDiagram
direction LR
requirement test_req {
id: 1
text: the test text.
risk: high
verifymethod: test
}
element test_entity {
type: simulation
}
test_entity - satisfies -> test_req
スタイル
要件と要素は、直接スタイルまたはクラスを使用してスタイルを設定できます。一般に、スタイルまたはクラスを適用する際には、要件または要素名のリストとクラス名のリストを受け取り、一度に複数のクラスを割り当てることができます。唯一の例外は簡略構文 ::: で、演算子は複数のクラスを割り当てることができますが、一度に 1 つの要件または要素にしか割り当てられません。
直接スタイル
コピー
埋め込み
requirementDiagram
requirement test_req {
id: 1
text: styling example
risk: low
verifymethod: test
}
element test_entity {
type: simulation
}
style test_req fill:#ffa,stroke:#000, color: green
style test_entity fill:pink,stroke:#333, color: blue
クラスの定義は以下の例のとおりです:
classDef を使用して再利用可能なスタイルを定義します:
コピー
埋め込み
requirementDiagram
requirement test_req {
id: 1
text: "class styling example"
risk: low
verifymethod: test
}
element test_entity {
type: simulation
}
classDef important fill:#f96,stroke:#333,stroke-width:4px
classDef test fill:#ffa,stroke:#000
デフォルトクラス
あるクラスが default と命名されている場合、それはすべてのノードに適用されます。特定のスタイルとクラスは、適用されたデフォルトスタイルを上書きするために、この後に定義する必要があります。
コピー
埋め込み
classDef default fill:pink,stroke:#333,stroke-width:4px;
適用クラス
クラスは 2 つの方法で適用できます:
1. class 構文を使用する:
コピー
埋め込み
class test_req,test_entity important
2. 定義中または定義後に演算子 ::: の簡略構文を使用する:
コピー
埋め込み
requirement test_req:::important {
id: 1
text: class styling example
risk: low
verifymethod: test
}
コピー
埋め込み
element test_elem {}
test_elem:::myClass
組み合わせの例
コピー
埋め込み
requirementDiagram
requirement test_req:::important {
id: 1
text: "class styling example"
risk: low
verifymethod: test
}
element test_entity {
type: simulation
}
classDef important font-weight:bold
class test_entity important
style test_entity fill:pink,stroke:#333