Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Questions on JET transformation project
Questions on JET transformation project [message #600706] Fri, 05 January 2007 04:20
Eclipse UserFriend
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&apos;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
Previous Topic:[Teneo] Library Editor Example not working
Next Topic:Is ecore-based XML browsing possible?
Goto Forum:
  


Current Time: Sun Feb 28 07:54:18 GMT 2021

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

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

Back to the top