Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] inverse function of refImmediateComposite()
[ATL] inverse function of refImmediateComposite() [message #88085] Mon, 11 August 2008 11:27 Go to next message
Eclipse UserFriend
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 12:35 Go to previous messageGo to next message
Eclipse UserFriend
..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 14:50 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: [ATL] inverse function of refImmediateComposite() [message #548475 is a reply to message #548425] Wed, 21 July 2010 23:37 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: [ATL] inverse function of refImmediateComposite() [message #548496 is a reply to message #88085] Thu, 22 July 2010 03:46 Go to previous message
Eclipse UserFriend
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 03:50] by Moderator

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


Current Time: Wed Jun 18 07:50:46 EDT 2025

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

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

Back to the top