Skip to main content


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 17:56 Go to next message
Daniel Strueber is currently offline Daniel StrueberFriend
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 19:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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 22:52 Go to previous message
Daniel Strueber is currently offline Daniel StrueberFriend
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 22: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: Thu Apr 25 21:52:39 GMT 2024

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

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

Back to the top