Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xpand] reference to metamodel not understood by generator
[xpand] reference to metamodel not understood by generator [message #495630] Thu, 05 November 2009 14:39 Go to next message
RJ is currently offline RJFriend
Messages: 19
Registered: October 2009
Location: Eindhoven, The Netherland...
Junior Member
Hi,

I have created a metamodel, which resides in my workspace, and had nsUri "http://planner/1.0".

Now I want to generate code, so I made and xpand file and a workflow-file to run the xpand file:

<workflow>
	<property name="model" value="planner/testmodel.planner"/>
	<property name="src-gen" value="src-gen"/>
	
	<!-- set up EMF for standalone execution -->
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
		<platformUri value=".."/>
	</bean>
	
	<!-- load model and store it in slot 'model' -->
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/${model}"/>
		<modelSlot value="model"/>
	</component>
	
	<!-- check model -->
	<component class="org.eclipse.xtend.check.CheckComponent">
		<metaModel id="mm" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<checkFile value="metamodel::Checks"/>
		<emfAllChildrenSlot value="model"/>
	</component>
	
	<!-- generate code -->
	<component class="org.eclipse.xpand2.Generator">
		<metaModel idRef="mm"/>
		<expand value="template::Template::main FOR model"/>
		<outlet path="${src-gen}"/>
	</component>
</workflow>


The header of the "planner/testmodel.planner" model is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:planner="http://planner/1.0">


And I'm getting the following error:
SEVERE: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://planner/1.0' not found. (platform:/resource/planner/testmodel.planner, 3, 54)


Now if I manually change the "xmlns:planner" property of the model to "platform:/resource/my.planner.metamodel/model/planner.ecore ", which is the physical location of the metamodel, it does work. But since the models are generated and the code-generation is part of a chain, I don't want the manually edit the files every time.

So is there a way to let the generator know that http://planner/1.0 refers to the metamodel? I've tried listing the directory of the metamodel as a dependency, but that did not help...

thanks in advance,
RJ
Re: [xpand] reference to metamodel not understood by generator [message #495646 is a reply to message #495630] Thu, 05 November 2009 15:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14725
Registered: July 2009
Senior Member
hello

you have to make the ecore known EMF. therefore modify your workflow like this:

<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
		<platformUri value=".."/>
               <registerEcoreFile value="platform:/resource/my.planner.metamodel/model/planner.ecore" />
	</bean>



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [xpand] reference to metamodel not understood by generator [message #495739 is a reply to message #495630] Thu, 05 November 2009 21:18 Go to previous message
RJ is currently offline RJFriend
Messages: 19
Registered: October 2009
Location: Eindhoven, The Netherland...
Junior Member
cool, that worked Smile. I sort've tried that, but apparently never in the correct order/combination...

tnx,
RJ
Previous Topic:Dealing with mixed types in XPAND for XSD
Next Topic:Error detection in xPand templates files
Goto Forum:
  


Current Time: Sun Oct 13 16:28:29 GMT 2024

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

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

Back to the top