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

  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.
  • : Function split() is deprecated in /home/content/22/3380422/html/modules/filter/filter.module on line 1190.

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

This type of message

This
type of message always inspiring and I prefer to read quality content. so
happy to find good place to many here in the post. the writing is just great.
thanks for the post.

Language of Desire

This is a smart blog.

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.

New Jersey Project Manager

Nice post! This is a

Nice
post! This is a very nice blog that I will definitively come back to more
times this year! Thanks for informative post.

социальные сети

Interesting and amazing how

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..  Austin Dental Implants

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!

​joyce meyer sermon

Nice post. I learn some

Nice post. I learn some thing tougher on distinct blogs everyday. Most commonly it is stimulating to learn to read content from other writers and exercise a specific thing there. I’d would rather use some together with the content in my weblog no matter whether you don’t mind. Natually I’ll provide you with a link in your web weblog. Many thanks for sharing.
Obsession Phrases Free

Thanks for the nice blog. It

Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post.

upsee

I would like to thank you

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks...
pemutih badan

Keep up the goodwork .

Keep up
the goodwork . I read few postson thisweb siteand Iconceive that your blogis veryinteresting and hassetsoffantasticinformation.
Unlock Your Hip Flexors

All the contents you

All the contents
you mentioned in post is too good and can be very useful. I will keep it in
mind, thanks for sharing the information keep updating, looking forward for
more posts.Thanks

I just found this blog

I just
found this blog and have high hopes for it to continue. Keep up the great
work. its hard to find good ones. I have added to my favorites. Thank You.

Latest tspsc news

This is highly

This is
highly informatics. crisp and clear. I think that everything has been
described in systematic manner so that reader could get maximum information
and learn many things.

tightening the vagina

I know your expertise on

I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information.

Youtubeonfire

 

Wow. cool post. I’d like

Wow. cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though.
apps for pc go

I just found this blog

I just found this
blog and have high hopes for it to continue. Keep up the great work, its hard
to find good ones. I have added to my favorites. Thank You.

rocket chinese

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 websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine.
https://www.rebelmouse.com/edprotocolreviews/

Wow i can say that this is

Wow i can say that this is another great article as expected of this blog.Bookmarked this site..
yandex

I really appreciate

I really
appreciate the kind of topics you post here. Thanks for sharing us a great
information that is actually helpful. Good day!

eliteprint-solution.com

Your website is really

Your
website is really cool and this is a great inspiring article. Thank you so
much.

republique-dominicaine.com

Awesome and

Awesome
and interesting article. Great things you've always shared with us. Thanks.
Just continue composing this kind of post.

Releasing Creature – The Way To Give Life

Keep up the goodwork .

Keep up
the goodwork . I read few postson thisweb siteand Iconceive that your blogis veryinteresting and hassetsoffantasticinformation.

russian toys

Nice post. I was checking

Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specially the last part I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck.
How to Clean the Coils of a Commercial Deep Fryer

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.

best loans

I can’t imagine

I can’t
imagine focusing long enough to research; much less write this kind of
article.You’ve outdone yourself with
this material.This is great content.

Обучение за рубежом​

I wanted to thank you for

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post.

cannabis dispensary Tacoma

I’ve read some good

I’ve
read some good stuff here. Definitely worth bookmarking for revisiting. I
surprise how much effort you put to create such a great informative website.

Xbox

Great info! I recently came

Great info! I recently came 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.
Nom de domaine gratuit

I like this post.And I guess

I like this post.And I guess that they having fun to read this post.they shall take a good site to make a information.thanks for sharing it to me.
What Men Want in a Woman

I’ve read some good stuff

I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website.
http://pasada.org

I went over this

I went over this
websiteand Ibelieveyou have a lot ofwonderfulinformation,saved to my bookmarks

Happy
New Year SMS 2016

I found your this post while

I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information.
he's not that complicated

Very good points you wrote

Very good points you wrote here..Great stuff...I think you've made some truly interesting points.Keep up the good work.

Seattle SEO companies

This is a truly good site

This is a truly good site post. Not too many people would actually. the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best. with so much class. If wanted to know more about green smoke reviews. than by all means come in and check our stuff.
IT Support for LAW firms

I can see that you are an

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
Patreon Sailing

I wish more authors of this

I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight.
MountOcean

I haven’t any word to

I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
financial advisor

Great post. you have

Great
post. you have pointed out some excellent points. I as well believe this is a
very superb website.

travel tips

Thanks so much for

Thanks
so much for sharing this awesome info! I am looking forward to see more
postsby you!

 

Cosmic Ordering Secrets pdf

Good post but I was

Good post but I was wondering if you could write a litter more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it!
cf card recovery mac

  I really loved

 

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!

 

5 Figure Day

Just admiring your

Just
admiring your work and wondering how you managed this blog so well. It’s so
remarkable that I can't afford to not go through this valuable information
whenever I surf the internet!

M88 Wap
Casino

Thoughts

Hello to every body, it's my first pay a quick visit of this blog; this weblog includes remarkable and actually fine data in favor of visitors.
http://www.marinesalvageantiques.com/
www.apexchemicals.co.th
www.lhekleela.com
Smoothgraph
Shoes website
Battlearchery
ezpinoy

Admiring the time and

Admiring the time
and effort you put into your blog and detailed information you offer!..
ID Theft

spartagen reviews

A lot of men face the issue of low testosterone levels within their bodies. Not only does this take away all of their sexual energy but it also tends to leave them frustrated and embarrassed at the same time.spartagen reviews

the ed miracle

The rising condition of erectile problem is getting worse day by day as it has effected almost 18 million men in U.S. only. Men who are unable to get firm erection find this situation as a reason of shame and anxiety for them.the ed miracle

Thanks for posting this

Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.
maytag refrigerator repair

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 websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine.
football picks

I felt very happy while

I felt very happy while reading this site. This was really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!.
agen judi online

I am hoping the same best

I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me.
Invitation samples

I felt very happy

I felt
very happy while reading this site. This was really very informative site for
me. I really liked it. This was really a cordial post. Thanks a lot!.

Калъфи

Powered by Drupal - Design by artinet