Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Applying Stereotype to model element
Applying Stereotype to model element [message #1062597] Sun, 09 June 2013 16:34 Go to next message
Thorsten Koch is currently offline Thorsten Koch
Messages: 3
Registered: June 2013
Junior Member
Hi,

I am facing a strange behavior of QVT-O when executing a transformation.
In this in-place transformation, I want to apply a stereotype to a model element. If I run the transformation in the debug-mode, the stereotype is applied correctly. If I run the transformation in the normal-mode, it seems as if the stereotype is applied correctly, but actually in the resulting uml model it is not applied.

Is there any reason for this behavior ?

Unfortunately, I am not allowed to attach files, so I will post the transformation, the profile, and the input-model in the following.

If you need further information please let me know.

Thank you in advance for your help.

The qvt-o transformation:
modeltype UML uses 'XXXX://www.eclipse.org/uml2/4.0.0/UML';

transformation PostProcessingTransformation(inout model:UML);

main() {
	model.objects()[Comment]-> map transformComment();	
}

mapping Comment::transformComment(){
	self.getApplicableStereotypes() -> forEach(stereotype){
		self.applyStereotype(stereotype);
	};
}



The uml profile:
<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="20110701" xmlns:xmi="XXXX://www.omg.org/spec/XMI/20110701" xmlns:ecore="XXX://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_gQJ_YNDsEeKkjoP3cZvJTg" name="Profile" metaclassReference="_k3_GINDsEeKkjoP3cZvJTg" metamodelReference="_gQJ_YdDsEeKkjoP3cZvJTg">
  <eAnnotations xmi:id="_p2IbINDsEeKkjoP3cZvJTg" source="http://www.eclipse.org/uml2/2.0.0/UML">
    <contents xmi:type="ecore:EPackage" xmi:id="_p2IbIdDsEeKkjoP3cZvJTg" name="Profile" nsURI="XXXX:///schemas/Profile/_p2Gl8NDsEeKkjoP3cZvJTg/0" nsPrefix="Profile">
      <eAnnotations xmi:id="_p2KQUNDsEeKkjoP3cZvJTg" source="PapyrusVersion">
        <details xmi:id="_p2KQUdDsEeKkjoP3cZvJTg" key="Version" value="0.0.1"/>
        <details xmi:id="_p2KQUtDsEeKkjoP3cZvJTg" key="Comment" value=""/>
        <details xmi:id="_p2KQU9DsEeKkjoP3cZvJTg" key="Copyright" value=""/>
        <details xmi:id="_p2KQVNDsEeKkjoP3cZvJTg" key="Date" value="2013-06-09"/>
        <details xmi:id="_p2KQVdDsEeKkjoP3cZvJTg" key="Author" value="Thorsten Koch"/>
      </eAnnotations>
      <eClassifiers xmi:type="ecore:EClass" xmi:id="_p2IbItDsEeKkjoP3cZvJTg" name="Stereotype1">
        <eAnnotations xmi:id="_p2IbI9DsEeKkjoP3cZvJTg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_lUHogNDsEeKkjoP3cZvJTg"/>
        <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_p2IbJNDsEeKkjoP3cZvJTg" name="base_Comment" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Comment"/>
        </eStructuralFeatures>
      </eClassifiers>
      <eClassifiers xmi:type="ecore:EClass" xmi:id="_p2IbJtDsEeKkjoP3cZvJTg" name="Stereotype2">
        <eAnnotations xmi:id="_p2IbJ9DsEeKkjoP3cZvJTg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_mTbJYNDsEeKkjoP3cZvJTg"/>
        <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_p2IbKNDsEeKkjoP3cZvJTg" name="base_Comment" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Comment"/>
        </eStructuralFeatures>
      </eClassifiers>
      <eClassifiers xmi:type="ecore:EClass" xmi:id="_p2IbKtDsEeKkjoP3cZvJTg" name="Stereotype3">
        <eAnnotations xmi:id="_p2IbK9DsEeKkjoP3cZvJTg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_nBUxMNDsEeKkjoP3cZvJTg"/>
        <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_p2IbLNDsEeKkjoP3cZvJTg" name="base_Comment" ordered="false" lowerBound="1">
          <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Comment"/>
        </eStructuralFeatures>
      </eClassifiers>
    </contents>
  </eAnnotations>
  <elementImport xmi:id="_k3_GINDsEeKkjoP3cZvJTg" alias="Comment">
    <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Comment"/>
  </elementImport>
  <packageImport xmi:id="_gQJ_YdDsEeKkjoP3cZvJTg">
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
  </packageImport>
  <packageImport xmi:id="_gQJ_YtDsEeKkjoP3cZvJTg">
    <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
  </packageImport>
  <packagedElement xmi:type="uml:Stereotype" xmi:id="_lUHogNDsEeKkjoP3cZvJTg" name="Stereotype1">
    <ownedAttribute xmi:id="_n3aEoNDsEeKkjoP3cZvJTg" name="base_Comment" association="_n3arsNDsEeKkjoP3cZvJTg">
      <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Comment"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Stereotype" xmi:id="_mTbJYNDsEeKkjoP3cZvJTg" name="Stereotype2">
    <ownedAttribute xmi:id="_ol_o8NDsEeKkjoP3cZvJTg" name="base_Comment" association="_ol_o8dDsEeKkjoP3cZvJTg">
      <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Comment"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Stereotype" xmi:id="_nBUxMNDsEeKkjoP3cZvJTg" name="Stereotype3">
    <ownedAttribute xmi:id="_oRdjYNDsEeKkjoP3cZvJTg" name="base_Comment" association="_oReKcNDsEeKkjoP3cZvJTg">
      <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Comment"/>
    </ownedAttribute>
  </packagedElement>
  <packagedElement xmi:type="uml:Extension" xmi:id="_n3arsNDsEeKkjoP3cZvJTg" name="E_Stereotype1_Comment1" memberEnd="_n3arsdDsEeKkjoP3cZvJTg _n3aEoNDsEeKkjoP3cZvJTg">
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_n3arsdDsEeKkjoP3cZvJTg" name="extension_Stereotype1" type="_lUHogNDsEeKkjoP3cZvJTg" aggregation="composite" association="_n3arsNDsEeKkjoP3cZvJTg"/>
  </packagedElement>
  <packagedElement xmi:type="uml:Extension" xmi:id="_oReKcNDsEeKkjoP3cZvJTg" name="E_Stereotype3_Comment1" memberEnd="_oReKcdDsEeKkjoP3cZvJTg _oRdjYNDsEeKkjoP3cZvJTg">
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_oReKcdDsEeKkjoP3cZvJTg" name="extension_Stereotype3" type="_nBUxMNDsEeKkjoP3cZvJTg" aggregation="composite" association="_oReKcNDsEeKkjoP3cZvJTg"/>
  </packagedElement>
  <packagedElement xmi:type="uml:Extension" xmi:id="_ol_o8dDsEeKkjoP3cZvJTg" name="E_Stereotype2_Comment1" memberEnd="_ol_o8tDsEeKkjoP3cZvJTg _ol_o8NDsEeKkjoP3cZvJTg">
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_ol_o8tDsEeKkjoP3cZvJTg" name="extension_Stereotype2" type="_mTbJYNDsEeKkjoP3cZvJTg" aggregation="composite" association="_ol_o8dDsEeKkjoP3cZvJTg"/>
  </packagedElement>
</uml:Profile>


The input model
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="20110701" xmlns:xmi="XXXX://www.omg.org/spec/XMI/20110701" xmlns:ecore="XXXX://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_daUAkNEhEeKkjoP3cZvJTg" name="Model">
  <packagedElement xmi:type="uml:Package" xmi:id="_daUAkdEhEeKkjoP3cZvJTg" name="Interaction1">
    <ownedComment xmi:id="_daUAktEhEeKkjoP3cZvJTg">
      <body>Stereotype3;</body>
    </ownedComment>
    <ownedComment xmi:id="_daUAk9EhEeKkjoP3cZvJTg">
      <body>Stereotype1;</body>
    </ownedComment>
    <packagedElement xmi:type="uml:Class" xmi:id="_daUAlNEhEeKkjoP3cZvJTg" name="Lifeline"/>
    <packagedElement xmi:type="uml:Class" xmi:id="_daUAldEhEeKkjoP3cZvJTg" name="Lifeline2"/>
    <packagedElement xmi:type="uml:Class" xmi:id="_daUAltEhEeKkjoP3cZvJTg" name="Lifeline1"/>
    <packagedElement xmi:type="uml:Class" xmi:id="_daUAl9EhEeKkjoP3cZvJTg" name="Lifeline0"/>
    <profileApplication xmi:id="_daUAmNEhEeKkjoP3cZvJTg">
      <eAnnotations xmi:id="_daUAmdEhEeKkjoP3cZvJTg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="../profile/model.profile.uml#_p2IbIdDsEeKkjoP3cZvJTg"/>
      </eAnnotations>
      <appliedProfile href="../profile/model.profile.uml#_gQJ_YNDsEeKkjoP3cZvJTg"/>
    </profileApplication>
  </packagedElement>
</uml:Model>


[Updated on: Mon, 10 June 2013 13:02]

Report message to a moderator

Re: Applying Stereotype to model element [message #1062943 is a reply to message #1062597] Tue, 11 June 2013 13:48 Go to previous messageGo to next message
Thorsten Koch is currently offline Thorsten Koch
Messages: 3
Registered: June 2013
Junior Member
I continued testing and found another inconsistency between the run and the debug mode regarding the application of stereotypes.

I used the following transformation:
modeltype UML uses uml('http://www.eclipse.org/uml2/4.0.0/UML');

transformation NewTransformation1(in SysMLProfile : UML, out model : UML);

main() {
	var prof : Profile := SysMLProfile.objectsOfType(Profile)![name = "PortAndFlows"];
	var stereo : Stereotype = SysMLProfile.objectsOfType(Stereotype)![name = "FlowPort"];
	assert fatal (prof = stereo.profile);
	
	var model : Model := object Model {name := 'model'};
	var cls : Class := object Class {name := 'class'};
	model.ownedType += cls;
	var prop : Property := object Port {name := 'prop'};
	cls.ownedAttribute += prop;

	model.applyProfile(stereo.profile);
	
	prop.getApplicableStereotypes()-> forEach(stereotype){
		log("applicable stereotype:", stereotype.name);
	};
	
	prop.applyStereotype(stereo);
	
	prop.getAppliedStereotypes()-> forEach(stereotype){
		log("applied stereotype:", stereotype.name);
	};
}


If I run this transformation run in the debug mode, I get the following logging output:
applicable stereotype:, data: FlowProperty
applicable stereotype:, data: FlowPort
Diagnostic OK source=org.eclipse.m2m.qvt.oml.execution code=0 OK data=[]
[QVTO Stack trace:]


And if the run it in the normal mode, I get the following logging output:
applicable stereotype:, data: FlowProperty
applicable stereotype:, data: FlowPort
applied stereotype:, data: FlowPort


As the logging output indicates, the stereotype is applied only once.
Re: Applying Stereotype to model element [message #1062974 is a reply to message #1062943] Tue, 11 June 2013 14:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4045
Registered: July 2009
Senior Member
Hi

Please raise a Bugzilla.

Regards

Ed Willink


On 11/06/2013 14:48, Thorsten Koch wrote:
> I continued testing and found another inconsistency between the run
> and the debug mode regarding the application of stereotypes.
>
> I used the following transformation:
>
> modeltype UML uses uml('http://www.eclipse.org/uml2/4.0.0/UML');
>
> transformation NewTransformation1(in SysMLProfile : UML, out model :
> UML);
>
> main() {
> var prof : Profile := SysMLProfile.objectsOfType(Profile)![name =
> "PortAndFlows"];
> var stereo : Stereotype =
> SysMLProfile.objectsOfType(Stereotype)![name = "FlowPort"];
> assert fatal (prof = stereo.profile);
>
> var model : Model := object Model {name := 'model'};
> var cls : Class := object Class {name := 'class'};
> model.ownedType += cls;
> var prop : Property := object Port {name := 'prop'};
> cls.ownedAttribute += prop;
>
> model.applyProfile(stereo.profile);
>
> prop.getApplicableStereotypes()-> forEach(stereotype){
> log("applicable stereotype:", stereotype.name);
> };
>
> prop.applyStereotype(stereo);
>
> prop.getAppliedStereotypes()-> forEach(stereotype){
> log("applied stereotype:", stereotype.name);
> };
> }
>
>
> If I run this transformation run in the debug mode, I get the
> following logging output:
>
> applicable stereotype:, data: FlowProperty
> applicable stereotype:, data: FlowPort
> Diagnostic OK source=org.eclipse.m2m.qvt.oml.execution code=0 OK data=[]
> [QVTO Stack trace:]
>
>
> And if the run it in the normal mode, I get the following logging output:
>
> applicable stereotype:, data: FlowProperty
> applicable stereotype:, data: FlowPort
> applied stereotype:, data: FlowPort
>
>
> As the logging output indicates, the stereotype is applied only once.
Re: Applying Stereotype to model element [message #1064215 is a reply to message #1062974] Tue, 18 June 2013 10:06 Go to previous message
Thorsten Koch is currently offline Thorsten Koch
Messages: 3
Registered: June 2013
Junior Member
Here is the link to the bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=410511
Previous Topic:Can a mapping call itself?
Next Topic:Shortcut for subpackages?
Goto Forum:
  


Current Time: Tue Sep 16 17:45:14 GMT 2014

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

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