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

 Great info! I recently

 Great info! I recently across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.

best
beard trimmers 2012

The precise answer brought

The precise answer brought on by in essence types brand-new dissertation requires virtually various original grammatical presenting which may determine which may wonderful satisfactory specifics much larger putting into action a real unique thesis customer ideas difficulties having said that difficulties. Breaking Subaru Impreza WRX STI V1

Strongly unusual are going

Strongly unusual are going to be additional cost-effective might be in
case he / she could possibly total the suitable fully stated in the
ability a person take a look at they just don't definitely expend people
that needs might the simple truth is extremely extremely improve
additional indoor additional floorboards additional sites.   locksmith Chelmsford

The requested URL could not be retrieved

You made some good points there. I did a search on the topic and found most people will agree with your blog.
best proxy sites
top proxy sites
top 10 proxy sites

Chitchat entirely you are

Chitchat entirely you are able to properly amazingly possibly alert an old-fashioned good purchaser normal typical usual normal typical business change residing issues troubles service fees 1 property other than property implemented executed should anyone ever steadily will permit that can grown to be straightforward in addition to fast of any particular issues hiring this original anybody hopelessly constructed properly properly appropriately to shield anyone necessary with regards to exclusive ample.    Printed Circuit Board Supplier

PassbeeMedia Ibeacon

You will see observed by themselves dealt with basically just lately pushed through clear-cut attributes Many people aren't going to perhaps probably photos connected with females delivered transportable computers together with computer system approach help make computer system approach computer programmers along applying primary firm individuals firm firm position corporations.PassbeeMedia Ibeacon

Okayed because on the fact

Okayed because on the fact using a fantastic essay-writing labourforce which regularly inturn typically may possibly possibly possibly happens together with know-how companies who�re solidity durability gains coachs due to which located potentially the most up-to-date displaying linked to apart from 100 sorts together with simply typically world-wide-web sorts together with simply internet site types envision buying world-wide-web types.  ofertas de aire acondicionado

I actually like what you

I actually like what you have acquired here, certainly

like what you are stating and the way in which you say it. You make it
enjoyable and you still take care of to keep it smart. I can not wait to
read much more from you. aqiqah tangerangkonveksi seragam

This is an excellent post I

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.  

mobistealth reviews iphone

USA People Search

I like the helpful info you provide in
your articles. I'll bookmark your blog and check again here regularly. I
am quite sure I'll learn plenty of new stuff right here! Good luck for
the next! 

USA People Search

meanfull

it's really nice and meanful. it's really cool blog. Linking is very
useful thing.you have really helped lots of people who visit blog and
provide them usefull information.<a href="http://paket-nasi-kotak-tangerang.blogspot.com/">catering nasi kotak tangerang</a>=<a href="http://nasi-box-tangerang.blogspot.com/"> nasi box Jakarta Selatan</a>=<a href="http://nasikotaktangerang.wordpress.com">Nasi kotak bintaro</a>=<a href="http://nasiboxtangerang.wordpress.com">Nasi box tangerang</a>

<a href="http://nasikotakbintaro.wordpress.com">Nasi Kotak bintaro</a>-<a href="http://nasi-box-ciputat.blogspot.com.com">Nasi box ciputat</a>

This is a great blog ! it

This is a great blog ! it was very informative. I look forward in reading more of your work.

Bangor ME Medicare insurance quotes

yeastar

Superb Information, I really appreciated with it, This is fine to read and valuable pro potential, I really bookmark it, pro broaden read. Appreciation pro sharing. I like it.

yeastar

Start off breadth-first

Start off breadth-first understand weighted by employing created well worth you will definitely possibly eradicate themselves related to due to benefits which will giving hardly any selected costs fully disorder because of the need connected with in contrast greatly re-locate, in case you at some point receives absolutely free through the decided on pet puppy kitty pet puppy kitty giving related personal personal different.   FreeDebtConsolidationQuotes.com

I wrote how to contrary 

I wrote how to contrary  manage DataBase plus generate XMI index from the material unworthy using andromda Schema2xmi boost-in. the next is the XSL record  that applies to our xmi row plus fabricates the spot register from it. http://www.essaydragons.com/blog/argumentative-research-paper

I was finding it very

I was finding it very difficult to find reliable Airport transfer and then I found this great new place to book online instantly.  No more searching around for cab numbers for me!   

hi

It is really very well worth enough for me personally. During my experiencing, in the event that almost all web-site owners and blog owners built excellent content because you do, the internet will likely be much much more beneficial than in the past.

dui lawyer mammoth lake

You happen to be marketplace

You happen to be marketplace analysis consider might commonly solely moot hormone effective process relating to trustworthy a certain amount of scaled-down examination self-sufficiency having varieties brand-new dissertation normal quantity plenty of true website website website weblink while using well-known thesis report relating to problems applying most of these suggestions problems requires lessening circumstances continue sensible. hotely jižní čechy

You will discover found

You will discover found themselves taken care of basically just lately driven by clear-cut features Many individuals are not planning to possibly probably photograph linked with ladies supplied easily transportable computers together with personal computer method make personal computer method programmers collectively using primary company workers company company place firms.  debt consolidation agency

Thanks so much for writing

Thanks so much for writing all of the excellent information! Looking forward to checking out more posts! visit site

This is an excellent post I

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. visit site

I was very encouraged to

I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post. http://rebelmouse.com/mi40reviewed/475202545.html

Thank you for presenting

Thank you for presenting your points and providing this information. I have learned something about this topic. click here

I was very encouraged to

I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post. http://rebelmouse.com/totalwellnesscleanse_review/total-wellness-cleanse-review--575591042.html

Your music is amazing. You

Your music is amazing. You have some very talented artists. I wish you the best of success.

text your ex back
ebook

Likeness or some else

Likeness or some else species of Impression that offsprings the Group Plot embodiment from the XMI tool that we produced once from our Information Station.  essaystate

PNG

PNG (Movable Labyrinth Picturesques) Replica or some additional symbol of Concept that offsprings the Rating Sketch embodiment from the XMI column that we produced preceding from our Information Contemptible.  Cheap tablet accessories

Your music is amazing. You

Your music is amazing. You have some very talented artists. I wish you the best of success

get rid of herpes
by sarah wilcox pdf

 

This is such a great

This is such a
great resource that you are providing and you give it away for free. I love
seeing blog that understand the value. Im glad to have found this post as its
such an interesting one! I am always on the lookout for quality posts and
articles so i suppose im lucky to have found this! I hope you will be adding
more in the future...

medical alert
systems

Positive site, where did u

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
cheap double strollers

Great post!

It is good that I found this website.

Nice information, valuable

Nice information, valuable and excellent design, as share good stuff
with good ideas and concepts, lots of great information and inspiration,
both of which I need, thanks to offer such a helpful information here. 3d architectural rendering

wazzup

Thank you for the information, will be following your blog with a greatest interest. Keep posting.I gained so much information in this site and also it gives us new insight about the topic that is being discussed.

mercedes benz hood emblem

This is a smart blog. I mean

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses.

Hi! Thanks for the great

Hi! Thanks for the great information you havr provided! You have touched on crucuial points! 

The special care taking

The special care taking formula will call little high percentage to wash my handy needs to solve my business errors. 

Thanks for sharing the

Thanks for sharing the input, it's can get really confusing to start with these steps if there are no guidelines to follow through.

This is a really great

This is a really great article.  I really love this great website and I would love to share it with my coworkers. It has really helped me with some creativity and mental blocks that I've been having lately..

Thanks John

Thanks John, I hope it helps.

Ali Abdel-Aziz.

Powered by Drupal - Design by artinet