Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xtend] UML profile stereotypes not recognized
[xtend] UML profile stereotypes not recognized [message #509142] Thu, 21 January 2010 13:58 Go to next message
Richard Wood is currently offline Richard WoodFriend
Messages: 29
Registered: January 2010
Junior Member
Hello

Within my Xtend file UML stereotypes are not recognized at generation time.
I'm using a test UML2 3.0 model referencing a profile.
In the model a UML class is applying a stereotype "Service".

The Xtend method with type "Service" as input parameter is never executed.

According this post it seems to be an issue with the MWE configuration.

http://www.eclipse.org/forums/index.php?t=msg&goto=50025 6&S=5ba2edc7e72c9d3f1be1ad045e72b0bb#msg_500256

I'm using Galileo and 0.7.2

Here is my mwe config
<?xml version="1.0"?>
<workflow>

	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
		<platformUri value=".."/>
		<registerGeneratedEPackage value="org.eclipse.uml2.uml.UMLPackage"/>
		<registerEcoreFile value="file://C:/DataService/DataServiceFramework/lib/DataServiceGenerator/src/TestProfile.profile.uml"/>
	</bean>
	
	<bean id="mmUML" 
		class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel">
	</bean>

	<bean id="testProfile" 
		class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel">
		<profile value="C:/DataService/DataServiceFramework/lib/DataServiceGenerator/src/TestProfile.profile.uml"/>
	</bean>
	
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/DataServiceGenerator/src/Test.uml"/> 
		<modelSlot value="umlModel"/>
	</component>

	<component class="org.eclipse.xtend.XtendComponent">
		<metaModel idRef="mmUML"/>
		<metaModel idRef="testProfile"/>
		<invoke value="umlTransform::transform(umlModel)" />
		<outputSlot value="serviceModel" />
	</component>

</workflow>


And here is the xtend code
extension org::eclipse::xtend::util::stdlib::io;

uml::Model transform(uml::Model mymodel):
	info("XXXXX") ->
	mymodel.packagedElement.typeSelect(uml::Class).transform()
;

Void transform(uml::Class myclass):
	info("UML Class " + myclass.name)
;

Void transform(TestProfile::Service myclass):
	info("Service " + myclass.name)
;

Any ideas?

Please advise.
Thanks
Richard

[Updated on: Thu, 21 January 2010 14:02]

Report message to a moderator

Re: [xtend] UML profile stereotypes not recognized [message #509165 is a reply to message #509142] Thu, 21 January 2010 14:53 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Hello Richard,

could you please package all relevant artifacts for a closer look? It's hard to tell just from the mwe config and the template, both of which look fine at a first glance. Would be helpful to see the profile and an instance model.

Best,
Erhard
Re: [xtend] UML profile stereotypes not recognized [message #509181 is a reply to message #509165] Thu, 21 January 2010 15:30 Go to previous messageGo to next message
Richard Wood is currently offline Richard WoodFriend
Messages: 29
Registered: January 2010
Junior Member
Thanks for the heads up Erhard

Here is a rar file with the files
http://drop.io/sh1dibm/asset/umlprofiletest-rar

I've also prefixed the ProfileMetaModel uri with platfrom:/resource/
but with no improvement.





Re: [xtend] UML profile stereotypes not recognized [message #509293 is a reply to message #509181] Thu, 21 January 2010 21:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,

modifiying the workflow like this works for me

<?xml version="1.0"?>
<workflow>

	<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="testProfile" 
		class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel">
		<profile value="platform:/resource/src/TestProfile.profile.uml"/>
	</bean>
	
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/src/Test.uml"/> 
		<modelSlot value="umlModel"/>
	</component>

	<component class="org.eclipse.xtend.XtendComponent">
		
		<metaModel idRef="testProfile"/>
		<metaModel idRef="mmUML"/>
		
		<invoke value="umlTransform::transform(umlModel)" />
		<outputSlot value="serviceModel" />
	</component>

</workflow>


INFO: XXXXX
21.01.2010 22:14:04 org.eclipse.xtend.util.stdlib.IOExtensions info
INFO: Service Something
21.01.2010 22:14:04 org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
INFO: workflow completed in 1248ms!


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xtend] UML profile stereotypes not recognized [message #509367 is a reply to message #509293] Fri, 22 January 2010 09:22 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
And just as a side-note: It is advisable to reference profiles through pathmap URIs (Extension point org.eclipse.emf.ecore.uri_mapping) to keep instance models filesystem independent.

Best regards,
Erhard
Re: [xtend] UML profile stereotypes not recognized [message #509429 is a reply to message #509142] Fri, 22 January 2010 12:41 Go to previous messageGo to next message
Richard Wood is currently offline Richard WoodFriend
Messages: 29
Registered: January 2010
Junior Member
Thanks a lot Christian
Seems I missed two issues
- Missing setup for uml2 typesystem
- metamodel sequence for uml and profile. Profile first...

Works now for me too.



Erhard, you mentioned pathmap URIs for referencing profiles. I guess we are doing that now with platform:/resource... correct?

What do you mean with the extension point. Do I need to add something to the project meta-inf?

Can you give an example?

Thanks a lot for helping

Richard
Re: [xtend] UML profile stereotypes not recognized [message #509446 is a reply to message #509429] Fri, 22 January 2010 13:15 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Richard Wood wrote on Fri, 22 January 2010 07:41

Erhard, you mentioned pathmap URIs for referencing profiles. I guess we are doing that now with platform:/resource... correct?



For the workflow the platform:/resource-style is fine, but your instance models will have quite strange references such as:

http:///schemas/TestProfile


Thing is: If you distribute the profile and its referencing uml models over several plugins, such URLs can break easily and render your models unreadable for EMF. I'm not quite sure if this also occurs when moving the profile around within the same plugin.

Quote:
What do you mean with the extension point. Do I need to add something to the project meta-inf?


I usually define an extension (in the plugin.xml, also available through the "Extensions" page):
<extension
         point="org.eclipse.emf.ecore.uri_mapping">
      <mapping
            source="pathmap://MY_PROFILES/"
            target="platform:/plugin/org.example.myplugin/src/">
      </mapping>
</extension>


When creating an instance model, you can refer to your profile via:
pathmap://MY_PROFILES/Testprofile.uml.profile


UML libraries etc. are referenced in the same way internally.

Best regards,
Erhard

Re: [xtend] UML profile stereotypes not recognized [message #509505 is a reply to message #509142] Fri, 22 January 2010 16:20 Go to previous messageGo to next message
Richard Wood is currently offline Richard WoodFriend
Messages: 29
Registered: January 2010
Junior Member
Thanks for the valueable input Erhard.
Have to try that.

Something else I noticed with profiles when exporting these from Rational Software Modeler is the annotation "UML" under the Profile element.

These get created when publishing the profile, ie. execute "define".
MWE cannot cope with duplicate entries with different names.
When I removed all except one from the exported profiles MWE was able to process profiles and applying models. Otherwise it would return an error message.

Any thoughts on this?
Re: [xtend] UML profile stereotypes not recognized [message #509534 is a reply to message #509505] Fri, 22 January 2010 17:37 Go to previous message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Richard Wood wrote on Fri, 22 January 2010 11:20

These get created when publishing the profile, ie. execute "define".
MWE cannot cope with duplicate entries with different names.
When I removed all except one from the exported profiles MWE was able to process profiles and applying models. Otherwise it would return an error message.



What you see there is the EMF version of your profile, which is e.g. used by the EmfRegistryMetaModel. The standard define seems to keep every version of the profile using a special qualifier, so that your instance models remain intact even if the profile changes. You won't be able to use added tagged values in a previously existing instance model, though.

Internally we use a modified implementation which consistently replaces the derived EMF models (but e.g. keeps classifier ids constant). Whether this is a good idea is a topic for the EMF group, but I'm sure Ed can easily explain why the standard way is the best to go Smile

Best regards,
Erhard
Previous Topic:[XPand/GMF] templates import statements
Next Topic:Executing: OaW Workflow out of Eclipse Plugin
Goto Forum:
  


Current Time: Fri Apr 19 09:13:06 GMT 2024

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

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

Back to the top