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

They charge a lot of cash

They charge a lot of cash and this cash is lost when the website is not rated greater on the look for pages. SEO solutions in Poultry guarantee great results to their clients within a certain period of time. Best Bingo Apps

Excellent and very exciting

Excellent and very exciting site. Love to watch. Keep Rocking.
.COM.MY Domain

Search Engine Marketing

Search Engine Marketing (SEO) provides a better placement of a website using proven optimization techniques, such as the look for for search phrases relevant to the concept of the website, writing and submitting articles relevant to the chosen search phrases, the look for of inbound links... here are the findings

wallens

Nice to
read your article! I am looking forward to sharing your adventures and
experiences.
https://twitter.com/newspaper_cat/status/580957813314228224

wallens

I read that Post and got it fine and informative.
ec choa chu kang ave 5

You know your projects

You know your
projects stand out of the herd. There is something special about them. It
seems to me all of them are really brilliant!

discover more

USB C 3.1

I accept solidly in regards to this thus truly appreciate seeing all the more about this sort of subject.Keep up the great work.type-c

With an improved

With an improved competition in this sphere, entrepreneurs plan to lodge a successful campaign to be able to have an edge over opponents. find this

These are the following to

These are the following to enable men and women by furnishing them best option while in the type of SEO estimates. overview

The website is looking bit

The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.
antoniapearceromance

Excellent article. Very

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

wallens

It is a
great website.. The Design looks very good.. Keep working like that!.
best male
enhancement

Excellent and very

Excellent and very exciting site. Love to watch. Keep Rocking.

Business
Ad

I am happy to find this post

I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing.
ganfx.com

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.
www.tpprocessing.com

Achieve advantages in

Achieve advantages in London, uk are the higher-ranking PR, improve your revenue and also your traffic system position. SEO solutions at London, uk will help interact with your website with other social networking sites these days. important link

Natural SEO is turned out

Natural SEO is turned out to be very useful for the large sites like e-commerce web page. click here to investigate

Thanks for posting

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.
http://manngallery.org/3-good-ways-to-make-a-girl-see-you-as-more-than-a-friend/

Your website is really

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

I recently found many

I
recently found many useful information in your website especially this blog
page. Among the lots of comments on your articles. Thanks for sharing.
شركة مكافحة حشرات

Awesome and

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

SEO Companies in New You are

SEO Companies in New You are able to does a extensive study before involving into any seo action. address

I haven’t any word

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.

cerrajero
Vigo

 

This is really a nice and

This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it,
Online Reserveringssysteem

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.

Loft
conversions Hammersmith

 

Its a great pleasure reading

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.
auto repair sacramento

Instead think about

Instead think about components like What kind of information is getting taught? Is it new, modified or out of date. http://nfluniverse.livejournal.com/

wallensss

Thanks
for the blog post buddy! Keep them coming...
https://www.rebelmouse.com/jennyboltonboostyourbustreview/

Positive site, where

Positive site,
where did u come up with the information on this posting? I'm pleased I
discovered it though, ill be checking back soon to find out what additional
posts you include.
Vera bradley

Determining where to

Determining where to concentrate your perform is just as essential in both aspects of online promotion electric shavers

Thanks for taking the

Thanks for taking
the time to discuss this, I feel strongly about it and love learning more on
this topic.
dvere​ vyrobca

Great post I would like to

Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article.

jackman

So, you try to power nourish

So, you try to power nourish your redundancy to be able to obtain position without dropping people entirely in the procedure. Think "Family Feud" where the aggressive near relatives is known as Dawson. mp3 albums

Pretty good post. I

Pretty
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.
loft conversions
hammersmith

wallens

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. I like visiting you site since
I always come across interesting articles like this one.Great Job, I greatly
appreciate that.Do Keep sharing! Regards,
Desktop Backgrounds

I’ve been searching for

I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..
compounded drugs

wallens

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.
best baby strollers

This article gives the

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.

adjust self
propelled lawn mower

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. website

Thanks for the blog

Thanks for the blog
loaded with so many information. Stopping by your blog helped me to get what
I was looking for.

EasyVideoPlayer2

 

By making regional on the

By making regional on the internet research techniques a aspect of your on the internet promotion technique, you reach prospective clients at the actual time they need you. browse around this site

Great article with excellent

Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information..
buy an essay

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.
Restaurant for Hen
Night

I've enjoyed reading the

I've enjoyed reading the post. It is very informative and useful post. I would like to visit the post once more its valuable content.
Concrete Render

Exactly, you're very kind of

Exactly, you're very kind of us about comment!.
calgary mortgage broker

They deliver the specific

They deliver the specific attributions of one's room directly
into prominence although injecting an original style and also touch that
may spread any glow regarding warmth at home. fashiontiffanyoutlet

Thank you so much Love

Thank
you so much Love your blog..
Spiritual Blog

Girls take advantage of the

Girls take advantage of the great entertaining of gaming just as
the men, and for the kids, there are usually specifically designed games
tailored with their wants. On the net, the selection is fantastic and
enormous. Below are are just some of the variety of games females
typically really like. fashioneaters

Every tiny or large

Every
tiny or large part of that job must be approved and also inspected from
the general company. He could be the overall manager with the entire
venture. General

There are usually some

There are usually some troubles that choose work at home. Perhaps
half the those who start working at home don't do well, mostly as a
result of lack regarding personal self-control or household discipline. Home

Powered by Drupal - Design by artinet