Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » How to initialize the attributes of variables in an OCL query
How to initialize the attributes of variables in an OCL query [message #758458] Wed, 23 November 2011 11:00 Go to next message
D O is currently offline D OFriend
Messages: 13
Registered: November 2011
Junior Member
Hi,

I wrote an OCL query in which there are two variables:

Patient.allInstances()->select(pat : Patient |
	pat.genderCode.code = sex.code 
	and pat.observations->select(obs : Observation | obs.code.code = 'width'
	and obs.value.oclIsTypeOf(ISODatatypes::PQ))->exists(obs : Observation | 
	obs.value.oclAsType(ISODatatypes::PQ).greaterOrEqual(width).value))->size()


Variables are:

sex type of CD
width type of PQ

I can write an XMI file which proves that the syntax and semantic are correct.

Now I'd like to initialize the attributes of these variables (sex, width) with values ​​but I do not know if it's possible and if so how?

Thank you in advance.
Re: How to initialize the attributes of variables in an OCL query [message #758566 is a reply to message #758458] Wed, 23 November 2011 17:25 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There are no uninitialized variables in OCL.

It seems that your variables are parameters of a query in which case
they are bound by the query invocation.

I'm not clear what technology you use for a 'query', I'm really puzzled
by the reference to XMI, so I'll just resort to a Java analogy, where in

int aQuery(sex CD, width PQ)

sex and width are 'initialised' by the invocation

aQuery(someSex, aWidth);

Regards

Ed Willink

On 23/11/2011 11:00, david.ouagne wrote:
> Hi,
>
> I wrote an OCL query in which there are two variables:
>
>
> Patient.allInstances()->select(pat : Patient |
> pat.genderCode.code = sex.code and
> pat.observations->select(obs : Observation | obs.code.code = 'width'
> and obs.value.oclIsTypeOf(ISODatatypes::PQ))->exists(obs :
> Observation |
> obs.value.oclAsType(ISODatatypes::PQ).greaterOrEqual(width).value))->size()
>
>
> Variables are:
>
> sex type of CD
> width type of PQ
>
> I can write an XMI file which proves that the syntax and semantic are
> correct.
>
> Now I'd like to initialize the attributes of these variables (sex,
> width) with values ​​but I do not know if it's possible and if so how?
>
> Thank you in advance.
Previous Topic:operation return type as Tuple
Next Topic:How to define cross-referenced custom operations
Goto Forum:
  


Current Time: Thu Apr 18 23:39:21 GMT 2024

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

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

Back to the top