是否有可能在UML / OCL中对应用的构造型的标记值表达约束?

时间:2016-02-12 14:37:38

标签: uml ocl

例如,让我们考虑以下UML图: enter image description here

模型必须仅在Block1的所有实例都有效时,Block1::unit_of_press的实例与实际类型{的标记值unit的实例相同{1}}

是否有可能在OCL中表达这样的约束?

1 个答案:

答案 0 :(得分:0)

Yes, it is possible to access the tagged values of an applied stereotype. See Finding All Elements with a Given Tag as a starting point. From there you can assert what must be true about the tagged value.

In case that web page becomes unavailable, an example is:

self.allOwnedElements()
->select(e | e.getValue(e.getAppliedStereotype('Ecore::EAttribute'), 'isTransient') = true)

(Thanks to Rafael Chaves, Vladimir Orany, and Bjoern Sundin.)