Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Luís on November 18, 2011, 11:33:44 am
-
Hi,
Even with all options checked under Project | Project Validation | Configure | Model Validation Configuration it seems that OCL constraints are not correctly validated. For instance the following constraint with an error (sel instead of self) is considered valid:
context Person
inv ageinv: sel.age > 17
The same OCL constraint in other tools (e.g. USE) returns the error “Undefined operation named `sel' in expression `Person.sel()”. Can we have an workaround for this?
Not sure if this old blog post ( http://www.empowertec.de/blog/2007/01/15/ocl-support-in-enterprise-architect ) is still valid. In this post the author says:
o “expressions are applied to the UML metamodel and not to the model itself in the traditional sense.”
o I could not believe that the OCL support was so much broken and searched the EA forums for OCL. I quickly found a couple of postings that confirmed that the OCL support in EA is indeed as bad as it seemed to me, for example in this post (btw., the original poster of this thread did not realize that OCL is used for the purpose of model validation and not in the usual sense).
o although the manual says "It is important to note that in order to have a valid OCL constraint EA requires that the syntax be correctly formed, if the expression is not correct EA will inform the user that the OCL constraint is not valid."
Questions:
• How can we validate models/metamodels?
o For instance I have the following Classes (Server, Monitor) and I want to validate my model to make sure that a single Monitor is only connected to one Server. Is there a way?
• Can we use or is there any effort to use/integrate an external OCL engine with EA Sparx?
• Are examples with constraints (Relationships/Attributes/and model validations) publically available (e.g. Tools, Add-ins, Books, etc.)?
Rgs,
luis
-
I'm afraid the only answer is: write an add-in. OCL is not really supported. AFAIR (I stopped investigating on this some time ago) EA does only syntax checking on OCL constraints but does not evaluate OCL itself.
EA has a build-in rule checker. But that will also (see above) not respect OCL. I have not heard of any external tool support.
q.