Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Multiple values for the source pattern(Multiple values for the source pattern)
Multiple values for the source pattern [message #1809908] Thu, 25 July 2019 14:03 Go to next message
Guisella Angulo is currently offline Guisella AnguloFriend
Messages: 17
Registered: September 2016
Junior Member
Good Morning,
There is a way to iteratively call a Transformation Rule. I am refining a KDM model by moving attributes between classes, for this I receive an input parameter file. The input parameter file specifies: Source class, Destination class and the Attribute that will be moved. But, for now I can only move the first element of the list (first ()), I don't know how to execute the rule according to the input parameter values. Is there any way to iterate in the parameter list by sending the values for the transformation rule.
Thank in advance!


rule MovingCodeElement{
from
source: KDM!ClassUnit in INOUT ( (source=source.getCodeOperationTo().first()))
to
target: KDM!ClassUnit(
codeElement<- Sequence{source.getCodeOperationEntity().first()}.debug()
)
}


getCodeOperationTo: Read the input XML file to get the target.
getCodeOperationEntity: Read the input XML file to get the attribute that will be moved.
Re: Multiple values for the source pattern [message #1809984 is a reply to message #1809908] Sat, 27 July 2019 10:08 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

You can check for containment and fetch an element's index like so:

rule MovingCodeElement{
  from
    source: KDM!ClassUnit in INOUT (
      source.getCodeOperationTo()->includes(source)
    )
  to
    target: KDM!ClassUnit(
      codeElement <- 
        Sequence{
          source.getCodeOperationEntity()->at(
            source.getCodeOperationTo()->indexOf(source)
          )
        }.debug()
    )
  }


Cheers,
Dennis
Re: Multiple values for the source pattern [message #1809987 is a reply to message #1809984] Sat, 27 July 2019 13:09 Go to previous message
Guisella Angulo is currently offline Guisella AnguloFriend
Messages: 17
Registered: September 2016
Junior Member
Thanks for your answer, but it doesn't work when I have a repeated entry, such as:

Origin Destination Attribute
Class1 Class2 A
Class3 Class2 B

In this case, I can only move the first attribute.
Previous Topic:[solved] xmi:id and xmi:type tags in SysML
Next Topic:ATL plugin out with missing xmi:id
Goto Forum:
  


Current Time: Fri Apr 26 13:30:13 GMT 2024

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

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

Back to the top