Questions on JET transformation project [message #66590] |
Thu, 04 January 2007 23:20  |
Eclipse User |
|
|
|
Originally posted by: rtv222.gmail.com
Hi,
I am trying to get a simple JET transformation project working.
My jet template file has the following:
-------------------------------------------------myJetTempla te.jet------------------------------------------------
<%-- 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="/EPackage"/>
<%-- 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>
-------------------------------------------------myJetTempla te.jet-----------------------------------------------------
my library.ecore has the following:
-------------------------------------------------library.eco re---------------------------------------------------------- ---
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="library"
nsURI="http://www.example.eclipse.org/Library" nsPrefix="library">
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Book"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
unique="false" lowerBound="1"
eType="ecore:EDataType
http://www.eclipse.org/emf/2003/XMLType#//String">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="title"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="BookCategory"/>
</eAnnotations>
<eLiterals name="Mystery"/>
<eLiterals name="ScienceFiction" value="1"/>
<eLiterals name="Biography" value="2"/>
</eClassifiers>
</ecore:EPackage>
-------------------------------------------------library.eco re---------------------------------------------------------- ---
My main.jet template from where the execution of jet begins has a call to
myJetTemplate.jet file.
When I supply "library.ecore" file as my Transformation Input from Run->Jet
Transformation through Eclipse,
I get the following error:
Error: Could not find a loader for
'platform:/resource/dupEMFT/library.ecore'
"dupEMFT being my project name"
I have specified the model loader as "org.eclipse.jet.xml" in the plugin.xml
file of my project.
Am i missing something else here.
Also, Can I use JET to read/transform (generate code) from the XML file
created using
a EMF/GMF editor generated from the library.ecore model. i.e I would like to
generate
my code based on the contents of the xml file not the entities in the ecore
model (created
by importing my xsd)
Can i parse this xml file using ecore apis like the one in my jet template
above (myJetTemplate.jet).
<?xml version="1.0" encoding="UTF-8"?>
<library:Library xmlns:library="http://www.example.eclipse.org/Library">
<name>CentralLibrary</name>
<writers>
<name>DLN</name>
<books>#//@books.0</books>
<books>#//@books.1</books>
</writers>
<books>
<title>About DLN</title>
<pages>25</pages>
<category>Biography</category>
<author>#//@writers.0</author>
</books>
<books>
<title>about mystery</title>
<pages>45</pages>
<author>#//@writers.0</author>
</books>
</library:Library>
Please help.
Thanks in advance.
Rajesh
|
|
|
Re: Questions on JET transformation project [message #68218 is a reply to message #66590] |
Tue, 16 January 2007 10:14  |
Eclipse User |
|
|
|
Rajesh:
Open plugin.xml in your JET project, and set the modelLoader attribute to
'org.eclipse.jet.xml'. See this example:
<extension id="" name="" point="org.eclipse.jet.transform">
<transform
modelLoader="org.eclipse.jet.emf"
....
There is an error in the JET documentation about this (fixed in the 0.7.2
maintenance release).
Paul
"Rajesh T V" <rtv222@gmail.com> wrote in message
news:enkjll$ao2$1@utils.eclipse.org...
> Hi,
>
> I am trying to get a simple JET transformation project working.
>
> My jet template file has the following:
>
> -------------------------------------------------myJetTempla te.jet------------------------------------------------
>
> <%-- 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="/EPackage"/>
>
> <%-- 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>
>
> -------------------------------------------------myJetTempla te.jet-----------------------------------------------------
>
> my library.ecore has the following:
>
> -------------------------------------------------library.eco re---------------------------------------------------------- ---
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="library"
> nsURI="http://www.example.eclipse.org/Library" nsPrefix="library">
> <eClassifiers xsi:type="ecore:EClass" name="Book">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Book"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
> unique="false" lowerBound="1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="title"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="BookCategory"/>
> </eAnnotations>
> <eLiterals name="Mystery"/>
> <eLiterals name="ScienceFiction" value="1"/>
> <eLiterals name="Biography" value="2"/>
> </eClassifiers>
> </ecore:EPackage>
>
> -------------------------------------------------library.eco re---------------------------------------------------------- ---
>
> My main.jet template from where the execution of jet begins has a call to
> myJetTemplate.jet file.
> When I supply "library.ecore" file as my Transformation Input from
> Run->Jet Transformation through Eclipse,
> I get the following error:
> Error: Could not find a loader for
> 'platform:/resource/dupEMFT/library.ecore'
>
> "dupEMFT being my project name"
>
> I have specified the model loader as "org.eclipse.jet.xml" in the
> plugin.xml file of my project.
> Am i missing something else here.
>
> Also, Can I use JET to read/transform (generate code) from the XML file
> created using
> a EMF/GMF editor generated from the library.ecore model. i.e I would like
> to generate
> my code based on the contents of the xml file not the entities in the
> ecore model (created
> by importing my xsd)
>
> Can i parse this xml file using ecore apis like the one in my jet template
> above (myJetTemplate.jet).
>
> <?xml version="1.0" encoding="UTF-8"?>
> <library:Library xmlns:library="http://www.example.eclipse.org/Library">
> <name>CentralLibrary</name>
> <writers>
> <name>DLN</name>
> <books>#//@books.0</books>
> <books>#//@books.1</books>
> </writers>
> <books>
> <title>About DLN</title>
> <pages>25</pages>
> <category>Biography</category>
> <author>#//@writers.0</author>
> </books>
> <books>
> <title>about mystery</title>
> <pages>45</pages>
> <author>#//@writers.0</author>
> </books>
> </library:Library>
>
> Please help.
>
> Thanks in advance.
>
> Rajesh
>
>
|
|
|
Re: Questions on JET transformation project [message #601298 is a reply to message #66590] |
Tue, 16 January 2007 10:14  |
Eclipse User |
|
|
|
Rajesh:
Open plugin.xml in your JET project, and set the modelLoader attribute to
'org.eclipse.jet.xml'. See this example:
<extension id="" name="" point="org.eclipse.jet.transform">
<transform
modelLoader="org.eclipse.jet.emf"
....
There is an error in the JET documentation about this (fixed in the 0.7.2
maintenance release).
Paul
"Rajesh T V" <rtv222@gmail.com> wrote in message
news:enkjll$ao2$1@utils.eclipse.org...
> Hi,
>
> I am trying to get a simple JET transformation project working.
>
> My jet template file has the following:
>
> -------------------------------------------------myJetTempla te.jet------------------------------------------------
>
> <%-- 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="/EPackage"/>
>
> <%-- 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>
>
> -------------------------------------------------myJetTempla te.jet-----------------------------------------------------
>
> my library.ecore has the following:
>
> -------------------------------------------------library.eco re---------------------------------------------------------- ---
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="library"
> nsURI="http://www.example.eclipse.org/Library" nsPrefix="library">
> <eClassifiers xsi:type="ecore:EClass" name="Book">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Book"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title"
> unique="false" lowerBound="1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//String">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> <details key="name" value="title"/>
> </eAnnotations>
> </eStructuralFeatures>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EEnum" name="BookCategory">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="BookCategory"/>
> </eAnnotations>
> <eLiterals name="Mystery"/>
> <eLiterals name="ScienceFiction" value="1"/>
> <eLiterals name="Biography" value="2"/>
> </eClassifiers>
> </ecore:EPackage>
>
> -------------------------------------------------library.eco re---------------------------------------------------------- ---
>
> My main.jet template from where the execution of jet begins has a call to
> myJetTemplate.jet file.
> When I supply "library.ecore" file as my Transformation Input from
> Run->Jet Transformation through Eclipse,
> I get the following error:
> Error: Could not find a loader for
> 'platform:/resource/dupEMFT/library.ecore'
>
> "dupEMFT being my project name"
>
> I have specified the model loader as "org.eclipse.jet.xml" in the
> plugin.xml file of my project.
> Am i missing something else here.
>
> Also, Can I use JET to read/transform (generate code) from the XML file
> created using
> a EMF/GMF editor generated from the library.ecore model. i.e I would like
> to generate
> my code based on the contents of the xml file not the entities in the
> ecore model (created
> by importing my xsd)
>
> Can i parse this xml file using ecore apis like the one in my jet template
> above (myJetTemplate.jet).
>
> <?xml version="1.0" encoding="UTF-8"?>
> <library:Library xmlns:library="http://www.example.eclipse.org/Library">
> <name>CentralLibrary</name>
> <writers>
> <name>DLN</name>
> <books>#//@books.0</books>
> <books>#//@books.1</books>
> </writers>
> <books>
> <title>About DLN</title>
> <pages>25</pages>
> <category>Biography</category>
> <author>#//@writers.0</author>
> </books>
> <books>
> <title>about mystery</title>
> <pages>45</pages>
> <author>#//@writers.0</author>
> </books>
> </library:Library>
>
> Please help.
>
> Thanks in advance.
>
> Rajesh
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03693 seconds