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

Zarawhitetaker

Thanks to share these details it’s truly nice. pay day advances

Some factors to think about

Some factors to think about when creating are to prevent over stylized text material, meaning don't feedback entire sections in strong or italics (or both). http://www.realsmokefree.co.uk/

Long tail keywords are

Long tail keywords are basically what we are all looking for in areas, often called small areas. Despite their initiatives to satisfy the public, low requirement or specialized items are still not provided by the popular retailers with one of the highest submission. blog here

High quality custom essay

High quality custom essay writing is the main specialization of special-essays.com.

E-mail marketing application

E-mail marketing application enables companies to reach out to clients directly through e-mails and allows to improve the marketing procedure by offering more prospects. www.3daydetoxplan.com

Those codes are really

Those codes are really helpful. Thanks for your hard work. Keep sharing more.

Real Social Media Services

Advertising is essential so

Advertising is essential so that you can maintain a frequent stream of leads that will buy items, solutions, and/or the income opportunity since prospective customers would be the center of any System promotion prospect... gopro hero 4

I agree with you. This post

I agree with you. This post is truly inspiring. I like your post and everything you share with us is current and very informative, I want to bookmark the page so I can return here from you that you have done a fantastic job. Ibcbet

If some one needs to be

If some one needs to be updated with hottest technologies then he must be pay a quick visit this web page and be up to date everyday. Agen BolaSbobet

Furniture is one of the most

Furniture is one of the most important family items that a person needs. The item of furniture in the houses is to provide a given objective moreover to existing comfort and elegance within the procedure. http://pestexpertsinc.com/

But at side comes a example

But at side comes a example after we keep to be able to take a phase returning and take an purpose study. Especially after it comes to literary works music lines. Naruto Movie 4 The Last

Alisha Fox

This text may be value everyone’s attention. How will I learn more?full coverage on a car

Not long ago a well-known

Not long ago a well-known cafe position a lot of income into their Facebook or myspace fan website on the assistance of the master's partner. blog here

buy essays

Thanks for great post! It's really useful! Best essay writing service на http://buy-essays-now.com

Another type of food that

Another type of food that has been linked to eczema is gluten, or quite simply, foods such as bread, pasta, cereals and oats. Cypherx

Your power expenses come

Your power expenses come down significantly as excellent windows keep the room's temperature constant longer once it has been warmed or chilled. jacquard upholstery fabric

To keep the website on top

To keep the website on top position SEO companies do a variety of services. www.bugskiller.net

Only understand is usually

Only understand is usually done to get visitors for your individual blog, how to create about the factors that you are advertising and the best way to comprehend it in the search engines and search engines positions. address

GREAT!

 the information being published in the blog is very relevant and helpful.. it catches attention of the readers thats why keep on updating and posting your blog.. better check this out. -->

Purchase Pinterest Repins

Engineers are cool they

Engineers are cool they develop new materials that both improve the performance of products and take advantage of advances in technology.

 Be with us to have Real Datpiff Supplier.

Advantage Grand Canyon

This is plus a truly salubrious announce which I truly liked lesson. It is hardly ordinary that I bear the latent to play something love this.Advantage Grand Canyon

Ultimately, understanding

Ultimately, understanding which foods cause eczema comprises two very important things: proper knowledge and a consideration of your own diet. you can check here

Highlight your workers and

Highlight your workers and associates on camaraderie, assurance and open-ness. address

Luck to you!

I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page

wsc biolo program fitnes jual obat online okebgt kerja sampingan

cara menghilangkan bekas jerawat cara cepat tinggi cara menghilangkan bulu Obat Panu

Thanks for taking the time

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

slideshare

I i love your post! it help

I i love your post! it help me a lot.
THANK YOU! keep up the good work!

check this out-->Buy Instagram Photo Likes

If your posts is

If your posts is informative, engaging and impressive enough to be read from top to bottom, the customers will very likely like to visit your web page. san diego dui attorneys

It is discovered in

It is discovered in extensive variety of types, which are most noticeably unique on reasons of shade. The reputation and requirements that this rock keeps, owe a lot to the extensive shade types in which it comes. http://www.johnnyrapid.net

This is also a very

This is also a very good post which I really enjoyed reading. www.rebelmouse.com

I just got to this amazing

I just got to this amazing site not long ago. I
was actually captured with the piece of resources you have got here.
Big thumbs up for making such wonderful blog page! www.rebelmouse.com

I will be interested in more

I will be interested in more similar topics. i
see you got really very useful topics , i will be always checking your
blog thanks. www.rebelmouse.com

Hi! Thanks for the great

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

Thanks for sharing!

Great post i must say and

Great post i must say and thanks for the
information. Education is definitely a sticky subject. However, is still
among the leading topics of our time. I appreciate your post and look
forward to more. www.rebelmouse.com

This is a great inspiring

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information...www.rebelmouse.com

Great Article it its really

Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.

 https://www.rebelmouse.com/vitiligomiracle/

Read It Please !!

It's quiet interesting place, thanks for sharing it. I just loved this discussion.

hotspot shield not working thanks for sharing, will visit again for further updates.

Thanks you very much for

Thanks you very much for sharing these links. Will definitely check this out.

https://www.facebook.com/RisperdalLawsuitCenter

Pretty good post. I just

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.

https://youtube.com/

agen isin4d

I recently examine the theme with great attention however to accomplish the points they will in order to claw their way back when straight into productivity.

agen isin4d

I might want to thank for

I might want to thank for the endeavors you have made in composing this post.

garcinia cambogia
reviews

toko tas wanita branded

thank you so much for writing the article, this can add insight and knowledge to me.
TAS WANITA TERBARU
TAS BRANDED TERBARU
CLICK HERE
TOKO TAS WANITA
TAS WANITA BRANDED

toko tas wanita branded

thank you so much for writing the article, this can add insight and knowledge to me.
http://tokotaswanitabranded.com
tas wanita branded

This article is something

This article is something that will help me with
my class assignment. It helped me to better understand another aspect of
this topic.
I have a presentation incoming week, and I am on the lookout for such information  fifa coins

Thanks

Portable Network Graphics helps me a lot. Thanks and Don't forget about Keeping Christ in Christmas

This is just the information

This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog..

textyourexbackmichaelfiore

Nice article. The

Nice article. The information is really amazing and good. I really want to thank you today for this. This has helped me out a lot and I just wish that you would give more articles like this.

Powered by Drupal - Design by artinet