Hi,
I'm desperately trying to generate packagedElements in my target model via my model rule for each class elements of my source model.
A simple code I found works with static code:
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- OrderedSet {services, information, processes}
),
services: UML2!"uml::Class" (
name <- 'asdf'
),
information: UML2!"uml::Class" (
name <- 'information view'
),
processes: UML2!"uml::Class" (
name <- 'services view'
)
}
But actually I want to do something like this, to generate multiple classes as packagedElements within the model scope:
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- OrderedSet {UML2!"uml::Class".allInstances()}
)
}
This gives me the following error:
Exception in thread "main" org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.ClassCastException: org.eclipse.m2m.atl.emftvm.util.LazyList$UnionList cannot be cast to org.eclipse.emf.ecore.EObject
at rule Model@applier#12(../AtlTransform/test/test.atl#[65:3-65:70])
Local variables: [__trace__: TRACE!TraceLink = 25ea22df:TRACE!TraceLink, s: UML2!uml::Model = model:UML2!Model, t: UML2!uml::Model = model:UML2!Model]
at static EMFTVM!ExecEnv::main() : Object(../AtlTransform/test/test.atl)
Local variables: []
at org.eclipse.m2m.atl.emftvm.impl.CodeBlockImpl.internalExecute(CodeBlockImpl.java:989)
...
Whereas the static try works just fine. I don't know how i should interpret this EObject thingy.
Nevertheless, I would appreciate some hint/help here. Thanks.
Stefan
EDIT: ohmygod, now i actually have seen the error 
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- UML2!"uml::Class".allInstances()
)
}
I just removed the OrderedSet.
[Updated on: Thu, 16 May 2013 03:55] by Moderator