Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » counting the number of occurences ofan eReference in an ATL transformation
counting the number of occurences ofan eReference in an ATL transformation [message #1834966] Sun, 22 November 2020 14:57 Go to next message
nour nour is currently offline nour nourFriend
Messages: 19
Registered: April 2020
Junior Member
Hello everyone,

I have an ATL model, which transforms a source model "S" into a target model "T" (both are ecore models).
I have two eReferences called "InputParam" and "OutputParam" in the source model "S", which both relate "process" eClass to "parameter" eClass.

what I need is:
Count the total number of occurrences of "InputParam" + "OutputParam" eReferences in the source XMI model at runtime so I can decide:

if ( the total number of occurrences >1 ) then
the "process" eClass is transformed into an "Activity" eClass in the target model T
else
the "process" eClass is transformed into a "subActivity" eClass in the target model T
endif

I tried using ocl functions count(), AllInstances() as well as size(), however, none of them seems to work, as I get an error which implies that it can not iterate on the eRefernces that I indicated.

Can anyone tell me the right ocl function to use and how?
Regards.
Re: counting the number of occurences ofan eReference in an ATL transformation [message #1834972 is a reply to message #1834966] Sun, 22 November 2020 15:36 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

You can count the total number of EReferences named "InputParam" like so (assuming you've named your Ecore metamodel "ECORE" in your ATL file):
ECORE!EReference.allInstances()->select(r | r.name = 'InputParam')->size()


Cheers,
Dennis
Previous Topic:transform .atl file to .java file
Next Topic:Can I have two output models from one input model using ATL transformation?
Goto Forum:
  


Current Time: Sat Nov 11 08:17:58 GMT 2023

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

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

Back to the top