Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » problem to access to applied profiles on UML elements with Acceleo(when a request the applied stereotypes on some elements , I receive an empty set )
problem to access to applied profiles on UML elements with Acceleo [message #1816872] Sat, 09 November 2019 11:18 Go to next message
berrehouma Nabil is currently offline berrehouma NabilFriend
Messages: 2
Registered: December 2010
Junior Member
Hello
I have a project to generate a c ++ code from an extended UML model with the Sysml profile using acceleo M2T tool. My problem is that I can not access the profiles applied to the elements of my model.

this is my acceleo query

[comment encoding = UTF-8 /]
[module generate_process('http://www.eclipse.org/uml2/5.0.0/UML','http://www.eclipse.org/uml2/5.0.0/Types','http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard', 'http://www.eclipse.org/papyrus/sysml/1.4/SysML','http://www.eclipse.org/papyrus/sysml/1.4/SysML/DeprecatedElements')]

.....

[query public getTaggedValue(stereotypedElement : Element, stereotypeName : String, propertyName : String) : OclAny = 
   let stereotype : Stereotype = stereotypedElement.getAppliedStereotype(stereotypeName) in
     if not stereotype.oclIsUndefined() then
       stereotypedElement.getValue(stereotype, propertyName)
     else 
       null
     endif/]



and below my UML model
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:DeprecatedElements="http://www.eclipse.org/papyrus/sysml/1.4/SysML/DeprecatedElements" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/sysml/1.4/SysML/DeprecatedElements http://www.eclipse.org/papyrus/sysml/1.4/SysML#//deprecatedelements">
  <uml:Model xmi:id="_FWG_wAE6EeqaduxU2Rstvg" name="UML_SoC_Modeling">
    <packageImport xmi:type="uml:PackageImport" xmi:id="_F91uIAE6EeqaduxU2Rstvg">
      <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
    </packageImport>
    <packagedElement xmi:type="uml:StateMachine" xmi:id="_FofwQAE6EeqaduxU2Rstvg" name="trnasmitter">
      <ownedRule xmi:type="uml:Constraint" xmi:id="_0utRkAGaEeqaduxU2Rstvg" name="x=6"/>
      <ownedAttribute xmi:type="uml:Port" xmi:id="_bl_cIAFXEeqaduxU2Rstvg" name="clk" aggregation="composite">
        <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EBoolean"/>
      </ownedAttribute>
      <ownedAttribute xmi:type="uml:Port" xmi:id="_diiBUAFXEeqaduxU2Rstvg" name="tpackout" type="_lAkDcAH3EeqaduxU2Rstvg" aggregation="composite"/>
      <ownedAttribute xmi:type="uml:Port" xmi:id="_1sHVkAIJEeqaduxU2Rstvg" name="timeout" aggregation="composite">
        <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EBoolean"/>
      </ownedAttribute>
      <ownedAttribute xmi:type="uml:Port" xmi:id="_62ER8AIJEeqaduxU2Rstvg" name="tpackin" type="_lAkDcAH3EeqaduxU2Rstvg" aggregation="composite"/>
      <ownedAttribute xmi:type="uml:Port" xmi:id="_-zOrEAIJEeqaduxU2Rstvg" name="start_timer" aggregation="composite">
        <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EBoolean"/>
      </ownedAttribute>
      <ownedOperation xmi:type="uml:Operation" xmi:id="_qCz38AGMEeqaduxU2Rstvg" name="op1" method="_zykh0AGMEeqaduxU2Rstvg">
        <ownedParameter xmi:type="uml:Parameter" xmi:id="_Q9GucAHyEeqaduxU2Rstvg" name="result" type="_lAkDcAH3EeqaduxU2Rstvg" direction="return"/>
      </ownedOperation>
      <ownedOperation xmi:type="uml:Operation" xmi:id="_rLO4kAGMEeqaduxU2Rstvg" name="op2" method="_RqU0sAGNEeqaduxU2Rstvg">
        <ownedParameter xmi:type="uml:Parameter" xmi:id="_d0rrkAH3EeqaduxU2Rstvg" name="rsult" type="_g_4cQAH3EeqaduxU2Rstvg" direction="return"/>
      </ownedOperation>
      <ownedOperation xmi:type="uml:Operation" xmi:id="_kQlaMAIGEeqaduxU2Rstvg" name="op3" method="_kjTh4AIGEeqaduxU2Rstvg">
        <ownedParameter xmi:type="uml:Parameter" xmi:id="_kQlaMQIGEeqaduxU2Rstvg" name="r" direction="return">
          <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolean"/>
        </ownedParameter>
      </ownedOperation>
      <region xmi:type="uml:Region" xmi:id="_FzgtcAE6EeqaduxU2Rstvg" name="Region1">
        <transition xmi:type="uml:Transition" xmi:id="_M8iloAE6EeqaduxU2Rstvg" source="_JAhcAAE6EeqaduxU2Rstvg" target="_KRCosAE6EeqaduxU2Rstvg">
          <effect xmi:type="uml:FunctionBehavior" xmi:id="_zykh0AGMEeqaduxU2Rstvg" name="op1" specification="_qCz38AGMEeqaduxU2Rstvg"/>
          <trigger xmi:type="uml:Trigger" xmi:id="_kIlz4AGaEeqaduxU2Rstvg" name="clk_trigger"/>
        </transition>
        <transition xmi:type="uml:Transition" xmi:id="_OINukAE6EeqaduxU2Rstvg" source="_KRCosAE6EeqaduxU2Rstvg" target="_L5IA0AE6EeqaduxU2Rstvg">
          <effect xmi:type="uml:FunctionBehavior" xmi:id="_RqU0sAGNEeqaduxU2Rstvg" name="op2" specification="_rLO4kAGMEeqaduxU2Rstvg"/>
          <trigger xmi:type="uml:Trigger" xmi:id="_zakloAGZEeqaduxU2Rstvg" name="time_out_trigger" event="_p96d8AGZEeqaduxU2Rstvg"/>
        </transition>
        <transition xmi:type="uml:Transition" xmi:id="_WbR3QAIGEeqaduxU2Rstvg" name="t2" source="_KRCosAE6EeqaduxU2Rstvg" target="_UkCBwAIGEeqaduxU2Rstvg">
          <effect xmi:type="uml:FunctionBehavior" xmi:id="_kjTh4AIGEeqaduxU2Rstvg" name="op2" specification="_kQlaMAIGEeqaduxU2Rstvg"/>
          <trigger xmi:type="uml:Trigger" xmi:id="_oKxX0AIGEeqaduxU2Rstvg" name="tr2" port="_bl_cIAFXEeqaduxU2Rstvg"/>
        </transition>
        <transition xmi:type="uml:Transition" xmi:id="_5NhuMAIGEeqaduxU2Rstvg" name="t3" source="_JAhcAAE6EeqaduxU2Rstvg" target="_L5IA0AE6EeqaduxU2Rstvg">
          <trigger xmi:type="uml:Trigger" xmi:id="_8jGi4AIGEeqaduxU2Rstvg" name="tr3" port="_diiBUAFXEeqaduxU2Rstvg"/>
        </transition>
        <subvertex xmi:type="uml:Pseudostate" xmi:id="_JAhcAAE6EeqaduxU2Rstvg" name="Initial_state"/>
        <subvertex xmi:type="uml:State" xmi:id="_KRCosAE6EeqaduxU2Rstvg" name="S0"/>
        <subvertex xmi:type="uml:FinalState" xmi:id="_L5IA0AE6EeqaduxU2Rstvg" name="Final_State"/>
        <subvertex xmi:type="uml:State" xmi:id="_UkCBwAIGEeqaduxU2Rstvg" name="S1"/>
      </region>
    </packagedElement>
    <packagedElement xmi:type="uml:Interface" xmi:id="_AcEzEAFYEeqaduxU2Rstvg" name="read_write_load_if">
      <ownedOperation xmi:type="uml:Operation" xmi:id="_JcK6kAFYEeqaduxU2Rstvg" name="read"/>
      <ownedOperation xmi:type="uml:Operation" xmi:id="_KjS6sAFYEeqaduxU2Rstvg" name="write"/>
    </packagedElement>
    <packagedElement xmi:type="uml:TimeEvent" xmi:id="_p96d8AGZEeqaduxU2Rstvg" name="timeout">
      <when xmi:type="uml:TimeExpression" xmi:id="_8hUHsAGZEeqaduxU2Rstvg" name="t">
        <expr xmi:type="uml:LiteralInteger" xmi:id="_8hUuwAGZEeqaduxU2Rstvg" value="5"/>
      </when>
    </packagedElement>
    <packagedElement xmi:type="uml:Class" xmi:id="_g_4cQAH3EeqaduxU2Rstvg" name="person"/>
    <packagedElement xmi:type="uml:DataType" xmi:id="_lAkDcAH3EeqaduxU2Rstvg" name="packet_type"/>
    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_aeKhEAIKEeqaduxU2Rstvg">
      <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_aeM9UAIKEeqaduxU2Rstvg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/sysml/1.4/SysML#//portsandflows"/>
      </eAnnotations>
      <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML14_PROFILES/SysML.profile.uml#SysML.package_packagedElement_Ports_u0026Flows"/>
    </profileApplication>
    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_aeOLcAIKEeqaduxU2Rstvg">
      <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_aeOygAIKEeqaduxU2Rstvg" source="http://www.eclipse.org/uml2/2.0.0/UML">
        <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/sysml/1.4/SysML#//deprecatedelements"/>
      </eAnnotations>
      <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML14_PROFILES/SysML.profile.uml#SysML.package_packagedElement_DeprecatedElements"/>
    </profileApplication>
  </uml:Model>
  <DeprecatedElements:FlowPort xmi:id="_dBzigAIKEeqaduxU2Rstvg" base_Port="_bl_cIAFXEeqaduxU2Rstvg" direction="in"/>
  <DeprecatedElements:FlowPort xmi:id="_f6PvQAIKEeqaduxU2Rstvg" base_Port="_1sHVkAIJEeqaduxU2Rstvg"/>
  <DeprecatedElements:FlowPort xmi:id="_iMPnEAIKEeqaduxU2Rstvg" base_Port="_-zOrEAIJEeqaduxU2Rstvg"/>
  <DeprecatedElements:FlowPort xmi:id="_kLh-QAIKEeqaduxU2Rstvg" base_Port="_62ER8AIJEeqaduxU2Rstvg" direction="in"/>
  <DeprecatedElements:FlowPort xmi:id="_mIpyQAIKEeqaduxU2Rstvg" base_Port="_diiBUAFXEeqaduxU2Rstvg" direction="out"/>
</xmi:XMI>





Re: problem to access to applied profiles on UML elements with Acceleo [message #1816873 is a reply to message #1816872] Sat, 09 November 2019 13:32 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It is important to spell the stereotype name correctly. Probably "A::B". I recall getting this wrong many times and solving it by single stepping to see why my spelling differed from the tool's expectations.

Since you have not provided a repro showing the call to getTaggedValue, I cannot offer any further help.

Regards

Ed Willink
Previous Topic:Error while creating Acceleo project
Next Topic:How to convter msg to vcf
Goto Forum:
  


Current Time: Fri Apr 26 22:01:12 GMT 2024

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

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

Back to the top