Simultanious loading of two collections which are brances of the same tree [message #44946] |
Wed, 06 June 2007 15:21  |
Eclipse User |
|
|
|
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: [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 19:15   |
Eclipse User |
|
|
|
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.
>
>
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03725 seconds