Access to keys in EMap member of model element [message #1780744] |
Fri, 26 January 2018 14:53  |
Bruce Trask Messages: 58 Registered: July 2009 |
Member |
|
|
Hello,
I used the steps from
https://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF.3F
to create a map in one of my model elements. It ends up generating an EMap.
My question is how to access that and the keys and values of its elements via the OCL or from the .mtl file in Acceleo.
In the OCL Interpreter view I enter
aql:self.theSystem.services.nameToPackageName // nameToPackageName is the map
as the expression
and I get back
one->two
three->four
which is what the map contains (two key value pairs)
If I do aql:self.theSystem.services.nameToPackageName->asSequence()
I get the same result.
What I am trying to do is iterate through the map to get the individual keys and values.
->at() does not seem to do the trick with the Map.
I was hoping for something like ->get(key) but that does not appear to exist.
I could not find anything with regard to working with Maps in aql or OCL.
Regards,
Bruce
[Updated on: Fri, 26 January 2018 14:56] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02327 seconds