Skip to main content

alphaWorks  >  Forums  >  Model Transformation Framework  >  developerWorks

MTF to generate SQL statement?    Point your RSS reader here for a feed of the latest messages in this thread


     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 3 - Pages: 1 - Last Post: Feb 6, 2009 4:38 AM Last Post By: komakoma Threads: [ Previous | Next ]

Posts: 1
Registered: Feb 01, 2006 08:11:33 AM
MTF to generate SQL statement?
Posted: Feb 01, 2006 08:23:59 AM
Click to report abuse...   Click to reply to this thread Reply
I'm new to MTF, thank you all for helping me.

I'm developing a plugin to transform a State Machine model in Rational Software Modeller to relational DB records (the inserts SQL statement).

For example, there is a start State S1, based on transition T2, it goes to S2, and T2 is associated with Event E1 and action A1.

The tables for state machine, state, transition, event, action have been created in DB with their FK links. I need to generate the SQL insert statement based on the model to insert records into the tables. like insert E1 into event table, A1 into action table, T2 into transition table, S1 and S2 into state table with their FKs.

I think this is similar to Ecore2SplitHtml sample, is it right? I can use some template of the inserts SQL. But how can I handle the unique Id for each record though? (We can assume the tables are empty initially)

Also a practical question, in my Rules Editor, I don't have content assistant, what can be wrong in the installation? I use RAD and I unzipped the mtfplugins.zip, rsmplugins.zip into dir C:\Program Files\IBM\Rational\SDP\6.0\rwd\eclipse

Thanks a million for your reply!

Zheng
cgriffin

Posts: 187
Registered: Dec 15, 2004 08:01:22 AM
Re: MTF to generate SQL statement?
Posted: Feb 01, 2006 01:10:34 PM   in response to: in response to: 's post
Click to report abuse...   Click to reply to this thread Reply
Hi Zheng,

I have used MTF to generate DDL, so what you want to do should be possible. In my case I was going from Ecore to RDB to SQL.

The UML objects have XMI ids which you could use as ids for your table entries. I'm afraid there is no built in way in MTF to generate a unique id (you would have to write some code to do it).

The content assist should work, but it is not as nice as the Java editor -you need to press Ctrl-Space and you cannot partially type something and then get content assist based on that. It may not work also if you have syntax errors.
For example, start a new rules file, type in

import xxx "
then press Ctrl-Space - you should get a list of registered EMF packages. If not, something is broken.

Hope that helps,
Catherine.
komakoma

Posts: 2
Registered: Feb 05, 2009 04:10:19 PM
Re: MTF to generate SQL statement?
Posted: Feb 05, 2009 04:13:58 PM   in response to: in response to: 's post
Click to report abuse...   Click to reply to this thread Reply
Zheng,

你好,你的留言是06年的,不知道你现在还关不关注这个网站,希望你能看到我的消息.

我现在刚接触MTF,希望能实现ecore to SQL的 转换,不知道你有没有实例可以给我做个参考,非常感谢.

koma
komakoma

Posts: 2
Registered: Feb 05, 2009 04:10:19 PM
Re: MTF to generate SQL statement?
Posted: Feb 06, 2009 04:38:30 AM   in response to: cgriffin in response to: cgriffin's post
Click to report abuse...   Click to reply to this thread Reply
Hi Catherine.

I'm new to MTF, can you give me your case from Ecore to RDB to SQL as a Example?

Thanks a million for your reply!

Point your RSS reader here for a feed of the latest messages in all forums