context Class definition
context Class superPlusOnSet(rs:Set(Class)):Set(Class) body: if self.inheritsFrom−>notEmpty() and rs−>excludes(self) then self.inheritsFrom−>collect(c : Class | c.superPlusOnSet(rs−>including(self)))−> flatten()−>asSet() else rs−>including(self) endif OCL can be used to automatically validate UML models. Considering an imple- mentation of an OCL interpreter, such as [12], one may actually apply the invariants of a metamodel M to a syntactically well-formed model m w.r.t. M to guarantee m’s conformance with respect to M . Therefore, before applying a model transfor- mation to a given model m, one must make sure that m is in conformance with its metamodel M (such as in Figure 1), that is, m is syntactically well-formed w.r.t. M and all invariants in M (such as noCyclesinClassHierarchy) hold in m. The MDD process adopted in this paper when invariants are considered may be drawn as follows
context Class superPlus():Set(Class) body: self.superPlusOnSet(self.emptySet())