Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Nested forAlls
Nested forAlls [message #1751510] Tue, 10 January 2017 22:52 Go to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Hi every one,

why does this code :
--(context FF)
self.d->forall(m0:M | 
  m0.d->forAll(oclIsKindOf(M))
)

produces this exception :
Quote:
org.eclipse.ocl.SemanticException: Incomplete iterator expression: (Set {self."<null>"}->forall(m0 : "<null>" | Set {m0."<null>"}->forAll(temp1 : "<null>" | temp1."<null>"("<null>"))))


when I call it through
helper.setContext(THE RIGHT CONTEXT (FF))
helper.createQuery( THE OCL MENTIONED ABOVE );

('helper' is a org.eclipse.ocl.helper.OCLHelper<C, O, P, CT>)

Context :
Conceptuals entities and links conform to metamodel (attached, if needed) : an instance of the class FF (self) contains a reference d, which is an instance of the class M (say m0). Then I want to ensure, randomly if the intances referenced by 'm0.d' are of kind M.
But 'd' seems to disapear in the depth of OCL.

Questions:
Where is the 'd' gone ?
Why does this OCL rise an exception ?
Did I miss something ?
Is it possible to nest the forAlls (and exists) ?

Thanks for your help.
Edouard

  • Attachment: F.ecore
    (Size: 1.58KB, Downloaded 394 times)

[Updated on: Tue, 10 January 2017 22:53]

Report message to a moderator

Re: Nested forAlls [message #1751518 is a reply to message #1751510] Wed, 11 January 2017 06:03 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Isn't OCL case sensitive ?
Re: Nested forAlls [message #1751525 is a reply to message #1751518] Wed, 11 January 2017 07:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Indeed. I strongly recommend checking your OCL in one of the newer UI tools. Console / Editor / ...

Regards

Ed Willink
Re: Nested forAlls [message #1751572 is a reply to message #1751525] Wed, 11 January 2017 15:24 Go to previous messageGo to next message
Edouard R. Batot is currently offline Edouard R. BatotFriend
Messages: 100
Registered: March 2015
Senior Member
Quote:
Isn't OCL case sensitive ?


Quote:
I strongly recommend checking your OCL in one of the newer UI tools. Console / Editor / ...


Mea culpa, the "a"..

(Thank you.)

[Updated on: Wed, 11 January 2017 15:49]

Report message to a moderator

Re: Nested forAlls [message #1751584 is a reply to message #1751572] Wed, 11 January 2017 16:47 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
forAll can be nested. forall cannot.

Beware when using nested iterations. The OCL specification is dangerously 'helpful' in its provision of implicit source candidates. I recommend using explicit iterators and self to avoid confusion.

Regards

Ed Willink
Previous Topic:[Announce] OCL 6.1.2 and 6.2.2 for Neon
Next Topic:Of surname propagation, another nest.
Goto Forum:
  


Current Time: Fri Apr 19 00:19:29 GMT 2024

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

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

Back to the top