module UMLToCLASS; -- Module Template
create OUT : CLASS from IN : UML;
helper context UML!Participant def: getName(): Set(String) =
self.bind->collect(e|e.name).asSet();
rule ParticipantToComponent
{
from
p :UML!Participant
to
c :CLASS!Component(name<-p.name),
s :CLASS!Service(provide<-prList),
prList:distinct DS!Tprovide foreach(prName in p.getName())
(name<-prName)
-- if (not prList.isEmpty()) then
-- do
-- {
-- c.service<-s;
-- }
-- else
-- false
-- endif
}
I am transforming Participant to Component.
I would like to add the binding c.service<-s if prList isNotEmpty else i
should not add this binding. (Something similar to the commented lines,
however this code does not work because i dont know what the return value
should be. Can anyone please suggest how i can write this binding rule
here.