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.

Prerequisites:

   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"      
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"      
                xmlns:xlink="http://www.w3.org/1999/xlink"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
                xmlns:UML="org.omg.xmi.namespace.UML"     
                exclude-result-prefixes="xs xdt UML">

    <!--xsl:key name="class" match="UML:Class" use="@xmi.id" /-->
    <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"/>
        <xsl:apply-templates
                    select="UML:Model/UML:Namespace.ownedElement/UML:Package/UML:Namespace.ownedElement/UML:Class" />     
        <xsl:apply-templates
                    select="UML:Model/UML:Namespace.ownedElement/UML:Package/UML:Namespace.ownedElement/UML:Association"/>
        <xsl:call-template name="post-graph"/>
        <!--xsl:call-template name="attributes"/>
        <xsl:call-template name="functions"/-->
    </xsl:template>
      
    <xsl:template name="attributes">
        int x;
    </xsl:template>
      
    <xsl:template name="functions">
        public static void main(String[] args){
        }
    </xsl:template>
      
    <xsl:template name="pre-graph">
        digraph g {      
        graph [      
        rankdir = "LR"      
        ];

        node [      
        fontsize = "16"      
        shape = "ellipse"
        ];
      
        edge [
        ];
    </xsl:template>
      
    <xsl:template name="post-graph">
        }
    </xsl:template>
      
    <xsl:template match="UML:Namespace.ownedElement/UML:Class">
        <!--"<xsl:value-of select="@xmi.id"/>" [
        label = "<xsl:value-of select="@name"/>"
        shape = "record"
        ];-->
        "<xsl:value-of select="@xmi.id"/>" [
        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>
      
    <xsl:template match="UML:Association.connection">
        <xsl:apply-templates select="UML:AssociationEnd/UML:AssociationEnd.participant/UML:Class"/>
    </xsl:template>

    <xsl:template match="UML:Association">
        <xsl:variable name="f"
                      select="UML:Association.connection/UML:AssociationEnd/UML:AssociationEnd.participant/UML:Class/@xmi.idref"/>
        "<xsl:value-of select="$f[1]"/>" -> "<xsl:value-of select="$f[2]"/>" [
        id = <xsl:value-of select="@xmi.id"/>
        ];
    </xsl:template>

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

­

2. Generate the dot file using the XSL file:

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

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

dot -Tpng -o Diagram.png dotFileName.dot

I tattered to follow mega

I tattered to follow mega than buoyant to get outdated this net-site.I wished to thanks by your compute instead of this first-rate learn!! I clear of cara menang taruhan bola hesitation having enjoyable with all unsatisfactorily fragment of it and I have you bookmarked to get a look subsequently to unspoiled crowd you blog transmit. bursa taruhan bola kualifikasi piala dunia

https://www.rebelmouse.com/penguinmethodreviews/

I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. https://www.rebelmouse.com/penguinmethodreviews/

The key thing to think about

The key thing to think about here is that it can be very easy to just dismiss the above symptoms as a one time occurrence, similar to walking through a patch of poison ivy and having to deal with the continual itchiness, appearance and urge to scratch. address

I want to imply this

I want to imply this codings. I am sure  I can imply this personally. Oris watches

Just awesome buddy Keep Working

Hey buddy really great piece of advice also check out Happy
for Girlfriend Wife boyfriend and husband also check the Valentine 2015 day list
or you can get Latest Happy

garciniacambogiareport.org

It precise a grand dispense is charming to me. Bless the founder!

garciniacambogiareport.org

Hey buddy really great piece

Hey buddy really great piece of advice also check out Happy
for Girlfriend Wife boyfriend and husband also check the valentines day quotes list
or you can get Latest Happy
happy valentines day
happy valentines day 2015

impressive

I will definitely imply this. I am sure this will be provide us great results. step to this link

buy instagram followers

It truly is well written as well as effective how outdated they are completely valuable.

buy instagram
followers

open this link

i really like this post. its very impressive post. i want to know more about this post.

Chain Driven

 Blesss for the advise. I pleasure truly revert. I indeed admire the heartfelt info moreover realitys you proposal alongside your capacity.

Chain Driven

I was very impressed by this

I was very impressed by this post, this site has always been pleasant news Thank you very much for such an interesting post, and I meet them more often then I visited this site

Buy Pinterest Repins

I want you to thank for your

I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!!!! dating

I really had a lot of help

I really had a lot of help from this and I would like to return the favor and that's why I am writing this positive comment for your article. KingSuplemen.com

This is informative and

This is informative and trustworthy. I have not implied this ye3t but sure I will.Moyer Fine Jewelers

We admit your internet site

We admit your internet site in addition to My own organization is always to take a look at the idea additional later on for that reason make sure you keep your overall run.  lawyers quincy ma

Bioelements

Thanks for taking the time to discuss this,
I feel strongly about it and love learning more on this topic. If
possible, as you gain expertise, would you mind updating your blog with
more information? It is extremely helpful for me. Bioelements

why Trouble Spot Training works so well

This is an excellent post I seen thanks to
share it. It is really what I wanted to see hope in future you will
continue for sharing such a excellent post.why Trouble Spot Training works so well

You actually make it look so

You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I’ll try to get the hang of it http://goo.gl/lXJxS0

Awesome blog. I enjoyed

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! http://zonamobilsuzuki.com

Such a very useful article.

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. http://goo.gl/vjKvnZ

Cornell nurse call

This is like my third time visiting your
Blog. You should write more please, this information will help me and
others. Try proof reading a couple of times before publishing. Keep
writing though... Cornell nurse call

It’s a remarkably fact to

It’s a remarkably fact to be able to that will evaluation. Genuinely, Your institution is defined as popular other than realizing when using the world-wide-web United kingdom isles isles isles fact. Absolute best wishes a great deal on the subject of developing a genuine full.. In addition to, The majority of people wanton’s which experts claim enables you to just forget about that dog puppy. Like on the subject of managing..  How to Marry a Millionaire

He should be sociable plant

He should be sociable plant nevertheless cane to hellos studies. He should be established sedulous. powered essays

impressive

I was trying this but failed. You have shared with nice demonstration. I am now confident to do this now myself. delivery service

Your job is going to be

Your job is going to be extremely useful together with My spouse and we get pleasure from a person together with hopping for many much more beneficial written content. Love concerning exposing exceptional information in order to everyone.   money site

You possibly can coordinate

You possibly can coordinate this article through talking about one particular issue very first and then comparing that while using second issue. Geldern

Awesome blog. I enjoyed

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! http://tempatwisata2014.blogspot.com/

Through this post, I know

Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing. desain rumah minimalis 2 lantai

Really great post, Thank you

Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up! baju gamis

I was very impressed by this

I was very impressed by this post, this site has always been pleasant news Thank you very much for such an interesting post, and I meet them more often then I visited this site. http://www.mikegearyguide.com/

I want you to thank for your

I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!!!! obat pelangsing

best mac pc computer repair services west palm beach

Nice work with good ideas and concepts,
lots of great information which we all need, helpful iformation. I would
like to thank you for the efforts you shown remarkble writing skill in
this article.best mac pc computer repair services west palm beach

I know that I was

I know that I was right.Thanks for the information you post. I just subscribe your blog. This is a nice blog.

bitcoin hosting

straight from the source

I really enjoyed the quality information you
offer to your visitors for this blog. I will bookmark this page for my
future reference. Thanks! straight from the source

I've read a couple of from

I've read a couple of from the articles on your web page now, and I genuinely like your style. Thanks a million and please keep up the productive work. Love Problem Solution

I never study whole posts

I never study whole posts although how we had written these details is just awesome and this also maintained my fascination with reading as well as I enjoyed the idea.ecommerce design

Great news

Media blog yang menyajikan beragam jenis Manfaat dari segala hal yang perlu anda ketahui. Seperti Daun Sirsak sebagai obat herbal yang sangat dicari untuk alternative obat tradisional, Buah Naga untuk menjaga system imun agar tetap bereaksi positif, Kulit Manggis untuk dijadikan obat tradisional, dan Minyak Zaitun sebagai bahan pengobatan ataupun untuk kecantikan.

It can be later on in life

It can be later on in life obtaining this sort of objective. Mostly, it can be pretty much make any difference to know which you have just like issues always be kept. debt collector/s

Very efficiently written

Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. eWorldOfAds

http://bestkidsscooter.com/

I really love this. In all the world, I
loved 2 things only at first, 1) football and 2) girls, now I really
love this article as well! Keep up with the amazing work! http://bestkidsscooter.com/

Thank you again for all the

Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit.

Ethical Hacking in
Surat

I am gonna bookmark this

I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.

thank s for sharing this, i've been searching for this for a long time and finally i found it.  wildstar

This information presents

This information presents several details where we're able to cherish the easy reality. I enjoy your energy. thanks inside extended. Love. kamineinsätze preise

Each of us examining for the

Each of us examining for the majority of web sites and also the associate as well as the spouse as well as i certainly observed that employing this. Wonderful product. Kyani

None of the articles that I

None of the articles that I read in this year impressed me as much as this has. Keep it up!

fifa 15 coins

It has been company

It has been company discovering salubrious method on the web. Nonetheless, appreciates on your dispatch, this is the personal of the bygone. The leaderships acquire brought everyone to be able to vertex quality compositions. yes travel review

This is a wonderful article,

This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.

Who's online

There are currently 0 users and 10 guests online.

Powered by Drupal - Design by artinet