[great-users] How to model: no. of created objects depends on srcmodel-attribute

Simon Görke simon.goerke at ils.uni-stuttgart.de
Mon Jun 18 06:40:49 CDT 2012


Hi there,

I intend to realize the following GREAT transformation:
- the source model contains a number of objects (GME atoms) of type A with
an integer-type attribute "count"
- the number of objects (type B atoms) to be instantiated in the destination
model depends on the number of a-type objects (no problem), but (problem)
also on the value of the "count"-attribute:

Considering one of the a-type objects found in the source model, this means
(a.count==1):  instantiate   1 type-B atom
(a.count==2):  instantiate   2 type-B atoms
               .
               .
               .
(a.count==x):  instantiate   x type-B atoms


Being a GREAT-newbie, I am not sure how to model this kind of
transformation. One idea might be recursion using an ExpressionRef-rule and
a (temporary) counter object in the "Global Container".
Question is: is there a more direct solution to this? I guess this class of
problem (attribute does not restrict the search pattern but induces multiple
(variable number of) instantiations) is not restricted to my task.

Regards
Simon



More information about the great-users mailing list