Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » profile application
profile application [message #987616] Tue, 27 November 2012 10:40 Go to next message
Claudio Persico is currently offline Claudio Persico
Messages: 24
Registered: November 2012
Junior Member
Hi to everyone,
I've read some interesting topic in this section and I'm trying to write a QVTo transformation among UML models with profiles applied. Can you give me some hints on how to do that? I successfully get the stereotypes from the input model but I'm not albe to apply a stereotype nor a profile to the output.

Tanks,
Claudio
Re: profile application [message #987688 is a reply to message #987616] Tue, 27 November 2012 15:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4061
Registered: July 2009
Senior Member
Hi

I'm afraid there are no canned examples (yet).

I assumed that this wouldn't be working but various correspondence on
this thread have had some success; I suggest reading related threads.

Note that QVTo has a special "*" stereotype syntax to augment meta-models.

Regards

Ed Willink

On 27/11/2012 13:05, Claudio Persico wrote:
> Hi to everyone,
> I've read some interesting topic in this section and I'm trying to
> write a QVTo transformation among UML models with profiles applied.
> Can you give me some hints on how to do that? I successfully get the
> stereotypes from the input model but I'm not albe to apply a
> stereotype nor a profile to the output.
>
> Tanks,
> Claudio
Re: profile application [message #987698 is a reply to message #987688] Tue, 27 November 2012 16:25 Go to previous message
Claudio Persico is currently offline Claudio Persico
Messages: 24
Registered: November 2012
Junior Member
Thanks for replying.
I read all profile application-like posts before writing. And I also agree that there are no available canned example around Smile So I will try to make one from scratch!
Let's assume I want to trasnform my model "ma" with profile application to a model "mb" with profile application.

My profile is simply a <<Stereotype>> S (wit a tagged value called "tag" of type String) extending a <<metaclass>> Class, as follows
<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="2.1" xmlns:xmi="hxxp://schema.omg.org/spec/XMI/2.1" xmlns:ecore="hxxp://www.eclipse.org/emf/2002/Ecore" xmlns:uml="hxxp://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_9dnWMDM6EeKfLM85cFWHUQ" name="profile" metaclassReference="__JHOsDM6EeKfLM85cFWHUQ">
  <eAnnotations xmi:id="_HYjVUTM7EeKfLM85cFWHUQ" source="hxxp://www.eclipse.org/uml2/2.0.0/UML">
    <contents xmi:type="ecore:EPackage" xmi:id="_cxTbkTM7EeKfLM85cFWHUQ" name="profile" nsURI="hxxp:///schemas/profile/_cxTbkDM7EeKfLM85cFWHUQ/1" nsPrefix="profile">
      <eAnnotations xmi:id="_cxUCoDM7EeKfLM85cFWHUQ" source="PapyrusVersion">
        <details xmi:id="_cxUCoTM7EeKfLM85cFWHUQ" key="Version" value="0.0.2"/>
        <details xmi:id="_cxUCojM7EeKfLM85cFWHUQ" key="Comment" value=""/>
        <details xmi:id="_cxUCozM7EeKfLM85cFWHUQ" key="Copyright" value=""/>
        <details xmi:id="_cxUCpDM7EeKfLM85cFWHUQ" key="Date" value="2012-11-20"/>
        <details xmi:id="_cxUCpTM7EeKfLM85cFWHUQ" key="Author" value=""/>
      </eAnnotations>
      <eClassifiers xmi:type="ecore:EClass" xmi:id="_cxTbkjM7EeKfLM85cFWHUQ" name="S">
        <eAnnotations xmi:id="_cxTbkzM7EeKfLM85cFWHUQ" source="hxxp://www.eclipse.org/uml2/2.0.0/UML" references="__hB_cDM6EeKfLM85cFWHUQ"/>
        <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_cxTblDM7EeKfLM85cFWHUQ" name="base_Class" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EClass" href="hxxp://www.eclipse.org/uml2/3.0.0/UML#//Class"/>
        </eStructuralFeatures>
        <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_cxTbljM7EeKfLM85cFWHUQ" name="tag" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EDataType" href="hxxp://www.eclipse.org/emf/2002/Ecore#//EString"/>
        </eStructuralFeatures>
      </eClassifiers>
    </contents>
    <contents xmi:type="ecore:EPackage" xmi:id="_HYj8YDM7EeKfLM85cFWHUQ" name="profile" nsURI="hxxp:///schemas/profile/_HYjVUDM7EeKfLM85cFWHUQ/0" nsPrefix="profile">
      <eAnnotations xmi:id="_HYkjcDM7EeKfLM85cFWHUQ" source="PapyrusVersion">
        <details xmi:id="_HYkjcTM7EeKfLM85cFWHUQ" key="Version" value="0.0.1"/>
        <details xmi:id="_HYkjcjM7EeKfLM85cFWHUQ" key="Comment" value=""/>
        <details xmi:id="_HYkjczM7EeKfLM85cFWHUQ" key="Copyright" value=""/>
        <details xmi:id="_HYkjdDM7EeKfLM85cFWHUQ" key="Date" value="2012-11-20"/>
        <details xmi:id="_HYkjdTM7EeKfLM85cFWHUQ" key="Author" value=""/>
      </eAnnotations>
      <eClassifiers xmi:type="ecore:EClass" xmi:id="_HYj8YTM7EeKfLM85cFWHUQ" name="S">
        <eAnnotations xmi:id="_HYj8YjM7EeKfLM85cFWHUQ" source="hxxp://www.eclipse.org/uml2/2.0.0/UML" references="__hB_cDM6EeKfLM85cFWHUQ"/>
        <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_HYj8YzM7EeKfLM85cFWHUQ" name="base_Class" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EClass" href="hxxp://www.eclipse.org/uml2/3.0.0/UML#//Class"/>
        </eStructuralFeatures>
        <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_HYj8ZTM7EeKfLM85cFWHUQ" name="name" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EDataType" href="hxxp://www.eclipse.org/emf/2002/Ecore#//EString"/>
        </eStructuralFeatures>
      </eClassifiers>
    </contents>
  </eAnnotations>
  <elementImport xmi:id="__JHOsDM6EeKfLM85cFWHUQ" alias="Class">
    <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
  </elementImport>
  <packageImport xmi:id="_EePgUDM7EeKfLM85cFWHUQ">
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
  </packageImport>
  <packagedElement xmi:type="uml:Stereotype" xmi:id="__hB_cDM6EeKfLM85cFWHUQ" name="S">
    <ownedAttribute xmi:id="_AZn0UDM7EeKfLM85cFWHUQ" name="base_Class" association="_AZn0UTM7EeKfLM85cFWHUQ">
      <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
    </ownedAttribute>
    <ownedAttribute xmi:id="_A0NekDM7EeKfLM85cFWHUQ" name="tag">
      <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Extension" xmi:id="_AZn0UTM7EeKfLM85cFWHUQ" name="E_S_Class1" memberEnd="_AZn0UjM7EeKfLM85cFWHUQ _AZn0UDM7EeKfLM85cFWHUQ">
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_AZn0UjM7EeKfLM85cFWHUQ" name="extension_S" type="__hB_cDM6EeKfLM85cFWHUQ" aggregation="composite" association="_AZn0UTM7EeKfLM85cFWHUQ"/>
  </packagedElement>
</uml:Profile>


And my model "ma" is a simple class X with stereotype applyed <<S>>, as follows

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="hxxp://schema.omg.org/spec/XMI/2.1" xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="hxxp://www.eclipse.org/emf/2002/Ecore" xmlns:profile="hxxp:///schemas/profile/_cxTbkDM7EeKfLM85cFWHUQ/1" xmlns:uml="hxxp://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="hxxp:///schemas/profile/_cxTbkDM7EeKfLM85cFWHUQ/1 dumbprofile.profile.uml#_cxTbkTM7EeKfLM85cFWHUQ">
  <uml:Model xmi:id="_KbgTgDM8EeKfLM85cFWHUQ" name="model">
    <packagedElement xmi:type="uml:Class" xmi:id="_S6WIEDM8EeKfLM85cFWHUQ" name="X"/>
    <profileApplication xmi:id="_SRG90DM8EeKfLM85cFWHUQ">
      <eAnnotations xmi:id="_SRsMoDM8EeKfLM85cFWHUQ" source="hxxp://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="dumbprofile.profile.uml#_cxTbkTM7EeKfLM85cFWHUQ"/>
      </eAnnotations>
      <appliedProfile href="dumbprofile.profile.uml#_9dnWMDM6EeKfLM85cFWHUQ"/>
    </profileApplication>
  </uml:Model>
  <profile:S xmi:id="_UYTT0DM8EeKfLM85cFWHUQ" base_Class="_S6WIEDM8EeKfLM85cFWHUQ" tag="name"/>
</xmi:XMI>


I wrote a very simple code for transformation

modeltype UML uses 'hxxp://www.eclipse.org/uml2/3.0.0/UML';

transformation NewTransformation(in ma : UML, out mb : UML);

main() {
	
	ma.rootObjects()[UML::Model]->map toModel();
	
}

mapping UML::Model::toModel() : UML::Model {
	name := 'Model';
	 
	 packagedElement += self.ownedElement[Class]->map toClass();
	 

}

mapping UML::Class::toClass() : UML::Class {
	name := 'ClassName';
	var stereo : Stereotype := self.getAppliedStereotypes()->any(true);
	log(stereo.name); --this Works
	
	
}


Note that there are hxxp instead of http.

Now I'm asking how to have a profile application and a stereotype in my output model.

I tried to be as clear as possible, but if I didn't please ask.

Tanks,
Claudio
Previous Topic:Additional QVTo features
Next Topic:QVT-o and Aspect-oriented style...
Goto Forum:
  


Current Time: Thu Oct 02 02:26:39 GMT 2014

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

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