Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » problem adding an association property to ownedAttribute
problem adding an association property to ownedAttribute [message #897518] Tue, 24 July 2012 07:27 Go to next message
Martin Benedict is currently offline Martin Benedict
Messages: 22
Registered: June 2012
Junior Member
My target model is the eclipse UML2 mm.
The navigable ends of the associations must be contained in the ownedAttribute-property of the classes the association references. I don't know how I have to write this down. Perhaps I have to use resoleTemp, but I haven't understood how it works, yet.

Code is the following:

rule ClassToClass{
	from
		c1: HL7!HL7Class
	to
		c2: UML!Class (
			name <- c1.name,
                        ownedAttribute <- --here the property p2 the association should appear
		)

}

from
	a: HL7!HL7Association
	
	to
		as: UML!Association (
			name <- a.name,
			ownedEnd <- Set{p1},
			memberEnd <- Set{p2}
		),
		p1: UML!Property (
			name <- a.associationEnds.first().name,
			type <- a.associationEnds.first().connectedClass
		),
		p2: UML!Property (
			name <- a.associationEnds.last().name,
			type <- a.associationEnds.last().connectedClass
		)
}



How would I add p2 to ownedAttribute in the class rule?

I would be happy if anybody could help me. Thanks in advance

[Updated on: Tue, 24 July 2012 07:30]

Report message to a moderator

Re: problem adding an association property to ownedAttribute [message #897732 is a reply to message #897518] Wed, 25 July 2012 03:47 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 511
Registered: July 2009
Senior Member
If a.associationEnds.first().connectedClass is the corresponding HL7!HL7Class.
Then you'd do in the do section :
do{
thisModule.resolveTemp(a.associationEnds.first().connectedClass,'c2').ownedAttribute.append(p2);
}
Re: problem adding an association property to ownedAttribute [message #899964 is a reply to message #897732] Fri, 03 August 2012 05:03 Go to previous message
Martin Benedict is currently offline Martin Benedict
Messages: 22
Registered: June 2012
Junior Member
This works for me. Thank you very much!
Previous Topic:Getting the current rule's name
Next Topic:Could not debug, because UTFDataFormatException is thrown when reaching breakpoint
Goto Forum:
  


Current Time: Sun Apr 20 12:23:31 EDT 2014

Powered by FUDForum. Page generated in 0.03003 seconds