Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Resolved: Uml2Uml: dynamic packagedElement Creation(create multiple packaged element instances for classes in an uml diagram)
Resolved: Uml2Uml: dynamic packagedElement Creation [message #1059003] Thu, 16 May 2013 07:49
Stefan L is currently offline Stefan L
Messages: 13
Registered: July 2012
Junior Member
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 Very Happy

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 07:55]

Report message to a moderator

Previous Topic:Problem in a helper
Next Topic:How to run chain transformations using ANT?
Goto Forum:
  


Current Time: Sun Oct 26 07:55:09 GMT 2014

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

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