I define an helper that returns a Sequence a an element: helper ............... : Sequence(MM!FiacreProcessName),
but the problem that is not is the best form, so the returned form is like this :
<port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name //@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>
but I'd have the result like this
<port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name/>
<port="//@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>
this is the rule
rule FiacreLabelType2FiacreLabelType {
from
fiacre_label_type_ins : InstancieMetaModel!FiacreLabelType(fiacre_label_type_ins.oclIsTypeOf(InstancieMetaModel!FiacreLabelType))
to
fiacre_label_type_lie : LieMetaModel!FiacreLabelType(
name <- fiacre_label_type_ins.name,
ports <- thisModule.getPort(fiacre_label_type_ins.name)
)
}
ports is a reference 0..*
and this is the helper
helper def : getPort(labelName : String) : Set(InstancieMetaModel!FiacreProcessName) =
let alltransitions : Sequence(InstancieMetaModel!Transition) =
InstancieMetaModel!Transition.allInstances().asSequence() in
alltransitions->iterate(t; y : InstancieMetaModel!Transition = alltransitions->first() |
if t.label.name = labelName
then
t
else
y
endif
).processID->collect(e|e.fiacre_process_name)
;
please help me
thanks
[Updated on: Fri, 22 July 2011 05:50] by Moderator