Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » refering to a sepecific attribute
refering to a sepecific attribute [message #539127] Wed, 09 June 2010 17:38 Go to next message
Saba is currently offline Saba
Messages: 1
Registered: June 2010
Junior Member
Hi,

I am trying to constrain a specific attribute of a class. For example, there is a class named "Person" and it has an attribute "age" and I want to say that there exists a car for every person whose age is 21. So how can I refer to 21?
would this be okay:

Person.age(21)-->exists(car)

Thank you in advance,
Saba

[Updated on: Wed, 09 June 2010 17:44]

Report message to a moderator

Re: refering to a sepecific attribute [message #539175 is a reply to message #539127] Wed, 09 June 2010 20:54 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4110
Registered: July 2009
Senior Member
On 09/06/2010 18:38, Saba wrote:
> I am trying to constrain a specific attribute of a class. For example,
> there is a class named "Person" and it has an attribute "age" and I want
> to say that there exists a car for every person whose age is 21. So how
> can I refer to 21? would this be okay:
>
> Person.age(21)-->exists(car)
No.

perhaps

Person.allInstances()->select(age = 21)->exists(not car.oclIsUndefined())

Regards

Ed Willink
Previous Topic:How to provide ocl constraint for Enum attributes
Next Topic:[XPAND] duplication problem in html report
Goto Forum:
  


Current Time: Thu Oct 30 16:43:31 GMT 2014

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

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