Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Xpand: Cannot resolve the reference to a dependent model(The acces to the second model returns null because the returned eProxyUri does not seem to be correct.)
Xpand: Cannot resolve the reference to a dependent model [message #500446] Thu, 26 November 2009 08:52 Go to next message
nquaine  is currently offline nquaine Friend
Messages: 6
Registered: July 2009
Junior Member
I am migrating from oaw4 to oaw5. I have a main model (formComposition) which references another model (dataMod) . When I run my xpand template, I cannot resolve the reference to the second model.

The xpand template :

«info("Hello mnp = "+this.relatedModels.relatedSecondM.get(0))»
«info("Hello mnp name = "+this.relatedModels.relatedSecondM.get(0).name)»


The result on the console:

Registering platform uri 'F:\nadege-galileo\WkGMF300'
...
22889 INFO IOExtensions - Hello mnp = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@7f5580 (eProxyURI: file://F:/nadege-galileo/modele.second/src/model/secondMODEL E.datamod#/ eClass: org.eclipse.emf.ecore.impl.EClassImpl@55e55f (name: RootContent) (instanceClassName: null) (abstract: false, interface: false))
22889 INFO IOExtensions - Hello mnp name = null


The content of the referenced dataMod is not resolved (null) which is not so surprising because the eProxyURI, where it is looking for the model, is the following :

file://F:/nadege-galileo/modele.second/src/model/secondMODEL E.datamod

but the actual URI should be file://F:/nadege-galileo/WkGMF300/modele.second/src/model/se condMODELE.datamod

and the Registered platform URI is F:\nadege-galileo\WkGMF300.
Obviously the WkGMF300 is missing. What can I do to fix this problem ? Did I miss smthg while migrating?


Hereunder are my files:

The Ecore :

<eClassifiers xsi:type="ecore:EClass" name="RelatedModels">
<eStructuralFeatures xsi:type="ecore:EReference" name="relatedSecondM" eType="ecore:EClass ../../../dataMod_GMF/model/dataMod.ecore#//RootContent"/>
</eClassifiers>



The reference in the model:
<relatedModels name="">
<relatedSecondM href="../../../modele.second/src/model/secondMODELE.datamod#/ "/>
</relatedModels>



Note : If I change the reference in the model

from

../../../modele.second/src/model/secondMODELE.datamod

to

modele.second/src/model/secondMODELE.datamod

and move the corresponding file into the same location as my main model, I resolve the reference to the second model. The result in the console is

22889 INFO IOExtensions - Hello mnp name = second.

It also works if I insert an absolute reference to the second model


I have registered the ecore files at the beginning of my workflow:

<property name="build.basedir" value="platform:/resource"></property>
<property name="basedirfile" value="platform:/resource/${projectRoot}"></property>
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
<platformUri value=".."/>
<registerEcoreFile value=" ${build.basedir}/formComposition/src/ecore/formComposition.e core "/>
<registerEcoreFile value="${build.basedir}/dataMod_GMF/model/dataMod.ecore"/>
</bean>


Any ideas ?

Re: Xpand: Cannot resolve the reference to a dependent model [message #500481 is a reply to message #500446] Thu, 26 November 2009 10:16 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

You have to use platform:/resource URIs for your resources, otherwise the Proxies cannot be resolved.

Regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Xpand: Cannot resolve the reference to a dependent model [message #500482 is a reply to message #500446] Thu, 26 November 2009 10:04 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
If you have registered platform resource URIs for the workspace root
F:\nadege-galileo\WkGMF300

then you should change the URI to
" platform:/resource/modele.second/src/model/secondMODELE.data mod#/ "

Cheers,
Sven

nquaine schrieb:
> I am migrating from oaw4 to oaw5. I have a main model (formComposition)
> which references another model (dataMod) . When I run my xpand
> template, I cannot resolve the reference to the second model.
>
> The xpand template :
>
> «info("Hello mnp = "+this.relatedModels.relatedSecondM.get(0))»
> «info("Hello mnp name = "+this.relatedModels.relatedSecondM.get(0).name)»
>
> The result on the console:
>
> Registering platform uri 'F:\nadege-galileo\WkGMF300'
> ...
> 22889 INFO IOExtensions - Hello mnp =
> mailto:org.eclipse.emf.ecore.impl.DynamicEObjectImpl@7f5580 (eProxyURI:
> file://F:/nadege-galileo/modele.second/src/model/secondMODEL E.datamod#/
> eClass: mailto:org.eclipse.emf.ecore.impl.EClassImpl@55e55f (name:
> RootContent) (instanceClassName: null) (abstract: false, interface: false))
> 22889 INFO IOExtensions - Hello mnp name = null
>
> The content of the referenced dataMod is not resolved (null) which is
> not so surprising because the eProxyURI, where it is looking for the
> model, is the following :
>
> file://F:/nadege-galileo/modele.second/src/model/secondMODEL E.datamod
> but the actual URI should be
> file://F:/nadege-galileo/WkGMF300/modele.second/src/model/se condMODELE.datamod
>
>
> and the Registered platform URI is F:\nadege-galileo\WkGMF300.
> Obviously the WkGMF300 is missing. What can I do to fix this problem ?
> Did I miss smthg while migrating?
>
>
> Hereunder are my files:
>
> The Ecore :
>
> <eClassifiers xsi:type="ecore:EClass" name="RelatedModels">
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="relatedSecondM" eType="ecore:EClass
> ../../../dataMod_GMF/model/dataMod.ecore#//RootContent"/>
> </eClassifiers>
>
>
> The reference in the model:
> <relatedModels name="">
> <relatedSecondM
> href="../../../modele.second/src/model/secondMODELE.datamod#/ "/>
> </relatedModels>
>
>
> Note : If I change the reference in the model
> from
>
> ../../../modele.second/src/model/secondMODELE.datamod
>
> to
>
> modele.second/src/model/secondMODELE.datamod
>
> and move the corresponding file into the same location as my main model,
> I resolve the reference to the second model. The result in the console is
> 22889 INFO IOExtensions - Hello mnp name = second.
>
> It also works if I insert an absolute reference to the second model
>
>
> I have registered the ecore files at the beginning of my workflow:
>
> <property name="build.basedir" value="platform:/resource"></property>
> <property name="basedirfile"
> value="platform:/resource/${projectRoot}"></property>
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
> <platformUri value=".."/>
> <registerEcoreFile value="
> ${build.basedir}/formComposition/src/ecore/formComposition.e core "/>
> <registerEcoreFile
> value="${build.basedir}/dataMod_GMF/model/dataMod.ecore"/>
> </bean>
>
> Any ideas ?
>
>


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Xpand: Cannot resolve the reference to a dependent model [message #500626 is a reply to message #500482] Fri, 27 November 2009 08:53 Go to previous messageGo to next message
nquaine  is currently offline nquaine Friend
Messages: 6
Registered: July 2009
Junior Member
Thank you both for your help.

Using the platform resource URIs works very well.

But what's the difference between oaw4 and oaw5 on this point? I need to change my editor to save the reference with platform URIs, while I had kept the default behaviour with oaw4. Was it mere luck that it worked?

Best regards
Nadege
Re: Xpand: Cannot resolve the reference to a dependent model [message #500649 is a reply to message #500626] Fri, 27 November 2009 10:31 Go to previous message
nquaine  is currently offline nquaine Friend
Messages: 6
Registered: July 2009
Junior Member
After thinking it over: moving XmiReader to from emf.mwe.utils.Reader is the explanation the the different behaviour.

Previous Topic:[Acceleo] eInverse() and other functions
Next Topic:[xtext] mismatched input '{' expecting '{'
Goto Forum:
  


Current Time: Sun Nov 10 18:10:57 GMT 2024

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

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

Back to the top