Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Executing rules multiple multiple times with a single match
Executing rules multiple multiple times with a single match [message #1787434] Fri, 25 May 2018 09:57 Go to next message
Michiel Fortuin is currently offline Michiel FortuinFriend
Messages: 9
Registered: May 2018
Junior Member
I want to create a transformation in ETL that creates from a flowchart like model a tree. Where the nodes in the tree are choices in the flowchart model, and the every leaf represents a trace through that flowchart model.
To do that i have created a rule that generates a node for every element in the flowchart, but some nodes in the flowchart, like the stop node, should exist multiple times in the tree.

Is it possible to create a rule that matches only to a single input element and for every reference made to that input element a new output element is created?
Re: Executing rules multiple multiple times with a single match [message #1787484 is a reply to message #1787434] Sat, 26 May 2018 09:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1613
Registered: July 2009
Location: York, UK
Senior Member

Hi Michiel,

ETL rules are only executed once for each matching input. Would something like the following do the trick?

rule FlowchartElement2TreeElement
  transform in : Flowchart!FlowchartElement
  to out : Sequence{Tree!TreeElement} {


  for (ref in referencesTo(in)) {
    var treeElement : new Tree!TreeElement;
    out.add(treeElement);
  }

} 


Please note that referencesTo is not a built-in operation but one you'd need to implement.

Cheers,
Dimitris
Re: Executing rules multiple multiple times with a single match [message #1787534 is a reply to message #1787484] Mon, 28 May 2018 10:44 Go to previous message
Michiel Fortuin is currently offline Michiel FortuinFriend
Messages: 9
Registered: May 2018
Junior Member
hi,

Yeah I was already thinking that. I know that it is in ATL possible to do it, by using a lazy rule that is not unique.
Because I have an inheritance relation in a general item, I have used a recursive operation on the elements and used a for loop to generate all the children of a node.

Thanks

Michiel Fortuin
Previous Topic:EGL and CSV
Next Topic:Feature not found in undefined object
Goto Forum:
  


Current Time: Sun Nov 18 02:22:18 GMT 2018

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

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

Back to the top