Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] PackageImpl cannot be cast to Classifi
[ATL] PackageImpl cannot be cast to Classifi [message #557302] Mon, 06 September 2010 14:45 Go to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
Hi all,

Sorry to disturb you again but I'm facing a new problem when I try to transform a UML model :s

The context is the following:
Input conforms to modelA is transformed to be conform to modelB.
During this transformation classes are copied and some of them moved into different packages than source items. For example:
classB is a generalization of classA, both contained in packA
classB contained in packB is a generalization of classA contained in packA

When I try to use the rule:
rule copyGeneralization{
   from s : TB_Profile!Generalization
   to t : UML!Generalization(
      generalizationSet <- s.generalizationSet,
      isSubstitutable <- s.isSubstitutable	

I have got a exception:
org.eclipse.m2m.atl.engine.emfvm.VMException: org.eclipse.uml2.uml.internal.impl.PackageImpl cannot be cast to org.eclipse.uml2.uml.Classifier

It seems to be due to the package moving, because if I let classes in the same package, the rule works ...
I have got the same kind of problem with association, values are not correctly set.

I hope someone will have an idea.
Re: [ATL] PackageImpl cannot be cast to Classifi [message #557307 is a reply to message #557302] Mon, 06 September 2010 15:15 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
We'll need the rest of the transformation and especially the Class rule to answer to that but I'm guessing you're transforming a Class into a package and the class :
from s : UML2!Class
t : UML2!Package(
packagedElement <- class
class : UML2!Class()

If you code it like that, then the resolve mechanism of ATL will link the input class to the first transformed element which is here the package.
When the resolve occurs for the generalization, it will take the resulting transformed element which is the package. But a generalization can't target a package.

Solution :
from s : UML2!Class
class : UML2!Class(),
t : UML2!Package(
packagedElement <- class

This way the input class is linked to the resulting class and this will be taken into account for the generalization.
Note that if you want to refer the package you can still use resolveTemp on an input class.
Re: [ATL] PackageImpl cannot be cast to Classifi [message #557390 is a reply to message #557302] Tue, 07 September 2010 09:24 Go to previous message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
My rule was:
from f: UML!Class
to t: UML!Package(
        name <-
    c: UML!Class(
        package <- t

So the resolve mechanism linked to the package.
Thanks to your code, I modified my rule and now that works.

Thanks for your time and consideration

Previous Topic:GUI for ATL?
Next Topic:[QVTo] Failed to load model extent
Goto Forum:

Current Time: Sat Jun 06 13:25:16 GMT 2020

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

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

Back to the top