Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Nested OCL forAlls
Nested OCL forAlls [message #1703513] Sun, 02 August 2015 00:31 Go to next message
Hamid Qartal is currently offline Hamid QartalFriend
Messages: 33
Registered: December 2013
Member
I have the following Formula in First Order Logic.

    foAll a:A | forAll b :B | if a.r1=b then a.r2=b


simply, for all objects of type A, and for all objects of type B, if they are related by r1 then they are related by r2 as well. r1 and r2 are two association from A to B.

How this is written in OCL?


Re: Nested OCL forAlls [message #1703518 is a reply to message #1703513] Sun, 02 August 2015 09:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5834
Registered: July 2009
Senior Member
Hi

A.allInstances()->forAll(a | B.allInstances()->forAll(b | a.r1=b implies
a.r2=b))

---

OCL 2.5 may accept that allInstances() is an unavoidably useful evil and
so allow

forAll(a : A, b : B| a.r1=b implies a.r2=b)

Regards

Ed Willink


On 02/08/2015 01:31, Hamid Qartal wrote:
> I have the following Formula in First Order Logic.
>
> foAll a:A | forAll b :B | if a.r1=b then a.r2=b
>
>
> simply, for all objects of type A, and for all objects of type B, if
> they are related by r1 then they are related by r2 as well. r1 and r2
> are two association from A to B.
>
> How this is written in OCL?
>
>
>
Previous Topic:What specification to use
Next Topic:How to query UML models with OCL?
Goto Forum:
  


Current Time: Sun Apr 22 10:40:10 GMT 2018

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

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