Re: [ATL] problems to reference remote rules [message #37770] |
Tue, 15 May 2007 06:11 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
Thank you for prefixing the subject of your post with [ATL]. However,
this question would fit better in the eclipse.modeling.m2m newsgroup,
which I added in copy of my answer.
> I'm trying to associate n elements in diferent rules.
> In order to do that, I'm using the thisModule.resolveTemp() as I have
> seem in the ATL User Manual and other sample codes. However, I'm having
> the folowing error message:
> "ERROR: could not find operation getNamedTargetFromSource on Void
> having supertypes: [OclAny]"
>
> The folloing rules ilustrate what I'm tring to do:
>
> rule ClassToBlock{
> from
> class : uml!Class
> to
> block: myMetamodel!Block(
> name<-class.name
> )
> }
>
> rule ModelToModel {
> from
> uml_model : uml!Model
> to
> system : myMetamodel!System (
> name <-uml_model.name,
> blocks<- thisModule.resolveTemp(uml!Class, 'subsystem')
> ),
> simulink_model : myMetamodel!Model(
> name<-uml_model.name,
> system<-system
> )
> }
> Using these rules I would like to make system to point for a
> collection of blocks.
Why don't you write something like:
blocks <- uml_model.allClasses
(depending on your metamodel, you may need to define the recursive
"allClasses" attribute helper to retrieve all the classes directly and
indirectly contained in uml_model)
or (without needing a helper, but only working if there is a single
uml!Model in your source model):
blocks <- uml!Class.allInstancesFrom('IN')
where IN is the name of your source model.
Because there is only one element created for each class in rule
ClassToBlock, you do not need resolveTemp: ATL will automatically
resolve the classes into blocks for you ;-).
Regards,
Frédéric Jouault
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04720 seconds