| 
| Nested forAlls [message #1751510] | Tue, 10 January 2017 17:52  |  | 
| Eclipse User  |  |  |  |  | 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 458 times)
 [Updated on: Tue, 10 January 2017 17:53] by Moderator |  |  |  | 
|  | 
|  | 
|  | 
| 
| Re: Nested forAlls [message #1751584 is a reply to message #1751572] | Wed, 11 January 2017 11:47  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.05363 seconds