Reverse engineer DataBase (episode 2) Generating Class Diagram Image from XMI.

in my last article (Reverse engineer DataBase to XMI.)

I wrote how to reverse  engineer DataBase and produce XMI file from the data base using andromda Schema2xmi plug-in.

in this article I will speak about how to produce PNG (Portable Network Graphics) Image or any other type of Image that produces the Class Diagram representation from the XMI file that we produced earlier from our Data Base.

ok lets start.

I will use XSLT, and graphviz to achieve this task.


   1. XSLT 2.0.

   2. graphviz.

Requiered steps to generate the png class diagram from our xmi file are:

  1. Write XSL file that generate the dot file from our xmi.
  2. Generate the dot file using the XSL file.
  3. Use graphviz to generate the png image from the dot file.

1. Writing the XSL transformer file that generate the dot file from our xmi:

the following is the XSL file (XMITransformer.xsl) that applies to our xmi file and produces the dot file from it.


<xsl:stylesheet version="2.0"      
                exclude-result-prefixes="xs xdt UML">

    <!--xsl:key name="class" match="UML:Class" use="" /-->
    <xsl:output method="text" media-type="text/xml" indent="yes" encoding="ISO-8859-1" />
    <xsl:variable name="from" select="0"/>
    <xsl:variable name="to" select="NON"/>
    <xsl:template match="XMI.header"/>
    <xsl:template match="XMI.content">
        <xsl:call-template name="pre-graph"/>
                    select="UML:Model/UML:Namespace.ownedElement/UML:Package/UML:Namespace.ownedElement/UML:Class" />     
        <xsl:call-template name="post-graph"/>
        <!--xsl:call-template name="attributes"/>
        <xsl:call-template name="functions"/-->
    <xsl:template name="attributes">
        int x;
    <xsl:template name="functions">
        public static void main(String[] args){
    <xsl:template name="pre-graph">
        digraph g {      
        graph [      
        rankdir = "LR"      

        node [      
        fontsize = "16"      
        shape = "ellipse"
        edge [
    <xsl:template name="post-graph">
    <xsl:template match="UML:Namespace.ownedElement/UML:Class">
        <!--"<xsl:value-of select=""/>" [
        label = "<xsl:value-of select="@name"/>"
        shape = "record"
        "<xsl:value-of select=""/>" [
        label = "<xsl:value-of select="@name"/> | <xsl:value-of select="@visibility"/> |  "
        shape = "record"
        <!--xsl:text>  </xsl:text>
        <xsl:value-of select="@visibility"/-->
        <!-- new Line character-->
        <!--xsl:text>&#xa;        </xsl:text-->
    <xsl:template match="UML:Association.connection">
        <xsl:apply-templates select="UML:AssociationEnd/UML:AssociationEnd.participant/UML:Class"/>

    <xsl:template match="UML:Association">
        <xsl:variable name="f"
        "<xsl:value-of select="$f[1]"/>" -> "<xsl:value-of select="$f[2]"/>" [
        id = <xsl:value-of select=""/>

    <xsl:template match="UML:Attribute">


2. Generate the dot file using the XSL file:

 java net.sf.saxon.Transform -o transformed.xmi XMITransformer.xsl

3. Use graphviz to generate the png image from the dot file:

dot -Tpng -o Diagram.png

great awesome Christmas

great awesome Christmas Wishes and Quotes
Merry Christmas Wishes

Christmas Merry Christmas

New Year

Dilwale Movie of SRK Dilwale

(No subject)

Awesome post thanks for

Awesome post thanks for sharinf
CAT Results
CAT Result
CAT Results

The first version of the Girlfriend System was a 7-part video course that quickly gained a cult-like following from men looking for more than just casual flings with women.

Interesting and

Interesting and
amazing how your post is! It Is Useful and helpful for me That I like it very
much. and I am looking forward to Hearing from your next..

philipiak opinie

Yes i am totally

Yes i am
totally agreed with this article and i just want say that this article is
very nice and very informative article.I will make sure to be reading your
blog more. You made a good point but I can't help but wonder. what about the
other side? !!!!!!THANKS!!!!!!

The Respect Principle

I really appreciate

I really
appreciate this wonderful post that you have provided for us. I assure this
would be beneficial for most of the people.

office removals kent

Great job for

job for publishing such a beneficial web site. Your web log isn’t only useful
but it is additionally really creative too. There tend to be not many people
who can certainly write not so simple posts that artistically. Continue the
nice writing

How to Deal with a Bad Break Up

it was a wonderful

it was a
wonderful chance to visit this kind of site and I am happy to know. thank you
so much for giving us a chance to have this opportunity..


This article gives the light

This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article.

emlak franchise

very interesting

interesting post.this is my first time visit here.i found so mmany
interesting stuff in your blog especially its discussion..thanks for the
yacon syrup where to buy

I really loved reading

I really loved
reading your blog. It was very well authored and easy to undertand. Unlike
additional blogs I have read which are really not tht good. I also found your
posts very interesting. In fact after reading. I had to go show it to my
friend and he ejoyed it as well!

KY Sedan

I've been looking for info on this topic for a while. I'm happy this one is so great. Keep up the excellent work.

USB C 3.1

This article gives the light in which we can observe the reality. This is very nice one and gives in depth information. Thanks for this nice article.usb c adapter

Brett Slater

It’s getting towards the end of the year now, and you might think it’s too hard to find a beanie who you can trust to get the job done on time. We’re about to take away your problem and we’ll even carry all your risk.Brett Slater

I found your this post

I found your this
post while searching for some related information on blog search...Its a good
post..keep posting and update the information.

rebel mouse

But let me just scenario

But let me just scenario this before we record the causes why you would need professional SEO speaking with solutions, if you want something done right from the start, you need an individual that knows the organization and how factors are done. Why, because cost-effective commitment methods are there to improve your benefits. overview

But let me just scenario

But let me just scenario this before we record the causes why you would need professional SEO speaking with solutions, if you want something done right from the start, you need an individual that knows the organization and how factors are done. Clicking Here

That makes your website

That makes your website shift slowly in buffing and what's most likely to occur is that people will get fed up with patiently waiting and keep your website. for beginners

Reputable SEO organizations

Reputable SEO organizations have a proven record of increases in the variety of prospective buyers that visit your company web page. Dachtechnik

For example, in order to

For example, in order to allocate several positions, this functionfeature will become very useful if you have a method or large company, you'll have a long contact list and do not need everyone is able to hassle the CEO straight, so why would not you set a part to limit the customer's access. lan messenger

Once you've located a top

Once you've located a top executing SEO, don't anticipate to contact the photos. Website optimizers have certain objectives of their customers. her explanation

We offer a truly

We offer a truly cost-effective SEO support for only $129 monthly and shift you up online ranking positions each 30 days or you don't pay. We even business 100 % free SEO in come returning for percentage on web revenue with certain companies. Just contact to see if you are eligible. next story


reasonable comments here...
Text A Psychic

nice les privat

Pretty good post. I

good post
. I just stumbled upon your blog and
wanted to say that I have really enjoyed reading your blog posts. Any way
I'll be subscribing to your feed and I hope you post again soon. Big thanks
for the useful info.

ad agencies los angeles

If you delegate your SEO

If you delegate your SEO technique you will have observed that over the past several years SEO services have been improving their prices regularly. my blog

Seo and Look for press

Seo and Look for press marketing are two key factors to achieve the preferred success in the web world. look at here now

If you buy hyperlinks these

If you buy hyperlinks these may get you more extremely rated in the SERPS for a brief while, until they are found, and your web page drops its greater pagerank because its popularity has become ruined. Links that are not appropriate to your web page are punished when you have a large number of them, and you will discover your web page reduced than it was before in the SERPS.

Our of customer care through

Our of customer care through efficient top quality procedures are always focused to our clients. click to find out more

contoh surat lamaran kerja

nice this information

contoh surat lamaran kerja

Normally on the internet

Normally on the internet look for engine program will check out the primary web page of a web page and then look for more links in or out type that web page and if program found those sites, it will follow those sites and add them to the option immediately. Also an easy course-plotting program will enhance your client's satisfaction. metin2 wiki

I believe even a general

I believe even a general evaluation of the first 21 grabs in Catch-22, if I could offer them in the appropriate purchase, would go way beyond describing Catch-22. Go Here

Thank you for taking the

Thank you for taking the time to publish this information very useful!
דרור הלוי

Cloud Computing

The moment iQuest carryout an THE ITEM Audit with your business, we will probably recommend the most beneficial Cloud solutions available for you. Like every little thing, the Cloud is an effective solution even so, it has its very own set connected with limitations. Our THE ITEM Audit will probably highlight this on your business and provides alternative storage devices solutions. Cloud Computing


article. Very interesting to read. I really love to read such a nice article.
Thanks! keep rocking.

euromillions online

SEO Solutions in Adelaide

SEO Solutions in Adelaide Company is offerring genuine products and companies lately. If your website demands to wind up Online marketing, always consider impressive mind in picking the SEO Adelaide Organization. this link


Nice to
read your article! I am looking forward to sharing your adventures and


Seek the solutions of SEO

Seek the solutions of SEO Professional to recognize the right kind of company strategy which is suited best for your company.

useful information on topics

useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!..

Absolutely fantastic

Absolutely fantastic posting! Lots of useful information and inspiration, both of which we all need!Relay appreciate your work.
1 800 Title Loan LA


I read that Post and got it fine and informative.

Fat Diminisher

Searching for some if the

Searching for some if the Best SEO Company Dallas to offer your company the right tools and knowledge is a very challenging task if you don't really know what to expect when it comes to know what really needs optimizations on you web page to achieve some excellent positions for your targeted keywords and phrases and or key phrases.

Powered by Drupal - Design by artinet