Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Problem with XPand2 and UML Profiles(template does not find profile stereotypes)
Problem with XPand2 and UML Profiles [message #513466] Wed, 10 February 2010 10:26 Go to next message
Markus is currently offline MarkusFriend
Messages: 15
Registered: September 2009
Junior Member
Hey guys,

I want to Transform a model into text. I have modelled my model with MagicDraw 15.x and exported it as a EMF 2.x file.
The MagicDraw uml model is based on an UML Profile, named
"SdkApiProfile".

My workflow-file looks like:
<?xml version="1.0"?>
<workflow>
	<property name="src-gen" value="src-gen" />
	
	<bean class="org.eclipse.xtend.typesystem.uml2.Setup" standardUML2Setup="true"  />
	
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
		<platformUri value="."/>
	</bean>
	
	<bean id="mmUML" 
		class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel">
	</bean>

	<bean id="sdkApiProfil" 
		class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel">
		<profile value="platform:/resource/src/metamodel/uml/SdkApiProfile.profile.uml"/>
	</bean>
	
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/src/model.uml"/> 
		<modelSlot value="model"/>
	</component>

	<component class="org.eclipse.xpand2.Generator">
		<metaModel idRef="sdkApiProfil"/>
		<metaModel idRef="mmUML"/>
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="Cp1252"/>
		
		<expand value="template::Template::Main FOR model"/>
		<genPath value="${src-gen}"/>
	</component>
	
</workflow>



My Xpand-Template is very simple



«DEFINE Main FOR SdkApiProfile::DomainModel»
	«FILE "test.xmap"-»
               «REM»do some stuff...«ENDREM»
		«EXPAND PackageIteration FOREACH ownedElement.typeSelect(uml::Package).select(e|e.name=="root")-»
	«ENDFILE-»
«ENDDEFINE»


«DEFINE PackageIteration FOR uml::Package»
	«EXPAND PackageIteration FOREACH this.ownedElement.typeSelect(uml::Package)-»
	«EXPAND Typedef FOREACH this.ownedType-»
«ENDDEFINE»

«DEFINE Typedef FOR SdkApiProfile::Data»
	
«ENDDEFINE»

«DEFINE Typedef FOR uml::Enumeration»
	
«ENDDEFINE» 



the problem is, that in Main-Template, the generator expects an uml::Model, but it is also a SdkApiProfil::DomainModel. And I do not know how to tell Xpand (or MWE) that the imported model.uml has stereotypes, which are located in SdkApiProfile.profile.uml. I think it is already done in workflow-file, as you see above.

Can you help me to fix the problem?

kind regards
Markus
Re: Problem with XPand2 and UML Profiles [message #513490 is a reply to message #513466] Wed, 10 February 2010 06:50 Go to previous messageGo to next message
ekkehard gentz is currently offline ekkehard gentzFriend
Messages: 118
Registered: July 2009
Location: rosenheim, Germany, bavar...
Senior Member

This is a multi-part message in MIME format.
--------------080508050009050805040507
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Markus,

in your workflow please try using only the profile mm - this refres
already to UML2 MM and ecore MM

....
<component class="org.eclipse.xpand2.Generator">
<metaModel idRef="sdkApiProfil"/>
<fileEncoding value="Cp1252"/>

<expand value="template::Template::Main FOR model"/>
<genPath value="${src-gen}"/>
</component>
....

ekke
Am 10.02.10 11:26, schrieb Markus:
> Hey guys,
>
> I want to Transform a model into text. I have modelled my model with
> MagicDraw 15.x and exported it as a EMF 2.x file. The MagicDraw uml
> model is based on an UML Profile, named "SdkApiProfile".
>
> My workflow-file looks like:
>
> <?xml version="1.0"?>
> <workflow>
> <property name="src-gen" value="src-gen" />
>
> <bean class="org.eclipse.xtend.typesystem.uml2.Setup"
> standardUML2Setup="true" />
>
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
> <platformUri value="."/>
> </bean>
>
> <bean id="mmUML"
> class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel">
> </bean>
>
> <bean id="sdkApiProfil"
> class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel ">
> <profile
> value=" platform:/resource/src/metamodel/uml/SdkApiProfile.profile.u ml "/>
> </bean>
>
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <uri value="platform:/resource/src/model.uml"/> <modelSlot
> value="model"/>
> </component>
>
> <component class="org.eclipse.xpand2.Generator">
> <metaModel idRef="sdkApiProfil"/>
> <metaModel idRef="mmUML"/>
> <metaModel
> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
> <fileEncoding value="Cp1252"/>
>
> <expand value="template::Template::Main FOR model"/>
> <genPath value="${src-gen}"/>
> </component>
>
> </workflow>
>
>
>
> My Xpand-Template is very simple
>
>
>
>
> «DEFINE Main FOR SdkApiProfile::DomainModel»
> «FILE "test.xmap"-»
> «REM»do some stuff...«ENDREM»
> «EXPAND PackageIteration FOREACH
> ownedElement.typeSelect(uml::Package).select(e|e.name=="root ")-»
> «ENDFILE-»
> «ENDDEFINE»
>
>
> «DEFINE PackageIteration FOR uml::Package»
> «EXPAND PackageIteration FOREACH
> this.ownedElement.typeSelect(uml::Package)-»
> «EXPAND Typedef FOREACH this.ownedType-»
> «ENDDEFINE»
>
> «DEFINE Typedef FOR SdkApiProfile::Data»
>
> «ENDDEFINE»
>
> «DEFINE Typedef FOR uml::Enumeration»
>
> «ENDDEFINE»
>
>
> the problem is, that in Main-Template, the generator expects an
> uml::Model, but it is also a SdkApiProfil::DomainModel. And I do not
> know how to tell Xpand (or MWE) that the imported model.uml has
> stereotypes, which are located in SdkApiProfile.profile.uml. I think
> it is already done in workflow-file, as you see above.
>
> Can you help me to fix the problem?
>
> kind regards
> Markus


--

ekke (ekkehard gentz)
independent software-architect
senior erp-consultant
eclipse | osgi | equinox | mdsd | oaw | emf | uml
max-josefs-platz 30, D-83022 rosenheim, germany
mailto:ekke@ekkes-corner.org
homepage (de): http://gentz-software.de
blog (en): http://ekkes-corner.org
twitter: @ekkescorner
skype: ekkes-corner
Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490


--------------080508050009050805040507
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Markus, <br>
<br>
in your workflow please try using only the profile mm - this refres
already to UML2 MM and ecore MM<br>
<br>
....<br>
    &lt;component class="org.eclipse.xpand2.Generator"&gt;
<br>
        &lt;metaModel idRef="sdkApiProfil"/&gt;
<br>
        &lt;fileEncoding value="Cp1252"/&gt;
<br>
        <br>
        &lt;expand value="template::Template::Main FOR model"/&gt;
<br>
        &lt;genPath value="${src-gen}"/&gt;
<br>
    &lt;/component&gt;
<br>
....<br>
<br>
ekke<br>
Am 10.02.10 11:26, schrieb Markus:
<blockquote cite="mid:hku1kj$po1$1@build.eclipse.org" type="cite">Hey
guys,
<br>
<br>
I want to Transform a model into text. I have modelled my model with
MagicDraw 15.x and exported it as a EMF 2.x file. The MagicDraw uml
model is based on an UML Profile, named "SdkApiProfile".
<br>
<br>
My workflow-file looks like:
<br>
<br>
&lt;?xml version="1.0"?&gt;
<br>
&lt;workflow&gt;
<br>
    &lt;property name="src-gen" value="src-gen" /&gt;
<br>
    
<br>
    &lt;bean class="org.eclipse.xtend.typesystem.uml2.Setup"
standardUML2Setup="true"  /&gt;
<br>
    
<br>
    &lt;bean class="org.eclipse.emf.mwe.utils.StandaloneSetup"&gt;
<br>
        &lt;platformUri value="."/&gt;
<br>
    &lt;/bean&gt;
<br>
    
<br>
    &lt;bean id="mmUML"        
class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel"&gt;
<br>
    &lt;/bean&gt;
<br>
<br>
    &lt;bean id="sdkApiProfil"        
class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel "&gt;
<br>
        &lt;profile
value=" platform:/resource/src/metamodel/uml/SdkApiProfile.profile.u ml "/&gt;
<br>
    &lt;/bean&gt;
<br>
    
<br>
    &lt;component class="org.eclipse.emf.mwe.utils.Reader"&gt;
<br>
        &lt;uri value="platform:/resource/src/model.uml"/&gt;        
&lt;modelSlot value="model"/&gt;
<br>
    &lt;/component&gt;
<br>
<br>
    &lt;component class="org.eclipse.xpand2.Generator"&gt;
<br>
        &lt;metaModel idRef="sdkApiProfil"/&gt;
<br>
        &lt;metaModel idRef="mmUML"/&gt;
<br>
        &lt;metaModel
class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/&gt;
<br>
        &lt;fileEncoding value="Cp1252"/&gt;
<br>
        <br>
        &lt;expand value="template::Template::Main FOR model"/&gt;
<br>
        &lt;genPath value="${src-gen}"/&gt;
<br>
    &lt;/component&gt;
<br>
    
<br>
&lt;/workflow&gt;
<br>
<br>
<br>
<br>
My Xpand-Template is very simple
<br>
<br>
<br>
<br>
<br>
«DEFINE Main FOR SdkApiProfile::DomainModel»
<br>
    «FILE "test.xmap"-»
<br>
              «REM»do some stuff...«ENDREM»
<br>
        «EXPAND PackageIteration FOREACH
ownedElement.typeSelect(uml::Package).select(e|e.name=="root ")-»
<br>
    «ENDFILE-»
<br>
«ENDDEFINE»
<br>
<br>
<br>
«DEFINE PackageIteration FOR uml::Package»
<br>
    «EXPAND PackageIteration FOREACH
this.ownedElement.typeSelect(uml::Package)-»
<br>
    «EXPAND Typedef FOREACH this.ownedType-»
<br>
«ENDDEFINE»
<br>
<br>
«DEFINE Typedef FOR SdkApiProfile::Data»
<br>
    
<br>
«ENDDEFINE»
<br>
<br>
«DEFINE Typedef FOR uml::Enumeration»
<br>
    
<br>
«ENDDEFINE» <br>
<br>
<br>
the problem is, that in Main-Template, the generator expects an
uml::Model, but it is also a SdkApiProfil::DomainModel. And I do not
know how to tell Xpand (or MWE) that the imported model.uml has
stereotypes, which are located in SdkApiProfile.profile.uml. I think it
is already done in workflow-file, as you see above.
<br>
<br>
Can you help me to fix the problem?
<br>
<br>
kind regards
<br>
Markus
<br>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<p style="margin-bottom: 0cm;"> <font ,="" color="#808080"
face="Verdana, sans-serif"> <font size="4">ekke (ekkehard gentz)<br>
</font> <font size="3"> independent software-architect<br>
senior erp-consultant<br>
</font> <font size="2">eclipse | osgi | equinox | mdsd | oaw | emf |
uml<br>
max-josefs-platz 30, D-83022 rosenheim, germany<br>
<a class="moz-txt-link-freetext" href="mailto:ekke@ekkes-corner.org">mailto:ekke@ekkes-corner.org</a><br>
homepage (de): <a class="moz-txt-link-freetext" href="http://gentz-software.de">http://gentz-software.de</a><br>
blog (en): <a class="moz-txt-link-freetext" href="http://ekkes-corner.org">http://ekkes-corner.org</a><br>
twitter: @ekkescorner<br>
skype: ekkes-corner<br>
</font> <font size="1"> Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID:
DE189929490<br>
</font> </font> </p>
</div>
</body>
</html>

--------------080508050009050805040507--


ekke
independent software architect

blog: http://ekkes-corner.org
twitter: @ekkescorner
Re: Problem with XPand2 and UML Profiles [message #513533 is a reply to message #513490] Wed, 10 February 2010 14:10 Go to previous message
Markus is currently offline MarkusFriend
Messages: 15
Registered: September 2009
Junior Member
Hi ekke,

thank you for your help.
The profile-meta-model and the model.uml were in different packages. Therefore the references in model.uml to the uml-profile couldn't be resolved.

I put the model.uml and bla.profile.uml in the same package and everything works....

... Smile
kind regards
Markus
Previous Topic:UML Profile and UML Version 3.0.0
Next Topic:[Announce] Eclipse/OMG Symposium 2010
Goto Forum:
  


Current Time: Mon Oct 14 02:27:45 GMT 2024

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

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

Back to the top