incomplete output because containment reference [message #759832] |
Wed, 30 November 2011 04:11  |
Eclipse User |
|
|
|
Hi All,
I have a simple transformation like this
rule Person2Student{
from
person : PersonMM!Person(person.age < 26)
to
student : StudentMM!Student(
name <- person.name --attribute
has_adress <-person.has_adress -- reference Person ----- 1..* : has_adress ----> Home
)
}
rule Home2Adress{){
from
home : PersonMM!Home
to
adress : StudentMM!Adress(
adress <- home.adress
)
}
the has_adress reference is defined with containment = true.
and sometimes I have some students that have the same adress
So, my output model is generated incomplete for first students that have the same adress.
For example, StudentA and StudentB have the same adress,
So, in the generated output, the first hasn't an adress
I understand that is because the containment=true
but how resolve this problem while keeping containment=true
Thanks
|
|
|
|
|
Re: incomplete output because containment reference [message #775102 is a reply to message #762080] |
Thu, 05 January 2012 05:24  |
Eclipse User |
|
|
|
Hi All,
after resolving problem with the lazy rule,
I have now an another problem:
I add an if expression in :
has_adress <-if person.has_adress.oclIsTypeOf(PersonMM!HOME) then person.has_adress else OclUndefined endif
has_adress is a reference that containment = true
So, for the first element, it works but, for following elements, the if expression returs a false because the type become OclAny and not the good Type.
I think after the first assignment, the element or its type is lost.
How resolve this problem ?
|
|
|
Powered by
FUDForum. Page generated in 0.25613 seconds