Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » How to navigate target model
How to navigate target model [message #102599] Fri, 27 March 2009 12:13 Go to next message
Eclipse UserFriend
Originally posted by: behnaz.cwi.nl

Hi everyone,
Sorry if I ask this question agaian. I did not get some answer that
solves my problem. It seems that ATL does not allow navigating through
the target model which makes a problem here:

This is a simple reo to reo transformer. But rule
sourceend2sourceend rule where I try to add new Sync (one type of
primitives) and a new node in a rule which is fired on FIFO (another
type of primitives) has a problem.
The problem is also related to connetor2connetor rule, I have: c :
reo!Connector(name<-p.name, nodes<-p.nodes, primitives <- p.primitives).
When new node and sync are generated, they do not place in the module
because of the form of nodes<-p.nodes, primitives <- p.primitives (I think).
William suggested me to set node.connector (set the container info for
elements which should set inside connector). But my model just allows
top-down naavigation.
Thanks in advance,
Behnaz

>> ATL Rules:
>> module reo2reo;
>> create OUT : reo from IN : reo;
>>
>> rule module2module
>> {
>> from
>> s : reo!Module
>> to
>> m : reo!Module(name <- s.name, connectors <- s.connectors)
>> do {s.debug('module2module applied');}
>> }
>>
>> rule connetor2connetor
>> {
>> from
>> p : reo!Connector
>> to
>> c : reo!Connector(name<-p.name, nodes<-p.nodes, primitives
<- p.primitives)
>> do { p.debug('connetor2connetor applied'); }
>> }
>>
>> rule node2node
>> {
>> from
>> p : reo!Node
>> to
>> c : reo!Node(name<-p.name)
>> do { p.debug('node2node applied'); }
>> }
>>
>> rule sourceend2sourceend
>> {
>> from
>> src : reo!SourceEnd
>> to
>> trg : reo!SourceEnd(node <- src.node)
>> do { src.debug('sourceend2sourceend applied');
}
>> }
>>
>> rule sinkend2sinkend
>> {
>> from
>> snk : reo!SinkEnd
>> to
>> trg : reo!SinkEnd(node <- snk.node)
>> do { snk.debug('sinkend2sinkend applied'); }
>> }
>>
>> rule lossysync2sync
>> {
>> from
>> p : reo!LossySync
>> to
>> c : reo!Sync(sourceEnds <- p.sourceEnds, sinkEnds <- p.sinkEnds)
>> do { p.debug('lossysync2sync applied'); }
>> }
>>
>>
>> rule decomposeFIFO
>> {
>> from
>> q : reo!FIFO
>> to
>> sync1 : reo!Sync(sourceEnds <- q.sourceEnds, sinkEnds <- snk1),
>> snk1 : reo!SinkEnd(node <- n1),
>> n1 : reo!Node(name <- 'n1'),
>> sync2 : reo!Sync(sourceEnds <- src2, sinkEnds <- q.sinkEnds),
>> src2 : reo!SourceEnd(node <- n1)
>> do {q.debug('decomposeFIFO applied');}
>>
Re: How to navigate target model [message #102642 is a reply to message #102599] Wed, 01 April 2009 04:26 Go to previous message
Eclipse UserFriend
Hello,

you have a containment-reference from module to node, right? Did you try
to do something like this:

rule module2module
{
from
s : reo!Module
to
m : reo!Module(name <- s.name, connectors <- s.connectors,
nodes <- s.nodes)
do {s.debug('module2module applied');}
}

I assume that 'nodes' is the name of the containment-reference. Since
declarative rules return the same output object instance for the same
input object instance, the nodes will only be created once and will be
referenced from Module.nodes and Connector.nodes.

For accessing the output of the decomposeFIFO rule you could use
resolveTemp().
See
http://wiki.eclipse.org/ATL/User_Guide#The_ATL_Module_data_t ype
and the last example of
http://wiki.eclipse.org/ATL/User_Guide#Simple_target_pattern _element
It is also explained in this Presentation:
https://www.gpublication.com/eclipse/#requestedContent=conte ntID://EclipseConferences/EC2009/511

If you don't have access to the FIFO where you need the output of the
decomposeFIFO rule, you might use reo!Fifo.allInstancesFrom('IN') to find
the FIFO to decompose.

I hope that was helpful.

Greetings,
Max
Previous Topic:[ATL] ATLCopy
Next Topic:[ATL] "Create" new anything( class , model ...etc ) by ATL??
Goto Forum:
  


Current Time: Sun Jul 13 20:55:18 EDT 2025

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

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

Back to the top