Skip to main content



      Home
Home » Modeling » OCL » Nested forAlls
Nested forAlls [message #1751510] Tue, 10 January 2017 17:52 Go to next message
Eclipse UserFriend
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 435 times)

[Updated on: Tue, 10 January 2017 17:53] by Moderator

Re: Nested forAlls [message #1751518 is a reply to message #1751510] Wed, 11 January 2017 01:03 Go to previous messageGo to next message
Eclipse UserFriend
Isn't OCL case sensitive ?
Re: Nested forAlls [message #1751525 is a reply to message #1751518] Wed, 11 January 2017 02:32 Go to previous messageGo to next message
Eclipse UserFriend
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 10:24 Go to previous messageGo to next message
Eclipse UserFriend
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 10:49] by Moderator

Re: Nested forAlls [message #1751584 is a reply to message #1751572] Wed, 11 January 2017 11:47 Go to previous message
Eclipse UserFriend
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: Sun May 11 21:43:19 EDT 2025

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

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

Back to the top