Of surname propagation, another nest. [message #1751901] |
Mon, 16 January 2017 17:12  |
Eclipse User |
|
|
|
Hi everybody,
last post was about nesting forAlls, I come back on the same topic : nesting first logic operators (exists and forAll at least) and the propagation of aliases (or su(r/b)names).
Then, why this code :
not (
self.k->exists(p201:P |
(
p201.m->forAll(a156471:F | oclIsKindOf(P))
or
p201.k->forAll(a : P | a.l->includes(p201))
)
)
)
produces that exception :
Quote:org.eclipse.ocl.SemanticException: Unrecognized variable: (p201)
at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:352)
at org.eclipse.ocl.util.OCLUtil.checkForErrors(OCLUtil.java:322)
when executed through the OCLHelper with proper argument ?
(I've checked in the EclipseOCL editor and it sounds right.)
(parenthesis are here compulsory to nest more condition inside the expression space of the forAlls).
Any idea why does the p201 is not recognized ?
Thank you,
Bonne journée,
Edouard
|
|
|
Re: Of surname propagation, another nest. [message #1751904 is a reply to message #1751901] |
Mon, 16 January 2017 17:24   |
Eclipse User |
|
|
|
An other example which brings the same SemanticException (p182 is not recognized), just to illustrate my words.
self.l->forAll(p182:P |
(
(
(
p182.l->forAll(a1 : P, a2 : P | a1.m = a2.m implies a1 = a2)
or
p182.d.m = p182
)
and
p182.k->exists(p181:P |
p181.d.m = p181
)
)
or
p182.m <> p182
)
)
I know it's abstract, I'm trying to understand OCL at work.
If you experience such "bugs" (if I may call it that way), and you know how to fix them, or if you get what's wrong in the (concrete) syntax I use, please, any help is appreciated.
Thanks again,
Edouard
[Updated on: Mon, 16 January 2017 17:28] by Moderator Report message to a moderator
|
|
|
|
Re: Of surname propagation, another nest. [message #1751918 is a reply to message #1751916] |
Mon, 16 January 2017 19:08   |
Eclipse User |
|
|
|
Quote:Your examples look as if they should work
Indeed, they should.
But they don't.
Metamodel attached (most simple one : a Family with Person (P), Male (M) and Female (F), with attributes : kids (k), m (mother), d (father) and some extra testing features : l, name, age, test (bool), size...
The purpose is to deal with OCL - I'll extend to a more industrial problem soon.
Attachment: F.ecore
(Size: 1.58KB, Downloaded 330 times)
|
|
|
|
Re: Of surname propagation, another nest. [message #1751968 is a reply to message #1751923] |
Tue, 17 January 2017 10:14  |
Eclipse User |
|
|
|
Hi
Thanks for getting back. EMF is very powerful but also able to help you dig very deep holes. Complex use and extra layers such as UML and OCL provide additional opportunities for confusion. Attempts to solve some of the fragile areas such as metamodel schizophrenia often work, but sometimes just give a different obscure problem somewhere else. Unfortunately there is too much legacy to really revisit the troublesome areas. Sorry. I'm not aware of any consensus about what EMF 3 would do differently and who would pay for it and any associated migration?
Your original message suggests that you are using the Classic OCL that has been very stable for at least five years now. It has a number of limitations that are very unlikely to be resolved since the new Pivot OCL prototypes many solutions to OMG specification deficiencies and exploits new technology such as Xtext to provide modeled extensibility for QVT.
If your production context requires extreme stability, stay with the Classic OCL. If you can accommodate a little instability you should find many advantages in the Pivot OCL such as a Java code generator. All the editing and debugging tools exploit the Pivot OCL and XText.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.03806 seconds