Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to call invoke transform agasin each eClass
How to call invoke transform agasin each eClass [message #68090] Sat, 13 January 2007 08:01 Go to next message
Eclipse UserFriend
Originally posted by: 2236249.gdvnet.com

Hi, I am using emft to gen some codes from a ecore model.
My ecore model has a EPackage and more than one eClass, I want my templates
to transform each eClass.
That is, I have a templte list.emf
I have an ecore model which contains classes: Ant, Cat, Rat
I want to get results
list_ant.jsp
list_cat.jsp
list_rat.jsp
Also since the class name can change anytime, and more classes can be added
in.

Thanks in advance!
Re: How to call invoke transform agasin each eClass [message #68207 is a reply to message #68090] Tue, 16 January 2007 12:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Lipan,

Have you looked at the JET2 examples or looked at the JET articles on
the EMF documentation page?


lipan wrote:
> Hi, I am using emft to gen some codes from a ecore model.
> My ecore model has a EPackage and more than one eClass, I want my templates
> to transform each eClass.
> That is, I have a templte list.emf
> I have an ecore model which contains classes: Ant, Cat, Rat
> I want to get results
> list_ant.jsp
> list_cat.jsp
> list_rat.jsp
> Also since the class name can change anytime, and more classes can be added
> in.
>
> Thanks in advance!
>
>
>
Re: How to call invoke transform agasin each eClass [message #68272 is a reply to message #68090] Tue, 16 January 2007 16:55 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Some useful links:

The EMFT JET (aka JET2) Getting started help pages:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/gettingStarted/index.xhtml

An introductory article on JET2:

http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/

Paul


"lipan" <2236249@gdvnet.com> wrote in message
news:eoa3j1$bn8$1@utils.eclipse.org...
> Hi, I am using emft to gen some codes from a ecore model.
> My ecore model has a EPackage and more than one eClass, I want my
> templates to transform each eClass.
> That is, I have a templte list.emf
> I have an ecore model which contains classes: Ant, Cat, Rat
> I want to get results
> list_ant.jsp
> list_cat.jsp
> list_rat.jsp
> Also since the class name can change anytime, and more classes can be
> added in.
>
> Thanks in advance!
>
Re: How to call invoke transform agasin each eClass [message #69204 is a reply to message #68272] Sat, 27 January 2007 15:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 2236249.gdvnet.com

Thanks for your response

I have read this pages, and have done some emft templates.
But I don't think they can answer my question.

Maybe it is my mistake. But follwing the document, I cann't get what I want
I have a package, it has classes Ant, Cat, Rat
Then I have a tempalte list.emf
What I want is three files,
list_ant.jsp which is based on Ant's properties
and
list_cat.jsp which is based on Cat's properties

This is my list.emf:

<html>
<body>

<c:iterate select="/contents/eClassifiers" var="currNode">
Name = <c:get select="$currNode/@name" />
</c:iterate>

</body>
</html>


yes it produce a file, which list all these classifiers, but I only want
three files, each list one classifiler

I thought <ws:file/> can help me, but it can only process the whole ecore
module(which list all 3 classifers)
I think it may be useful to write something like
<c:iterate select="/contents/eClassifiers" var="currNode">
<ws:file template="list.emf" processnode="$currNode/@name" />
</c:iterate>

but ws:file can't work this way.

> Some useful links:
>
> The EMFT JET (aka JET2) Getting started help pages:
>
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/gettingStarted/index.xhtml
>
> An introductory article on JET2:
>
> http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/
>
> Paul
>
>
> "lipan" <2236249@gdvnet.com> wrote in message
> news:eoa3j1$bn8$1@utils.eclipse.org...
>> Hi, I am using emft to gen some codes from a ecore model.
>> My ecore model has a EPackage and more than one eClass, I want my
>> templates to transform each eClass.
>> That is, I have a templte list.emf
>> I have an ecore model which contains classes: Ant, Cat, Rat
>> I want to get results
>> list_ant.jsp
>> list_cat.jsp
>> list_rat.jsp
>> Also since the class name can change anytime, and more classes can be
>> added in.
>>
>> Thanks in advance!
>>
>
>
Re: How to call invoke transform agasin each eClass [message #69225 is a reply to message #69204] Mon, 29 January 2007 13:21 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Lipan:

Your second instinct is nearly right:

> <c:iterate select="/contents/eClassifiers" var="currNode">
> <ws:file template="list.emf" processnode="$currNode/@name" />
> </c:iterate>

But, JET doesn't do parameter passing the way you are expecting (or for that
matter, the way I'd like it to). The variable 'currNode' is global, so you'd
do the following:

In templates/main.jet:

<c:iterate select="/contents/eClassifiers" var="currNode">
<ws:file template="templates/list.emf.jet"
path="some-project/list_{$currNode/@name}.jsp"/>
</c:iterate>

Note the XPath expression in braces { } embedded in the path attribute. This
can be enhanced using functions to make the name lowercase:

<ws:file template="templates/list.emf.jet"
path="some-project/list_{lower-case($currNode/@name)}.jsp"/ >

Finally, in templates/list.emf.jet, you would do whatever it is you want:

This is the content for: <c:get select="$currNode/@name"/>
....

Paul
Re: How to call invoke transform agasin each eClass [message #69321 is a reply to message #69225] Tue, 30 January 2007 06:01 Go to previous message
Eclipse UserFriend
Originally posted by: 2236249.gdvnet.com

Thank you!
> Lipan:
>
> Your second instinct is nearly right:
>
>> <c:iterate select="/contents/eClassifiers" var="currNode">
>> <ws:file template="list.emf" processnode="$currNode/@name" />
>> </c:iterate>
>
> But, JET doesn't do parameter passing the way you are expecting (or for
> that matter, the way I'd like it to). The variable 'currNode' is global,
> so you'd do the following:
>
> In templates/main.jet:
>
> <c:iterate select="/contents/eClassifiers" var="currNode">
> <ws:file template="templates/list.emf.jet"
> path="some-project/list_{$currNode/@name}.jsp"/>
> </c:iterate>
>
> Note the XPath expression in braces { } embedded in the path attribute.
> This can be enhanced using functions to make the name lowercase:
>
> <ws:file template="templates/list.emf.jet"
> path="some-project/list_{lower-case($currNode/@name)}.jsp"/ >
>
> Finally, in templates/list.emf.jet, you would do whatever it is you want:
>
> This is the content for: <c:get select="$currNode/@name"/>
> ...
>
> Paul
>
Re: How to call invoke transform agasin each eClass [message #601296 is a reply to message #68090] Tue, 16 January 2007 12:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31770
Registered: July 2009
Senior Member
Lipan,

Have you looked at the JET2 examples or looked at the JET articles on
the EMF documentation page?


lipan wrote:
> Hi, I am using emft to gen some codes from a ecore model.
> My ecore model has a EPackage and more than one eClass, I want my templates
> to transform each eClass.
> That is, I have a templte list.emf
> I have an ecore model which contains classes: Ant, Cat, Rat
> I want to get results
> list_ant.jsp
> list_cat.jsp
> list_rat.jsp
> Also since the class name can change anytime, and more classes can be added
> in.
>
> Thanks in advance!
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to call invoke transform agasin each eClass [message #601332 is a reply to message #68090] Tue, 16 January 2007 16:55 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Some useful links:

The EMFT JET (aka JET2) Getting started help pages:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/gettingStarted/index.xhtml

An introductory article on JET2:

http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/

Paul


"lipan" <2236249@gdvnet.com> wrote in message
news:eoa3j1$bn8$1@utils.eclipse.org...
> Hi, I am using emft to gen some codes from a ecore model.
> My ecore model has a EPackage and more than one eClass, I want my
> templates to transform each eClass.
> That is, I have a templte list.emf
> I have an ecore model which contains classes: Ant, Cat, Rat
> I want to get results
> list_ant.jsp
> list_cat.jsp
> list_rat.jsp
> Also since the class name can change anytime, and more classes can be
> added in.
>
> Thanks in advance!
>
Re: How to call invoke transform agasin each eClass [message #601677 is a reply to message #68272] Sat, 27 January 2007 15:43 Go to previous message
Eclipse UserFriend
Originally posted by: 2236249.gdvnet.com

Thanks for your response

I have read this pages, and have done some emft templates.
But I don't think they can answer my question.

Maybe it is my mistake. But follwing the document, I cann't get what I want
I have a package, it has classes Ant, Cat, Rat
Then I have a tempalte list.emf
What I want is three files,
list_ant.jsp which is based on Ant's properties
and
list_cat.jsp which is based on Cat's properties

This is my list.emf:

<html>
<body>

<c:iterate select="/contents/eClassifiers" var="currNode">
Name = <c:get select="$currNode/@name" />
</c:iterate>

</body>
</html>


yes it produce a file, which list all these classifiers, but I only want
three files, each list one classifiler

I thought <ws:file/> can help me, but it can only process the whole ecore
module(which list all 3 classifers)
I think it may be useful to write something like
<c:iterate select="/contents/eClassifiers" var="currNode">
<ws:file template="list.emf" processnode="$currNode/@name" />
</c:iterate>

but ws:file can't work this way.

> Some useful links:
>
> The EMFT JET (aka JET2) Getting started help pages:
>
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/gettingStarted/index.xhtml
>
> An introductory article on JET2:
>
> http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/
>
> Paul
>
>
> "lipan" <2236249@gdvnet.com> wrote in message
> news:eoa3j1$bn8$1@utils.eclipse.org...
>> Hi, I am using emft to gen some codes from a ecore model.
>> My ecore model has a EPackage and more than one eClass, I want my
>> templates to transform each eClass.
>> That is, I have a templte list.emf
>> I have an ecore model which contains classes: Ant, Cat, Rat
>> I want to get results
>> list_ant.jsp
>> list_cat.jsp
>> list_rat.jsp
>> Also since the class name can change anytime, and more classes can be
>> added in.
>>
>> Thanks in advance!
>>
>
>
Re: How to call invoke transform agasin each eClass [message #601680 is a reply to message #69204] Mon, 29 January 2007 13:21 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Lipan:

Your second instinct is nearly right:

> <c:iterate select="/contents/eClassifiers" var="currNode">
> <ws:file template="list.emf" processnode="$currNode/@name" />
> </c:iterate>

But, JET doesn't do parameter passing the way you are expecting (or for that
matter, the way I'd like it to). The variable 'currNode' is global, so you'd
do the following:

In templates/main.jet:

<c:iterate select="/contents/eClassifiers" var="currNode">
<ws:file template="templates/list.emf.jet"
path="some-project/list_{$currNode/@name}.jsp"/>
</c:iterate>

Note the XPath expression in braces { } embedded in the path attribute. This
can be enhanced using functions to make the name lowercase:

<ws:file template="templates/list.emf.jet"
path="some-project/list_{lower-case($currNode/@name)}.jsp"/ >

Finally, in templates/list.emf.jet, you would do whatever it is you want:

This is the content for: <c:get select="$currNode/@name"/>
....

Paul
Re: How to call invoke transform agasin each eClass [message #601717 is a reply to message #69225] Tue, 30 January 2007 06:01 Go to previous message
Eclipse UserFriend
Originally posted by: 2236249.gdvnet.com

Thank you!
> Lipan:
>
> Your second instinct is nearly right:
>
>> <c:iterate select="/contents/eClassifiers" var="currNode">
>> <ws:file template="list.emf" processnode="$currNode/@name" />
>> </c:iterate>
>
> But, JET doesn't do parameter passing the way you are expecting (or for
> that matter, the way I'd like it to). The variable 'currNode' is global,
> so you'd do the following:
>
> In templates/main.jet:
>
> <c:iterate select="/contents/eClassifiers" var="currNode">
> <ws:file template="templates/list.emf.jet"
> path="some-project/list_{$currNode/@name}.jsp"/>
> </c:iterate>
>
> Note the XPath expression in braces { } embedded in the path attribute.
> This can be enhanced using functions to make the name lowercase:
>
> <ws:file template="templates/list.emf.jet"
> path="some-project/list_{lower-case($currNode/@name)}.jsp"/ >
>
> Finally, in templates/list.emf.jet, you would do whatever it is you want:
>
> This is the content for: <c:get select="$currNode/@name"/>
> ...
>
> Paul
>
Previous Topic:[OCL] String Operations
Next Topic:Query 1.1M4
Goto Forum:
  


Current Time: Thu Feb 25 21:55:01 GMT 2021

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

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

Back to the top