Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Automatic generation of SCH-file from UML
Automatic generation of SCH-file from UML [message #22982] Fri, 04 September 2009 14:26 Go to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I do not know in what forum section to put this topic.

I made for myself adapting to the program Dia, that it can generate code sch-file on UML diagrams.

Example of the complex structure of the tables, such as here,
index.php?t=getfile&id=1911&private=0

you can immediately get ready sch file in the form:

//======================================================================================//
//											//
//			COMPANY								//
//											//
//======================================================================================//
TABLE_(COMPANY)
#ifdef MYSQL_DB
	TABLE_SUFFIX("CHARACTER SET utf8 COLLATE utf8_general_ci\n")
#endif
	INT_	(COM_ID) PRIMARY_KEY AUTO_INCREMENT
	INT_	(COM_GROUPID)
	STRING_ (COM_NAME,500)
	STRING_ (COM_INN,500)
	STRING_ (COM_KPP,500)
	STRING_ (COM_COMMENT,500)
END_TABLE

//======================================================================================//
//											//
//			ACCOUNT								//
//											//
//======================================================================================//
TABLE_(ACCOUNT)
#ifdef MYSQL_DB
	TABLE_SUFFIX("CHARACTER SET utf8 COLLATE utf8_general_ci\n")
#endif
	INT_ 	(ACC_ID)
	INT_	(ACC_CORRID)
	INT_	(ACC_BANKID)
	STRING_ (ACC_NAME,500)
	STRING_ (ACC_ACCOUNT,100)
	STRING_ (ACC_COMMENT,500)
END_TABLE

//======================================================================================//
//											//
//			BANK								//
//											//
//======================================================================================//
TABLE_(BANK)
#ifdef MYSQL_DB
	TABLE_SUFFIX("CHARACTER SET utf8 COLLATE utf8_general_ci\n")
#endif
	INT_	(BNK_ID)
	STRING_	(BNK_NAME,500)
	STRING_	(BNK_BIK,100)
	STRING_	(BNK_CORRACCOUNT,100)
END_TABLE

....
....
The same description of the other files.
....
....






SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Fri, 04 September 2009 14:29]

Report message to a moderator

Re: Automatic generation of SCH-file from UML [message #22985 is a reply to message #22982] Fri, 04 September 2009 14:38 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Cool! Will the binary form of editor be available for others?
Automatic generation of SCH-file from UML [message #22988 is a reply to message #22982] Fri, 04 September 2009 15:02 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

The method is very simple.
1. Setup the program Dia. (http://projects.gnome.org/dia/)

2. Set the updated script codegen.py in the folder
/usr/share/dia/python/ from Attachment

3. Compile all the scripts in the directory
/usr/share/dia/python/
command:
python -mcompileall ./ 
(if necessary, manually remove codegen.pyc before compiling).

4. We follow the simple rules for creating UML diagrams in the program. Here is the description of one table:
index.php?t=getfile&id=1913&private=0

5. Click File -> Export, select the type:
PyDia Code Generation (U++ Sch) (*.sch)

6. We enjoy the results.

PS.
All this was done in UBUNTU 9.04
How to do the same for Windows, I do not know.

PSPS
If you need more detailed descriptions and instructions, I am pleased to share.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Fri, 04 September 2009 15:21]

Report message to a moderator

Automatic generation of SCH-file from UML [message #22989 is a reply to message #22988] Fri, 04 September 2009 15:08 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

The most important thing.

1. This file - codegen.py


must put in a folder
/usr/share/dia/python/

2. remove from this folder codegen.pyc

3. Start compiling all scripts in this folder

python -mcompileall ./ 


4. Dia is ready to export sch-files.
  • Attachment: codegen.py
    (Size: 11.45KB, Downloaded 1234 times)


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Fri, 04 September 2009 15:21]

Report message to a moderator

Re: Automatic generation of SCH-file from UML [message #22990 is a reply to message #22989] Fri, 04 September 2009 15:14 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Of course this way imperfect.

Frankly, I made it for 15 minutes.

And maybe someone will propose how to improve it.

I just like the tool has long wanted to do or how to get something.

Very sad without visual aids to design the database from the set of related tables.

In general, want to see suggestions for improvement.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Automatic generation of SCH-file from UML [message #38397 is a reply to message #22982] Thu, 13 December 2012 21:17 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
MySQL Workbench is by far the best UML modeling tool for databases that I found.

It might be easier to write a script/plugin for that. It supports python too.
Re: Automatic generation of SCH-file from UML [message #38416 is a reply to message #38397] Fri, 14 December 2012 20:24 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Script language - is any of existing. Task is very transparent.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: What do you do first when you start developing an application?
Next Topic: Help me buy a notebook!
Goto Forum:
  


Current Time: Fri Mar 29 15:20:41 CET 2024

Total time taken to generate the page: 0.01995 seconds