Using Jet Transformation with EMF documents [message #66698] |
Fri, 05 January 2007 07:15  |
Eclipse User |
|
|
|
Originally posted by: lakshmi.dnarayana.yahoo.com
Hi,
Can anyone please tell me what does the following mean in the
help.eclipse.org/emft JET developer site:
<%-- contents of main.jet that reads handles a .ecore file --%>
<%-- import the ecore namespace --%>
<%@jet imports="org.eclipse.emf.ecore.*"%>
<c:setVariable var="ePackage" select="/contents"/>
<%-- write to the JET execution console --%>
<c:log>
EPackage: <c:get select="$ePackage/@name"/>
<c:iterate select="$ePackage/eClassifiers" var="eClassifier">
<%
EClassifier ec = (EClassifier)context.getVariable("eClassifier");
%>
EClassifier: <c:get select="$eClassifier/@name"/>. Really it's <%=
ec.getName() %>
</c:iterate>
</c:log>
I have not been able to find a way to load an ecore model and browse the way
they have specified.
Thanks,
LN
|
|
|
Re: Using Jet Transformation with EMF documents [message #68227 is a reply to message #66698] |
Tue, 16 January 2007 10:29  |
Eclipse User |
|
|
|
LN:
The example assumes the following:
1) You created a new EMFT JET project using the New Project Wizard.
2) You opened plugin.xml, and added the following to the 'tranform' element:
modelLoader="org.eclipse.jet.emf"
(This tells the JET transformation to load its input document using EMF
rather than as an XML document.)
3) You paste the sample code into the already created file
'templates/main.jet'.
4) You create a JET Tranformation launch configuration as follows.
a) Click the menu Run > Run...
b) Select JET Transformation, and click the icon for a new configuration
c) You select a file with a .ecore extension as the input
d) You specify the JET project you created in 1) as the transformation to
execute.
If you do all of the above, the template will write the following to the JET
execution log. It will not create any files.
* The name of the EPackge at the root of the .ecore file
* The names of the EClassifiers contained by this EPackage.
The point of the example was to demonstrate:
* How XPath expressions traverse EMF models by matching EMF feature names to
XPath steps
* How to access XPath variables via Java code
* That JET is not adding a 'layer' over an EMF model - JET XPath expressions
are evaluated directly against the model.
Paul
"lakshmi" <lakshmi.dnarayana@yahoo.com> wrote in message
news:enlfhp$fmm$1@utils.eclipse.org...
> Hi,
>
> Can anyone please tell me what does the following mean in the
> help.eclipse.org/emft JET developer site:
>
> <%-- contents of main.jet that reads handles a .ecore file --%>
> <%-- import the ecore namespace --%>
> <%@jet imports="org.eclipse.emf.ecore.*"%>
>
> <c:setVariable var="ePackage" select="/contents"/>
>
> <%-- write to the JET execution console --%>
> <c:log>
> EPackage: <c:get select="$ePackage/@name"/>
> <c:iterate select="$ePackage/eClassifiers" var="eClassifier">
> <%
> EClassifier ec = (EClassifier)context.getVariable("eClassifier");
> %>
> EClassifier: <c:get select="$eClassifier/@name"/>. Really it's <%=
> ec.getName() %>
> </c:iterate>
> </c:log>
>
> I have not been able to find a way to load an ecore model and browse the
> way
> they have specified.
>
> Thanks,
> LN
>
>
|
|
|
Re: Using Jet Transformation with EMF documents [message #601304 is a reply to message #66698] |
Tue, 16 January 2007 10:29  |
Eclipse User |
|
|
|
LN:
The example assumes the following:
1) You created a new EMFT JET project using the New Project Wizard.
2) You opened plugin.xml, and added the following to the 'tranform' element:
modelLoader="org.eclipse.jet.emf"
(This tells the JET transformation to load its input document using EMF
rather than as an XML document.)
3) You paste the sample code into the already created file
'templates/main.jet'.
4) You create a JET Tranformation launch configuration as follows.
a) Click the menu Run > Run...
b) Select JET Transformation, and click the icon for a new configuration
c) You select a file with a .ecore extension as the input
d) You specify the JET project you created in 1) as the transformation to
execute.
If you do all of the above, the template will write the following to the JET
execution log. It will not create any files.
* The name of the EPackge at the root of the .ecore file
* The names of the EClassifiers contained by this EPackage.
The point of the example was to demonstrate:
* How XPath expressions traverse EMF models by matching EMF feature names to
XPath steps
* How to access XPath variables via Java code
* That JET is not adding a 'layer' over an EMF model - JET XPath expressions
are evaluated directly against the model.
Paul
"lakshmi" <lakshmi.dnarayana@yahoo.com> wrote in message
news:enlfhp$fmm$1@utils.eclipse.org...
> Hi,
>
> Can anyone please tell me what does the following mean in the
> help.eclipse.org/emft JET developer site:
>
> <%-- contents of main.jet that reads handles a .ecore file --%>
> <%-- import the ecore namespace --%>
> <%@jet imports="org.eclipse.emf.ecore.*"%>
>
> <c:setVariable var="ePackage" select="/contents"/>
>
> <%-- write to the JET execution console --%>
> <c:log>
> EPackage: <c:get select="$ePackage/@name"/>
> <c:iterate select="$ePackage/eClassifiers" var="eClassifier">
> <%
> EClassifier ec = (EClassifier)context.getVariable("eClassifier");
> %>
> EClassifier: <c:get select="$eClassifier/@name"/>. Really it's <%=
> ec.getName() %>
> </c:iterate>
> </c:log>
>
> I have not been able to find a way to load an ecore model and browse the
> way
> they have specified.
>
> Thanks,
> LN
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds