Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » UML primitive types(Set a type to a UML primitive type during a transformation)
UML primitive types [message #1736120] Sun, 26 June 2016 19:43 Go to next message
Jeni Martin is currently offline Jeni MartinFriend
Messages: 42
Registered: November 2012

I have an ATL transformation which takes an input model. The input model is an instance of a previously created UML profile called MM1. The transformation transforms the input model to an output model which it is an instance of another UML profile called MM2.
During the transformation, for a transformed class in the output model, I want to create an operation. For the created operation, I need to specify the parameters and their types. I was unable to set the type to Integer. Does any one know how I can set the type to a UML primitive type when the model is an instance of a profile?

Thank you very much.
Re: UML primitive types [message #1737203 is a reply to message #1736120] Wed, 06 July 2016 12:18 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 379
Registered: September 2012
Location: Belgium
Senior Member

You can refer to the UMLPrimitiveTypes library model for that: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml

Here's some example code (using EMFTVM) that adds one extra property of type Integer to each Stereotype:
-- @atlcompiler emftvm
-- @nsURI UML=
module AddStereotypeAttribute;

create MM2 : UML from MM1 : UML, PT : UML;

helper def : IntegerType : UML!PrimitiveType =
	UML!PrimitiveType.allInstancesFrom('PT')->any(p | = 'Integer');

rule Profile {
		s : UML!Profile
		t : UML!Profile (
			name <-,
			packageImport <- s.packageImport,
			packagedElement <- s.packagedElement

rule PackageImport {
		s : UML!PackageImport
		t : UML!PackageImport (
			importedPackage <- s.importedPackage

rule Stereotype {
		s : UML!Stereotype
		t : UML!Stereotype (
			name <-,
			ownedAttribute <- s.ownedAttribute->including(p)
		p : UML!Property (
			name <- 'Bonus',
			type <- thisModule.IntegerType

rule Property {
		s : UML!Property
		t : UML!Property (
			name <-,
        	type <- s.type,
        	upperValue <- s.upperValue,
        	lowerValue <- s.lowerValue

I've attached an example Eclipse project that you can actually run.

Previous Topic:2 models to model transformation
Next Topic:Can't use lazy rules with EMFTVM in Refining mode
Goto Forum:

Current Time: Mon Oct 22 11:37:30 GMT 2018

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

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

Back to the top