LoginSignup
0
0

More than 3 years have passed since last update.

Alloyでアナリシスパターンを表現「2章 責任関係」

Last updated at Posted at 2020-11-09

Alloyでアナリシスパターンを表現する試み

2.1 パーティ

人あるいは組織を抽象化した概念として「パーティ」を導入する。

abstract sig パーティ {
    属性_電話番号: 電話番号,
    属性_住所: 住所,
    属性_Eメールアドレス: Eメールアドレス
}
fact {
    属性_電話番号 in パーティ some -> lone 電話番号
    属性_住所 in パーティ some -> lone 住所
    属性_Eメールアドレス in パーティ some -> lone Eメールアドレス
}
sig 人, 組織 extends パーティ {}
sig 電話番号 {}
sig 住所 {}
sig Eメールアドレス {}

pred show {}
run show

実行結果

2.1_party.png

2.2 階層構造

階層に関する制約はalloyで素直に記述できる。

abstract sig 組織 {
    親:  lone 組織
}
sig 営業所 extends 組織 {} { 親 in 部門 }
sig 部門 extends 組織 {} { 親 in 地域 }
sig 地域 extends 組織 {} { 親 in 事業部 }
sig 事業部 extends 組織 {} { no 親 }

pred show(a地域: 地域, a事業部: 事業部, a部門: 部門, a営業所: 営業所) {
}
run show for 4

実行結果

alloy2.2.png

二つの組織階層

abstract sig 組織 {
    親営業:  lone 組織,
    親製品サービス: lone 組織
}
sig 営業所, 製品サービス extends 組織 {}

fact {
    all a組織: 組織 | no a組織.^(親営業 + 親製品サービス) & a組織
    親製品サービス in 組織 -> lone 製品サービス
    親営業 in 組織 -> lone 営業所
}

pred show {}
run show

実行結果

alloy2.2.2.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0