Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Of surname propagation, another nest.
Of surname propagation, another nest. [message #1751901] Mon, 16 January 2017 17:12 Go to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
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 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
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]

Report message to a moderator

Re: Of surname propagation, another nest. [message #1751916 is a reply to message #1751904] Mon, 16 January 2017 18:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your examples look as if they should work, but since you do not provide metamodels many of the contributing problems can only be guessed at,

Regards

Ed Willink
Re: Of surname propagation, another nest. [message #1751918 is a reply to message #1751916] Mon, 16 January 2017 19:08 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
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 305 times)
Re: Of surname propagation, another nest. [message #1751923 is a reply to message #1751918] Mon, 16 January 2017 19:46 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Found the bug, I wasn't executing the right code...

I'm really puzzled with the limits of OCL. Since the XMI problem I had, I never know if I can be confident in the engine behind.
Sorry for that.
Re: Of surname propagation, another nest. [message #1751968 is a reply to message #1751923] Tue, 17 January 2017 10:14 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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
Previous Topic:Nested forAlls
Next Topic:collect equivalent for one element
Goto Forum:
  


Current Time: Fri Apr 19 22:17:26 GMT 2024

Powered by FUDForum. Page generated in 0.03132 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top