Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » CallEvent matching with class operation
CallEvent matching with class operation [message #541709] Tue, 22 June 2010 05:41 Go to next message
pkojo is currently offline pkojo
Messages: 27
Registered: October 2009
Junior Member
Hi,

I am trying to match CallEvent operations from sequence diagram to class diagram using OCL Interpreter, I run following query to do this: but got an error and tries many other possibilities but got the same error

self.ownedOperation->select(e|e->exists(e1|CallEvent.allInstances().operation= e1.name))

Error:
Cannot find operation (=(String)) for the type (Bag(Operation))

Can any one point me what should I do to resolve this query.

Thanks in advance,
Re: CallEvent matching with class operation [message #541768 is a reply to message #541709] Tue, 22 June 2010 09:06 Go to previous message
Christian W. Damus is currently offline Christian W. Damus
Messages: 768
Registered: July 2009
Senior Member
Hi, pkojo,

The error message tells you everything that you need to know to fix this
problem.

First, it indicates that it is looking for an '=' operation accepting a
String argument. The only String-type expression that you have is
'e1.name'. So, the type in which the parser is looking for this
operation (the 'Bag(Operation)' type) must be the target of the '='
operation, that is, 'CallEvent.allInstances().operation'.

You cannot compare a Bag of Operations with a String.

So, you could instead do this:

self.ownedOperation->select(e |
e->exists(e1 |
CallEvent.allInstances().operation->includes(e)))

This will give you the owned operations of 'self' that are called by
*some* behaviour model. It won't ensure that this call is in an
Interaction (rather than, say, an Activity), nor that it is in a
particular interaction, nor *which* call event(s) call which
operation(s). It also doesn't account for inherited operations, if
that's potentially important.

HTH,

Christian

On 22/06/10 05:41 AM, pkojo wrote:
> Hi,
>
> I am trying to match CallEvent operations from sequence diagram to class
> diagram using OCL Interpreter, I run following query to do this: but got
> an error and tries many other possibilities but got the same error
>
> self.ownedOperation->select(e|e->exists(e1|CallEvent.allInstances().operation=
> e1.name))
> Error: Cannot find operation (=(String)) for the type (Bag(Operation))
>
> Can any one point me what should I do to resolve this query.
>
> Thanks in advance,
Previous Topic:OCL Invariant to find cycle in inheritance tree interface
Next Topic:OCL in drawing tool!!
Goto Forum:
  


Current Time: Wed Jul 30 19:32:38 EDT 2014

Powered by FUDForum. Page generated in 0.01519 seconds