Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Difficulty with an ATL expression
Difficulty with an ATL expression [message #106539] Sun, 14 June 2009 17:40 Go to next message
Eclipse UserFriend
Originally posted by: oba.informatik.uni-kiel.de

Hallo,

I have the following meta-model subset:

// A class "State" with a reference called "stateArgs"
// to another class "StateArgument":

<eClassifiers xsi:type="ecore:EClass" name="State">
<eStructuralFeatures xsi:type="ecore:EReference" name="cstate"
ordered="false"
eType="#//CState" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="stateArgs"
ordered="false"
upperBound="-1" eType="#//StateArgument" containment="true"/>
</eClassifiers>

// The model element "StateArgument" with an attribute "type" whichs
// datatpye is "Pseudo":

<eClassifiers xsi:type="ecore:EClass" name="StateArgument">

<eStructuralFeatures xsi:type="ecore:EAttribute" name="type"
ordered="false" unique="false"
eType="#//Pseudo"/>
</eClassifiers>

// "Pseudo" is an enumaration, where a literal 'final' is.

I simply want to select the "State"s which are of type final.
Namely I try to do something like that:

helper context MM1!State def: isFinal : Boolean =
let cllctn : Collection = collection -> select
(State|State.stateArgs.type = 'final')

if self.stateArgs.oclIsUndefined() then
false
else
for self.allInstancesFrom(MM1:StateArgument)
// This is the point where I don't know how to 'say' "which have the
type final".

I know, this must be quite easy to write down. Anyone any idea? Sorry
for the newbie question.
Re: Difficulty with an ATL expression [message #106601 is a reply to message #106539] Mon, 15 June 2009 15:38 Go to previous message
Freddy Allilaire is currently offline Freddy AllilaireFriend
Messages: 130
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050000030806070702010006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

I think you can rewrite your helper isFinal with something similar to this:

helper context MM1!State def: isFinal : Boolean =
if self.stateArgs.oclIsUndefined() then
false
else
self.stateArgs->exist(e | e.type = #final)
endif

Regards,
Freddy


myName a
Previous Topic:[ATL] How compile ATL files in headless mode
Next Topic:[ATL] Calling ATL Compiler from JAVA
Goto Forum:
  


Current Time: Fri Apr 26 13:49:04 GMT 2024

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

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

Back to the top