Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to parse an XMI file to SQL
How to parse an XMI file to SQL [message #1033398] Thu, 04 April 2013 07:44 Go to next message
sams good is currently offline sams goodFriend
Messages: 11
Registered: March 2013
Junior Member
hello,
I've used ATL to generate an XMI file corresponding to an UML Class diagram by following this tutorial .pdf]http://www.eclipse.org/atl/atlTransformations/Class2Relational/ExampleClass2Relational[v00.01].pdf

the XMI is generated successfully and look like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="Relational">
  <Table name="Family" key="/0/@col.0">
    <col name="objectId" keyOf="/0" type="/3"/>
    <col name="name" type="/2"/>
  </Table>
  <Table name="Person" key="/1/@col.0">
    <col name="objectId" keyOf="/1" type="/3"/>
    <col name="firstName" type="/2"/>
    <col name="closestFriendId" type="/3"/>
  </Table>
  <Type name="String"/>
  <Type name="Integer"/>
  <Table name="Person_emailAddresses">
    <col name="PersonId" type="/3"/>
    <col name="emailAddresses" type="/2"/>
  </Table>
  <Table name="Family_members">
    <col name="FamilyId" type="/3"/>
    <col name="membersId" type="/3"/>
  </Table>
</xmi:XMI>


I've tried this library but it couldn't validate the my XMI file.
so, is EMF provide a solution to parse this XMI output file directly to an SQL code ? if not, what do you suggest to me?
thank you.
Re: How to parse an XMI file to SQL [message #1033460 is a reply to message #1033398] Thu, 04 April 2013 08:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Sams,
Maybe the Teneo project can be of help, it supports mapping of emf/ecore models to relational models:
http://wiki.eclipse.org/Teneo/Hibernate

Or if you want to go the standard JPA approach then check out the Texo project:
http://wiki.eclipse.org/Texo

gr. Martin

On 04/04/2013 09:44 AM, sams good wrote:
> hello, I've used ATL to generate an XMI file corresponding to an UML Class diagram by following this tutorial
> http://www.eclipse.org/atl/atlTransformations/Class2Relational/ExampleClass2Relational[v00.01
> the XMI is generated successfully and look like this: <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="Relational">
> <Table name="Family" key="/0/@col.0">
> <col name="objectId" keyOf="/0" type="/3"/>
> <col name="name" type="/2"/>
> </Table>
> <Table name="Person" key="/1/@col.0">
> <col name="objectId" keyOf="/1" type="/3"/>
> <col name="firstName" type="/2"/>
> <col name="closestFriendId" type="/3"/>
> </Table>
> <Type name="String"/>
> <Type name="Integer"/>
> <Table name="Person_emailAddresses">
> <col name="PersonId" type="/3"/>
> <col name="emailAddresses" type="/2"/>
> </Table>
> <Table name="Family_members">
> <col name="FamilyId" type="/3"/>
> <col name="membersId" type="/3"/>
> </Table>
> </xmi:XMI>
>
> I've tried this https://code.google.com/p/xmi-to-sql/ but it couldn't validate the my XMI file. so, is EMF provide a
> solution to parse this XMI output file directly to an SQL code ? if not, what do you suggest to me? thank you.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: How to parse an XMI file to SQL [message #1033485 is a reply to message #1033460] Thu, 04 April 2013 09:20 Go to previous messageGo to next message
sams good is currently offline sams goodFriend
Messages: 11
Registered: March 2013
Junior Member
Thank you Martin for the answer,
for Teneo , I've already tried it and successfully worked. but In my project I need somthing more transparent than Teneo and I only need the .sql script file corresponding to the XMI (Teneo generates a lot of files and packages).
I've thinked for XSLT, but I'd like to know if there is another elegant way to do it?
Re: How to parse an XMI file to SQL [message #1033547 is a reply to message #1033485] Thu, 04 April 2013 10:55 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Sams,
Another option is liquibase (liquibase.org), maybe you can create a xml file which can be read by liquibase. Liquibase
can then generate the ddl/sql for you.

gr. Martin

On 04/04/2013 11:20 AM, sams good wrote:
> Thank you Martin for the answer,
> for Teneo , I've already tried it and successfully worked. but In my project I need somthing more transparent than Teneo
> and I only need the .sql script file corresponding to the XMI (Teneo generates a lot of files and packages). I've
> thinked for XSLT, but I'd like to know if there is another elegant way to do it?


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: How to parse an XMI file to SQL [message #1033601 is a reply to message #1033485] Thu, 04 April 2013 12:24 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
M2T aka Acceleo or JET and you code the templates that works on your metamodel to produce SQL scripts.
Previous Topic:BasicExtendedMetaData.demandRegistry delegation
Next Topic:[Teneo] containment: cannot update .. to null
Goto Forum:
  


Current Time: Thu Apr 18 08:14:46 GMT 2024

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

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

Back to the top