WHAT I WANT TO DO
I want to define a helper function isVisible() based on allInstances().
PROBLEM
allInstances() and allInstancesFrom('modelname') do not return the
expected results, they return empty sets instead.
Or to be more specific: When I use the debugger to step to this
particular point in the ATL file, the watch variables are empty.
ADDITIONAL INFO
I tried both allInstances() and allInstancesFrom('modelname').
The models referenced by settingsIn, componentIn and scm are NOT empty
and DO contain instances of Setting, Component and
SettingComponentMapping.
With other rules in the ATL file, the contents of the component model
are copied as expected (see rule "component"). So it look like the
settings in the launch config and filenames etc. are correct.
I assume that I made some simple mistake, but can't spot the problem.
Maybe is there some special behaviour of allInstances() that I have to
take into account?
Thanks for any hints,
Goetz
----------- ATL FILE ------------------
module generateComponentModel;
create componentOut : COMPONENTMETA from settingsIn : SETTINGSMETA,
componentIn : COMPONENTMETA, scm : SCMMETA;
-- ---------------------------
-- Definition of visibility
-- ---------------------------
helper context COMPONENTMETA!Component def : isVisible() : Boolean =
let allComponents : Sequence(COMPONENTMETA!Component) =
COMPONENTMETA!Component -> From('componentIn') in
let allSettings : Sequence(SETTINGSMETA!Setting) =
SETTINGSMETA!Setting -> allInstancesFrom('settingsIn') in
let allSettingComponentMappings
:Sequence(SCMMETA!SettingComponentMapping) =
SCMMETA!SettingComponentMapping -> allInstancesFrom('scm') in
-- ***** HERE ***********
-- Here I would like to define the isVisible() function based
-- on the helper variables allComponents, allSettings, and
-- allSettingComponentMappings
-- however these are all empty
true
;
-- ---------------------------
-- Copy Rules
-- ---------------------------
rule componentsModel {
from s : COMPONENTMETA!ComponentsModel (
s.isVisible()
)
to t : COMPONENTMETA!ComponentsModel mapsTo s (
name <- s.name,
components <- s.components
)
}
rule component {
from s : COMPONENTMETA!Component (
s.isVisible()
)
to t : COMPONENTMETA!Component mapsTo s (
name <- s.name
)
}