Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Transform UML models with applied profile
Transform UML models with applied profile [message #1856702] Fri, 23 December 2022 13:13 Go to next message
Klarise Hund is currently offline Klarise HundFriend
Messages: 22
Registered: October 2022
Junior Member
Hi,

I am trying transform UML models to which I have applied a profile to instances of ecore models.
For some mapping operations, I need some mapping conditions.

For example:
modeltype profile uses '...';
modeltype target uses '...';
modeltype uml uses 'http://www.eclipse.org/uml2/3.0.0/UML';
....
mapping uml :: PackageableElement :: PE2Element1) : target :: Element1
{
result.name := self.name;
}


Now, this mapping operation should take place only if the StereotypeElement1 stereotype has been applied to the PackageableElement.
How would I go about writing the condition to do that?

In the following, I also provide part of the uml model that will be transformed.
  
<uml:Package xmi:id="_mKmYkH1fEe2iL8nfRIbyXQ" name="HelloWorld">
  ...
<packagedElement xmi:type="uml:Class" xmi:id="_mKrREH1fEe2iL8nfRIbyXQ" name="Test">
     <eAnnotations xmi:id="_mLDrkH1fEe2iL8nfRIbyXQ" source="uml2.diagrams" references="_mLDrkX1fEe2iL8nfRIbyXQ">
       <contents xmi:type="umlnotation:UMLDiagram" xmi:id="_mLDrkX1fEe2iL8nfRIbyXQ" type="Structure" element="_mKrREH1fEe2iL8nfRIbyXQ" measurementUnit="Himetric">
         <children xmi:type="umlnotation:UMLShape" xmi:id="_mLDrkn1fEe2iL8nfRIbyXQ" type="StructureDiagramFrame" element="_mKrREH1fEe2iL8nfRIbyXQ" fontName=".AppleSystemUIFont" fontHeight="8" transparency="0" lineColor="14263149" lineWidth="1" showStereotype="Label">
           <children xmi:type="umlnotation:UMLShapeCompartment" xmi:id="_mLDrk31fEe2iL8nfRIbyXQ" type="StructureCompartment"/>
           <children xmi:type="notation:BasicDecorationNode" xmi:id="_mLDrlH1fEe2iL8nfRIbyXQ" type="Name"/>
           <layoutConstraint xmi:type="notation:Bounds" xmi:id="_mLDrlX1fEe2iL8nfRIbyXQ" x="1058" y="1058"/>
         </children>
       </contents>
     </eAnnotations>
     ......
</packagedElement>
....
</uml:Package>
<Default:DefaultLanguage xmi:id="_mKmYpn1fEe2iL8nfRIbyXQ" base_Package="_mKmYkH1fEe2iL8nfRIbyXQ" defaultLanguage="DL"/>
<Profile:StereotypeElement1' xmi:id="_mK56kH1fEe2iL8nfRIbyXQ" base_Class="_mKrREH1fEe2iL8nfRIbyXQ"/>

Re: Transform UML models with applied profile [message #1856715 is a reply to message #1856702] Sat, 24 December 2022 05:58 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Unfortunately QVTo still uses the Classic OCL that, just like the OCL specification, lacks clear typesafe support for UML Stereotypes.

(The newer Pivot-based OCL extrapolates hints in the sole example of the UML2 specification to make usage much simpler.)

So you must fall back on the UML2 project Java API with operations such as getAppliedStereotypes and oclAsType casts,. You can find examples of e.g. getAppliedStereotype in

https://git.eclipse.org/r/plugins/gitiles/ocl/org.eclipse.ocl/+/refs/heads/master/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/qvto/UML2EcoreSynthesizer.qvto

Regards

Ed Willink

[Updated on: Sat, 24 December 2022 05:59]

Report message to a moderator

Previous Topic:EPX to Ecore and EMX to Xtext instances
Next Topic:QVTo transformation with Xtext target models
Goto Forum:
  


Current Time: Thu Apr 18 10:49:39 GMT 2024

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

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

Back to the top