|
Re: [ATL] Simultanious loading of two collections which are brances of the same tree [message #44977 is a reply to message #44946] |
Wed, 06 June 2007 23:15 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
Could you please prefix the subject of your ATL-related posts on this
newsgroup with [ATL], as I am doing in this answer? Thanks.
There should not be any difference between Run and Debug mode.
A very convenient way to see the values of expressions in Run mode is to
use the OclAny.debug(message : String) : OclAny operation.
It returns its source (i.e., using it does not change anything for the
transformation) and prints out the message followed by the source to the
console.
Could you please insert calls to the "debug" operation in your code, and
report the results here?
Regards,
Frédéric Jouault
Mariya Denysova wrote:
> Hello,
>
> I have the following problem.
>
> I have the following input model which conform to ecore.Change metamodel:
>
> <?xml version="1.0" encoding="ASCII"?>
> <change:ChangeDescription xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:change="http://www.eclipse.org/emf/2003/Change">
> <objectChanges>
> <key
> href=" platform:/resource/org.denysova.transformation/deletions/Pur chaseD.ecore#//orders/suborders "/>
>
> <value featureName="eSuperPackage">
> <referenceValue
> href=" platform:/resource/org.denysova.transformation/deletions/Pur chaseD.ecore#//orders "/>
>
> </value>
> </objectChanges>
> <objectChanges>
> <key
> href=" platform:/resource/org.denysova.transformation/deletions/Pur chaseD.ecore#//orders "/>
>
> <value featureName="eSubpackages" set="false"/>
> </objectChanges>
> </change:ChangeDescription>
>
> In my ATL file I do the following:
>
> rule ChangeDescription {
> from inputModel : Change!ChangeDescription using {
> subKeys : Set (Change!EObject) =
> inputModel.objectChanges->select(f | f.value->exists(k | k.featureName =
> 'eSubpackages'))->collect(i | i.key);
> coll : Collection(Change!EObjectToChangesMapEntry) =
> inputModel.objectChanges->select(i | i.value->exists(k | k.featureName =
> 'eSuperPackage' and subKeys->includes(k.referenceValue)));
>
> }
> to
> targetModel : distinct Changemm!PackageDelete foreach (e in coll)(
> package <- e.key, superPackage <- e.key )
> }
>
> Unfortunately the expression subKeys->includes(k.referenceValue) always
> returns 'false'. Seems that at the moment of execution of this rule
> subKeys collection is always empty.
>
> It seems to me that this is a bug in ATL, because this code works well
> in the debug mode. When running the debugger I can see that this
> collection contains objects.
> It looks as if in the runtime mode the ATL virtual machine loads only
> one branch of the input "tree" and doesn't see the other one.
>
> Thanks in advance. Hopefully you can help me.
>
> Regards,
> Mariya.
>
>
|
|
|
Re: Simultanious loading of two collections which are brances of the same tree [message #45115 is a reply to message #44946] |
Fri, 08 June 2007 09:54 |
Eclipse User |
|
|
|
Originally posted by: rchevrel.sodius.com
This is a multi-part message in MIME format.
--------------080504010803050802090102
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Mariya,
I have perhaps see your problem.
You do:
subKeys : Set (Change!EObject) = inputModel.objectChanges->select(f |
f.value->exists(k | k.featureName = 'eSubpackages'))->collect(i | i.key);
So "inputModel.objectChanges->select(f | f.value->exists(k |
k.featureName = 'eSubpackages'))" give you a Sequence of elements. Then
you do a collect on this sequence ("->collect(i | i.key)"), so you
obtain a Sequence of Sequence.
You have to use the flatten() operation if you want to have a Sequence.
The debug probably show you something like:
Sequence{ Sequence{elmA, elmB}, Sequence{}, ...}. After a flatten, you
will obtain Sequence{elmA, elmB...}.
I hope this will help you.
*R
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03115 seconds