Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » oclAsType for external classes
oclAsType for external classes [message #694502] Fri, 08 July 2011 13:56 Go to next message
Daniel Strueber is currently offline Daniel Strueber
Messages: 14
Registered: March 2011
Junior Member
Hey,

Let's say I have an EClass A with a EReference b of the type EClass C that contains an EAttribute d.
A and C are part of different metamodels.

So when I type the following into the Interactive OCL console:

A.b.oclAsType(C).d

"Unrecognized variable: (C)" is returned.
Can't I use an external EClass's features in an OCL expression or am I missing something?

Regards,
Daniel
Re: oclAsType for external classes [message #694535 is a reply to message #694502] Fri, 08 July 2011 15:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
HI Daniel

Which version of Eclipse OCL are you using? Some versions complain about
a variable for a type.

It should work, but "A.b" seems an unlikely start. A seems to be an
EClass rather than an instance.

Are you sure that the meta-model is in scope? I would expect to see a
MM2::C qualification to specify the package.

Regards

Ed Willink

On 08/07/2011 18:56, forums-noreply@eclipse.org wrote:
> Hey,
>
> Let's say I have an EClass A with a EReference b of the type EClass C
> that contains an EAttribute d.
> A and C are part of different metamodels.
>
> So when I type the following into the Interactive OCL console:
>
> A.b.oclAsType(C).d
>
> "Unrecognized variable: (C)" is returned.
> Can't I use an external EClass's features in an OCL expression or am I
> missing something?
>
> Regards,
> Daniel
Re: oclAsType for external classes [message #694592 is a reply to message #694535] Fri, 08 July 2011 18:52 Go to previous message
Daniel Strueber is currently offline Daniel Strueber
Messages: 14
Registered: March 2011
Junior Member
You're right about A.b not being a proper start, of course I was using an instance rather than the class.

The package qualification was exactly what I couldn't figure out on my own - that did it, thanks for your help!

[Updated on: Fri, 08 July 2011 18:54]

Report message to a moderator

Previous Topic:Navigating a non-navigable (one way) association
Next Topic:How do I determine if a class has no one inhereting from it?
Goto Forum:
  


Current Time: Tue Jul 22 13:40:16 EDT 2014

Powered by FUDForum. Page generated in 0.01456 seconds