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
becomes
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,
      general<-s.general,
      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
to
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
to
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 <- f.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 Apr 27 03:48:25 GMT 2024

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

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

Back to the top