Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Referenced model unaccessible
[Xpand] Referenced model unaccessible [message #510346] Wed, 27 January 2010 10:29 Go to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hello,

I try to prettyprint a model that refers to another model.

In my metamodel there is a class named AtomicProposition that has a reference to another metamodel of type Variable that has an attribute name.

The rules for prettyprinting these modelelements are as follows:
«DEFINE generatePathFormula FOR AtomicProposition»«EXPAND generateVariable FOR this.Variable»«ENDDEFINE»

«DEFINE generateVariable FOR Variable»«this.name»«ENDDEFINE»
Both metamodels are imported in the template.

When I execute my template using a workflow, nothing is generated for the variable.
However, when I replace in the generateVariable definition:
«this.name»
by
«this.toString()»
I get the following output for the variable:
slco.impl.VariableImpl@a084f8 (eProxyURI: LegoCase-plain.slco#//@classes.3/@stateMachines.1/@variables.0)

It appears to me that the variable can be found, but the name cannot be printed.

Does anybody have an idea what my problem could be?
Re: [Xpand] Referenced model unaccessible [message #510455 is a reply to message #510346] Wed, 27 January 2010 15:00 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
You have an unresolved proxy.
Somehow the URI
'LegoCase-plain.slco#//@classes.3/@stateMachines.1/@variable s.0' cannot
be resolved. Is LegoCase-plain-slco laying next to the resource at hand?

Sven


Marcel schrieb:
> Hello,
>
> I try to prettyprint a model that refers to another model.
>
> In my metamodel there is a class named AtomicProposition that has a
> reference to another metamodel of type Variable that has an attribute name.
>
> The rules for prettyprinting these modelelements are as follows:
>
> «DEFINE generatePathFormula FOR AtomicProposition»«EXPAND
> generateVariable FOR this.Variable»«ENDDEFINE»
>
> «DEFINE generateVariable FOR Variable»«this.name»«ENDDEFINE»
> Both metamodels are imported in the template.
>
> When I execute my template using a workflow, nothing is generated for
> the variable.
> However, when I replace in the generateVariable definition:
>
> «this.name»
> by
>
> «this.toString()»
> I get the following output for the variable:
> slco.impl.VariableImpl@a084f8 (eProxyURI:
> LegoCase-plain.slco#//@classes.3/@stateMachines.1/@variables .0)
> It appears to me that the variable can be found, but the name cannot be
> printed.
>
> Does anybody have an idea what my problem could be?


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand] Referenced model unaccessible [message #510651 is a reply to message #510455] Thu, 28 January 2010 08:58 Go to previous messageGo to next message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hello Sven,

Yes, both models are in the same folder.

Could it maybe have to do with the workflow I am using, it is as follows:
<workflow>
  <property name="model" value="My.temporallogic"/>
  <property name="targetdir" value="src-gen"/>

  <component class="org.eclipse.emf.mwe.utils.Reader">
    <uri value="src/${model}"/>
    <modelSlot value="LTLFormula"/>
  </component>

  <component class='org.eclipse.xpand2.Generator'>
    <metaModel id="temporallogic" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      <metaModelPackage value="temporallogic.TemporallogicPackage"/>
    </metaModel>
    <metaModel id="slco" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
      <metaModelPackage value="slco.SlcoPackage"/>
    </metaModel>
    <expand value='template::TemporalLogicPrettyPrinter::prettyPrint FOR LTLFormula'/>
    <genPath value='${targetdir}'/>
  </component>
</workflow>


Regards,

Marcel
Re: [Xpand] Referenced model unaccessible [message #510776 is a reply to message #510651] Thu, 28 January 2010 15:27 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
It is maybe enough to prefix the URI with the right scheme.
Please try 'file:/./src/${model}'.

Sven

Marcel schrieb:
> Hello Sven,
>
> Yes, both models are in the same folder.
>
> Could it maybe have to do with the workflow I am using, it is as follows:
>
> <workflow>
> <property name="model" value="My.temporallogic"/>
> <property name="targetdir" value="src-gen"/>
>
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <uri value="src/${model}"/>
> <modelSlot value="LTLFormula"/>
> </component>
>
> <component class='org.eclipse.xpand2.Generator'>
> <metaModel id="temporallogic"
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage value="temporallogic.TemporallogicPackage"/>
> </metaModel>
> <metaModel id="slco"
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage value="slco.SlcoPackage"/>
> </metaModel>
> <expand value='template::TemporalLogicPrettyPrinter::prettyPrint FOR
> LTLFormula'/>
> <genPath value='${targetdir}'/>
> </component>
> </workflow>
>
>
> Regards,
>
> Marcel


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xpand] Referenced model unaccessible [message #511341 is a reply to message #510776] Mon, 01 February 2010 10:59 Go to previous message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
Hello Sven,

Thank you for your answer. Inserting the absolute path solved my problem.

However, I am not the only one using this transformation and you can imagine that tehe other users may have a different directory lay-out on their hard drives. This means that they would have to change the workflow in to use this transformation.

Are there other ways to solve my problem?

Regards,
Marcel

[Updated on: Mon, 01 February 2010 11:00]

Report message to a moderator

Previous Topic:Xpand vs Acceleo vs JET
Next Topic:[Acceleo] Inconsistent Line Ending Style
Goto Forum:
  


Current Time: Thu Oct 10 02:43:24 GMT 2024

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

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

Back to the top