Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] inverse function of refImmediateComposite()
[ATL] inverse function of refImmediateComposite() [message #88085] Mon, 11 August 2008 15:27 Go to next message
Ivano is currently offline IvanoFriend
Messages: 35
Registered: July 2009
Member
Hi all,
my question is pretty easy and basic:

Does a metamodel-independent inverse of the operation
RefImmediateComposite() exists??

i.e. an operation of the form refChildren() : Sequence(OclAny)
returning all the elements contained by self.

Regards,
Ivano
Re: [ATL] inverse function of refImmediateComposite() [message #88114 is a reply to message #88085] Mon, 11 August 2008 16:35 Go to previous messageGo to next message
Alfons Laarman is currently offline Alfons LaarmanFriend
Messages: 71
Registered: July 2009
Member
..eContents()

Regards,

Alfons

"Ivano" <ivanomalavolta@yahoo.it> schreef in bericht
news:g7plpi$qkd$1@build.eclipse.org...
> Hi all,
> my question is pretty easy and basic:
>
> Does a metamodel-independent inverse of the operation
> RefImmediateComposite() exists??
>
> i.e. an operation of the form refChildren() : Sequence(OclAny)
> returning all the elements contained by self.
>
> Regards,
> Ivano
Re: [ATL] inverse function of refImmediateComposite() [message #548425 is a reply to message #88085] Wed, 21 July 2010 18:50 Go to previous messageGo to next message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Member
What about a function that sets the immediate container of a model element?

What I'm doing is building a .uml file by means of a transformation. My source .uml file contains a <Model> element that, in turn, contains a <Class> element, so I want my .atl file to generate the corresponding <Model> and <Class> elements and to make the <Model> element to contain the <Class> element in the target .uml file. So far both elements seem to be unrelated and placed at the top level in the containment hierarchy of the target .uml file.

Thanks for your help. Kindest regards.


/TB
Re: [ATL] inverse function of refImmediateComposite() [message #548475 is a reply to message #548425] Thu, 22 July 2010 03:37 Go to previous messageGo to next message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Member
I found the solution to my problem. Once the transformation has instantiated the Model meta-class in the target .uml file it must instantiate the Class meta-class and set the containment relationship using the following code:

rule models {
	from
			source: profileA!Model
	to
			target: profileB!Model (
				name <- 'bclass_model'
			)
}

rule classes {
	from
			source: profileA!Class
	to
			target: profileB!Class (
				name <- 'Target',
				package <- source.package
			)
}


The setting of the package attribute does the trick to establish the containment relationship. Do not try to set either the owner or the namespace attributes of the metaclass because ATL considers this as an error, perhaps because such attributes are derived acording to the documentation,

Kindest regards.


/TB
Re: [ATL] inverse function of refImmediateComposite() [message #548496 is a reply to message #88085] Thu, 22 July 2010 07:46 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can also set the eOpposite reference to package so that you get the binding on the Model element instead of the Class element which is maybe more understandable but both works :

rule models {
	from
			source: profileA!Model
	to
			target: profileB!Model (
				name <- 'bclass_model',
				packagedElement <- source.packagedElement
			)
}

rule classes {
	from
			source: profileA!Class
	to
			target: profileB!Class (
				name <- 'Target'
			)
}

[Updated on: Thu, 22 July 2010 07:50]

Report message to a moderator

Previous Topic:XSD to ECORE Transformation
Next Topic:Possibility to have several levels in an XMI File?
Goto Forum:
  


Current Time: Fri Apr 26 00:41:27 GMT 2024

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

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

Back to the top