模型必须仅在Block1
的所有实例都有效时,Block1::unit_of_press
的实例与实际类型{的标记值unit
的实例相同{1}}
是否有可能在OCL中表达这样的约束?
答案 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.)