|Define OCL constrain for a modelElements association relationship [message #832155]
||Thu, 29 March 2012 21:07
| Elvis Dowson
Registered: December 2011
I have an EMF meta-model diagram, for a GMF editor.
In the attached meta-model diagram, I have a Workspace object that can contain modelElements. The ModelElement class is an abstract class, and just below it, it is inherited by a Project, DesignRepository and KnowledgeRepository.
How can I define the OCL constrain for the modelElements -> 0..* relationship?
The OCL constrain annotation could look like this, but I'm not sure how to properly write the derive value
Key = derive
Value = let modelElements : Set(pcbdesignrules::ModelElement) = self.objects->select(oclIsKindOf(pcbdesignrules::ModelElement))->collect(oclAsType(pcbdesignrules::ModelElement))->asSet() in modelElements->symmetricDifference(modelElements.modelElements->asSet())
I think the last few statements are wrong in the above value declaration, i.e. in modelElements->symmetricDifference(modelElements.modelElements->asSet())
Powered by FUDForum
. Page generated in 0.01966 seconds