|
Re: UML primitive types [message #1737203 is a reply to message #1736120] |
Wed, 06 July 2016 12:18 |
|
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=http://www.eclipse.org/uml2/5.0.0/UML
module AddStereotypeAttribute;
create MM2 : UML from MM1 : UML, PT : UML;
helper def : IntegerType : UML!PrimitiveType =
UML!PrimitiveType.allInstancesFrom('PT')->any(p | p.name = 'Integer');
rule Profile {
from
s : UML!Profile
to
t : UML!Profile (
name <- s.name,
packageImport <- s.packageImport,
packagedElement <- s.packagedElement
)
}
rule PackageImport {
from
s : UML!PackageImport
to
t : UML!PackageImport (
importedPackage <- s.importedPackage
)
}
rule Stereotype {
from
s : UML!Stereotype
to
t : UML!Stereotype (
name <- s.name,
ownedAttribute <- s.ownedAttribute->including(p)
),
p : UML!Property (
name <- 'Bonus',
type <- thisModule.IntegerType
)
}
rule Property {
from
s : UML!Property
to
t : UML!Property (
name <- s.name,
type <- s.type,
upperValue <- s.upperValue,
lowerValue <- s.lowerValue
)
}
I've attached an example Eclipse project that you can actually run.
Cheers,
Dennis
|
|
|
Powered by
FUDForum. Page generated in 0.03102 seconds