| One to many transformation [message #911862] |
Wed, 12 September 2012 09:16  |
Cristiano De Faveri Messages: 13 Registered: August 2012 |
Junior Member |
|
|
Hi All,
I have a scenario which a target model should create a sequence of classes due to the list of Strings another class holds.
The code snippet below illustrates the problem. I have FindClause which has bindingObjects whichs holds a list of aliases (EStrings).
For each Aliases I have to create a ObjectSource class which alias will be each FindClause.bindingObject.Alias of the list and className will be an String according to the type attribute of BindingObject.
I started a rule Find2From and created a helper to return the className based on FindClause.bindingObject.type, however how to fill alias attribute based on the FindClause.bindingObject.alias list ?
Many thanks in advance.
**** INModel ****
+-FindClause (clause : EString, bindingObject : BindingObject (1..*))
+-BindingObject (type : ObjectType, alias : EString (1..*))
+-ObjectType ( value : EString)
*******OUTModel*******
+-FromClause (clause : EString, objectList : ObjectSource (1.*))
+-ObjectSource(alias : EString, className : EString)
rule Find2From {
from
findClause : ajqlModel!FindClause
to
fromClause : hqlModel!FromClause (
clause <- 'From',
ObjectSource <- Sequence {source}
)
source : hqlModel!ObjectSource (
-- className <- thisModule.getObjectName(findClause.bindingObject.type)
-- alias <- ?[/color]??
)
}
|
|
|