Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » incomplete output because containment reference
incomplete output because containment reference [message #759832] Wed, 30 November 2011 09:11 Go to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
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 #759838 is a reply to message #759832] Wed, 30 November 2011 09:31 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Use a lazy rule instead for the second rule
Re: incomplete output because containment reference [message #762080 is a reply to message #759838] Wed, 07 December 2011 14:17 Go to previous messageGo to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
Thank you Sylvain
It works
Re: incomplete output because containment reference [message #775102 is a reply to message #762080] Thu, 05 January 2012 10:24 Go to previous message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
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 ?
Previous Topic:[ATL] ATL life console
Next Topic:[QVTo] Unit not found while executing qvto in own application
Goto Forum:
  


Current Time: Tue Oct 08 21:57:36 GMT 2024

Powered by FUDForum. Page generated in 0.05155 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top