Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel
[Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel [message #511721] Tue, 02 February 2010 11:26 Go to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 5
Registered: July 2009
Junior Member
Hi newsgroup,

i'm totally desperated!

My problem is, that when my metamodel is using some elements from the
ecore metamodel the workflow aborts with an
org.eclipse.emf.ecore.xmi.FeatureNotFoundException...

You may reproduce it by changing the Xpand Sample Project in this way:
1. In the metamodel.ecore file load ecore metamodel resource.
2. Remove the name attribute from Type and therefore add ENamedElement
as a esuper type.
3. Running the workflow now you will get the Exception.

I found some similar problems with referenced metamodels that gave some
hints regarding the workflow definition (none of them helpful):
- add metaModel tags to Generator component
- add referenced ecore file tag to StandaloneSetup bean
- ...?


Has anybody an idea how to solve this issue???
Perhaps someone can share a working workflow definition for my Sample
Project example?

Regards, Andreas
Re: [Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel [message #511890 is a reply to message #511721] Wed, 03 February 2010 10:33 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Please post your workflow and the way you reference ecore (ie is it
nsURI or resource uri).

Sven

Andreas Werner schrieb:
> Hi newsgroup,
>
> i'm totally desperated!
>
> My problem is, that when my metamodel is using some elements from the
> ecore metamodel the workflow aborts with an
> org.eclipse.emf.ecore.xmi.FeatureNotFoundException...
>
> You may reproduce it by changing the Xpand Sample Project in this way:
> 1. In the metamodel.ecore file load ecore metamodel resource.
> 2. Remove the name attribute from Type and therefore add ENamedElement
> as a esuper type.
> 3. Running the workflow now you will get the Exception.
>
> I found some similar problems with referenced metamodels that gave some
> hints regarding the workflow definition (none of them helpful):
> - add metaModel tags to Generator component
> - add referenced ecore file tag to StandaloneSetup bean
> - ...?
>
>
> Has anybody an idea how to solve this issue???
> Perhaps someone can share a working workflow definition for my Sample
> Project example?
>
> Regards, Andreas


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel [message #511910 is a reply to message #511890] Wed, 03 February 2010 12:04 Go to previous messageGo to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 5
Registered: July 2009
Junior Member
Hi Sven,

here is my generator.mwe with some experiments I've done so far.

<?xml version="1.0"?>
<workflow>
<property name="model" value="my.generator.project/src/Model.xmi" />
<property name="src-gen" value="src-gen" />

<!-- set up EMF for standalone execution -->
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
<platformUri value=".."/>

<!-- 1. Plugin URI doesn't sem to be supported (URI copyied from metamodel.ecore as seen in the editor)
<registerEcoreFile value="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore " />
-->

<!-- 2. Tried this after copying the Ecore project into workspace
<registerEcoreFile value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore " />
-->

<!-- 3. Tried this after copying the Ecore model to sample project
<registerEcoreFile value=" platform:/resource/my.generator.project/src/metamodel/Ecore. ecore " />
-->

<!-- 4. ...
<registerGeneratedEPackage value="org.eclipse.emf.ecore.EcorePackage"/>
-->

</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"/>

<!-- 5. ...
<metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
<metaModelPackage value="org.eclipse.emf.ecore.EcorePackage"/>
</metaModel>

<metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
<metaModelFile value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
</metaModel>

<metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
<metaModelFile value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
</metaModel>
-->

<expand
value="template::Template::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
</outlet>
</component>
</workflow>

Am 03.02.2010 11:33, schrieb Sven Efftinge:
> Please post your workflow and the way you reference ecore (ie is it
> nsURI or resource uri).
>
> Sven
>
> Andreas Werner schrieb:
>> Hi newsgroup,
>>
>> i'm totally desperated!
>>
>> My problem is, that when my metamodel is using some elements from the
>> ecore metamodel the workflow aborts with an
>> org.eclipse.emf.ecore.xmi.FeatureNotFoundException...
>>
>> You may reproduce it by changing the Xpand Sample Project in this way:
>> 1. In the metamodel.ecore file load ecore metamodel resource.
>> 2. Remove the name attribute from Type and therefore add ENamedElement
>> as a esuper type.
>> 3. Running the workflow now you will get the Exception.
>>
>> I found some similar problems with referenced metamodels that gave
>> some hints regarding the workflow definition (none of them helpful):
>> - add metaModel tags to Generator component
>> - add referenced ecore file tag to StandaloneSetup bean
>> - ...?
>>
>>
>> Has anybody an idea how to solve this issue???
>> Perhaps someone can share a working workflow definition for my Sample
>> Project example?
>>
>> Regards, Andreas
>
>
Re: [Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel [message #511917 is a reply to message #511910] Wed, 03 February 2010 07:30 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Is model.xmi and instance of Ecore.ecore?
If you have another *.ecore file which Model.xmi is an instance of,
you'll have to register that.
Usually one refers to ecore files by it's nsURI (check the uri in your
*.ecore file). In that case you only need to register your ecore model

<registerEcoreFile
value="platform:/resource/my.project/model/my.ecore" />

This will register the epackage with the EPackage.Registry.

You don't need to specify the EPackages when configuring the metamodel,
since it uses the EPackage.Registry by default.

<metaModel id="mm"
class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>

is sufficient.

Sven

Andreas Werner schrieb:
> Hi Sven,
>
> here is my generator.mwe with some experiments I've done so far.
>
> <?xml version="1.0"?>
> <workflow>
> <property name="model" value="my.generator.project/src/Model.xmi" />
> <property name="src-gen" value="src-gen" />
>
> <!-- set up EMF for standalone execution -->
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
> <platformUri value=".."/>
>
> <!-- 1. Plugin URI doesn't sem to be supported (URI copyied from
> metamodel.ecore as seen in the editor)
> <registerEcoreFile
> value="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore " />
> -->
>
> <!-- 2. Tried this after copying the Ecore project into workspace
> <registerEcoreFile
> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore " />
> -->
>
> <!-- 3. Tried this after copying the Ecore model to sample project
> <registerEcoreFile
> value=" platform:/resource/my.generator.project/src/metamodel/Ecore. ecore "
> />
> -->
>
> <!-- 4. ...
> <registerGeneratedEPackage
> value="org.eclipse.emf.ecore.EcorePackage"/>
> -->
>
> </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"/>
>
> <!-- 5. ...
> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage value="org.eclipse.emf.ecore.EcorePackage"/>
> </metaModel>
>
> <metaModel
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelFile
> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
> </metaModel>
>
> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelFile
> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
> </metaModel>
> -->
>
> <expand
> value="template::Template::main FOR model" />
> <outlet path="${src-gen}" >
> <postprocessor
> class="org.eclipse.xpand2.output.JavaBeautifier" />
> </outlet>
> </component>
> </workflow>
>
> Am 03.02.2010 11:33, schrieb Sven Efftinge:
>> Please post your workflow and the way you reference ecore (ie is it
>> nsURI or resource uri).
>>
>> Sven
>>
>> Andreas Werner schrieb:
>>> Hi newsgroup,
>>>
>>> i'm totally desperated!
>>>
>>> My problem is, that when my metamodel is using some elements from the
>>> ecore metamodel the workflow aborts with an
>>> org.eclipse.emf.ecore.xmi.FeatureNotFoundException...
>>>
>>> You may reproduce it by changing the Xpand Sample Project in this way:
>>> 1. In the metamodel.ecore file load ecore metamodel resource.
>>> 2. Remove the name attribute from Type and therefore add ENamedElement
>>> as a esuper type.
>>> 3. Running the workflow now you will get the Exception.
>>>
>>> I found some similar problems with referenced metamodels that gave
>>> some hints regarding the workflow definition (none of them helpful):
>>> - add metaModel tags to Generator component
>>> - add referenced ecore file tag to StandaloneSetup bean
>>> - ...?
>>>
>>>
>>> Has anybody an idea how to solve this issue???
>>> Perhaps someone can share a working workflow definition for my Sample
>>> Project example?
>>>
>>> Regards, Andreas
>>
>>


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand]: FeatureNotFoundException in workflow when metamodel references Ecore metamodel [message #511929 is a reply to message #511917] Wed, 03 February 2010 13:06 Go to previous message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 5
Registered: July 2009
Junior Member
I got it now! ;)
The problem was, that I subTyped ENamedElement in the metamodel.ecore,
which is not allowed, because ENamedElement is not an EClass...
When subTyping EClass instead of ENamedElement the workflow executes without errors.

But I think it's strange that the EcoreEditor as well as the DynamicInstanceEditor no
warnings or errors have been given!?!?



Am 03.02.2010 13:25, schrieb Sven Efftinge:
> Is model.xmi and instance of Ecore.ecore?
> If you have another *.ecore file which Model.xmi is an instance of,
> you'll have to register that.
> Usually one refers to ecore files by it's nsURI (check the uri in your
> *.ecore file). In that case you only need to register your ecore model
>
> <registerEcoreFile
> value="platform:/resource/my.project/model/my.ecore" />
>
> This will register the epackage with the EPackage.Registry.
>
> You don't need to specify the EPackages when configuring the metamodel,
> since it uses the EPackage.Registry by default.
>
> <metaModel id="mm"
> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>
> is sufficient.
>
> Sven
>
> Andreas Werner schrieb:
>> Hi Sven,
>>
>> here is my generator.mwe with some experiments I've done so far.
>>
>> <?xml version="1.0"?>
>> <workflow>
>> <property name="model" value="my.generator.project/src/Model.xmi" />
>> <property name="src-gen" value="src-gen" />
>> <!-- set up EMF for standalone execution -->
>> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
>> <platformUri value=".."/>
>> <!-- 1. Plugin URI doesn't sem to be supported (URI copyied from
>> metamodel.ecore as seen in the editor)
>> <registerEcoreFile
>> value="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore " />
>> -->
>> <!-- 2. Tried this after copying the Ecore project into workspace
>> <registerEcoreFile
>> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore " />
>> -->
>> <!-- 3. Tried this after copying the Ecore model to sample project
>> <registerEcoreFile
>> value=" platform:/resource/my.generator.project/src/metamodel/Ecore. ecore "
>> />
>> -->
>> <!-- 4. ...
>> <registerGeneratedEPackage value="org.eclipse.emf.ecore.EcorePackage"/>
>> -->
>> </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"/>
>> <!-- 5. ...
>> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
>> <metaModelPackage value="org.eclipse.emf.ecore.EcorePackage"/>
>> </metaModel>
>> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
>> <metaModelFile
>> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
>> </metaModel>
>> <metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
>> <metaModelFile
>> value="platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore "/>
>> </metaModel>
>> -->
>> <expand
>> value="template::Template::main FOR model" />
>> <outlet path="${src-gen}" >
>> <postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
>> </outlet>
>> </component>
>> </workflow>
>>
>> Am 03.02.2010 11:33, schrieb Sven Efftinge:
>>> Please post your workflow and the way you reference ecore (ie is it
>>> nsURI or resource uri).
>>>
>>> Sven
>>>
>>> Andreas Werner schrieb:
>>>> Hi newsgroup,
>>>>
>>>> i'm totally desperated!
>>>>
>>>> My problem is, that when my metamodel is using some elements from the
>>>> ecore metamodel the workflow aborts with an
>>>> org.eclipse.emf.ecore.xmi.FeatureNotFoundException...
>>>>
>>>> You may reproduce it by changing the Xpand Sample Project in this way:
>>>> 1. In the metamodel.ecore file load ecore metamodel resource.
>>>> 2. Remove the name attribute from Type and therefore add ENamedElement
>>>> as a esuper type.
>>>> 3. Running the workflow now you will get the Exception.
>>>>
>>>> I found some similar problems with referenced metamodels that gave
>>>> some hints regarding the workflow definition (none of them helpful):
>>>> - add metaModel tags to Generator component
>>>> - add referenced ecore file tag to StandaloneSetup bean
>>>> - ...?
>>>>
>>>>
>>>> Has anybody an idea how to solve this issue???
>>>> Perhaps someone can share a working workflow definition for my Sample
>>>> Project example?
>>>>
>>>> Regards, Andreas
>>>
>>>
>
>
Previous Topic:Workflow just terminates on Linux but works on Windows
Next Topic:problem with multiple template files
Goto Forum:
  


Current Time: Tue Oct 08 00:38:15 GMT 2024

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

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

Back to the top