transformation with multiple inputs [message #1064131] |
Mon, 17 June 2013 18:30 |
Mahin Abbasipour Messages: 24 Registered: June 2013 |
Junior Member |
|
|
Hi,
In my transformation, I create an output model from two input uml models. In a part of the transformation, I have a rule that for each class in input model 1 that has Stereotype C1, it checks in the second input model if there is an association (AS) between this class and another class with stereotype C2. If so, then the association and the corresponding class will be added in the output.
I wrote the transformation like this, but the last condition is always false and it generates an empty model. What is my mistake?
rule check {
from
source: MM!Class, --C1 in Input M1
source1:MM1!Class, --C1 in Input M2
source2:MM1!Association, --AS
source3:MM1! Class --C2 in input M2
(source.getAppliedStereotypes()->collect(st |st.name)-> at(1)='C1'
and source1.getAppliedStereotypes()->collect(st |st.name)-> at(1)='C1'
and source.name = source1.name
and source3.getAppliedStereotypes()->collect(st |st.name)-> at(1)='C2'
and source2.getAppliedStereotypes()->collect(st |st.name)-> at(1)='AS'
and source2.memberEnd -> select(c|c.type.hasStereotype('C2'))-> notEmpty()
and source2.memberEnd -> collect (n|n.type)->debug ('membername:')-> includes (source->debug('source'))->debug ('result:')
)
to
target: MM2!Class (
name <- source.name ,
package <- source.package,
ownedAttribute<- source.ownedAttribute
),
t1: MM2! C1 (
base_Class <- target
),
target1: MM2! Class (
name <- source3.name ,
package <- source3.package,
ownedAttribute<- source3.ownedAttribute
),
target11: MM2! C2 (
base_Class <- target1
),
t2: MM2!Association (
name <- 'as',
package <- source2.package,
memberEnd<- Set{p1,p2},
ownedEnd <- source2.ownedEnd
),
t3: MM2!AS (
base_Association <- t2
),
p1: MM2!Property(
name<-'p1',
type<- target,
association<- t2
),
p2: MM2!Property(
name<-'p22',
type<- target1,
association<- t2
)
}
Thank you
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03073 seconds