You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2006/06/27 21:07:38 UTC

svn commit: r417558 - in /db/torque/site/trunk/xdocs/tools: index.xml schema2erd.xsl

Author: tfischer
Date: Tue Jun 27 12:07:38 2006
New Revision: 417558

URL: http://svn.apache.org/viewvc?rev=417558&view=rev
Log:
Adding Patrick Carl's Mogwai ERDesigner stylesheet from the contrib directory from the 3.1.1 branch

Added:
    db/torque/site/trunk/xdocs/tools/schema2erd.xsl
Modified:
    db/torque/site/trunk/xdocs/tools/index.xml

Modified: db/torque/site/trunk/xdocs/tools/index.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/tools/index.xml?rev=417558&r1=417557&r2=417558&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/tools/index.xml (original)
+++ db/torque/site/trunk/xdocs/tools/index.xml Tue Jun 27 12:07:38 2006
@@ -17,12 +17,13 @@
 
 <document>
   <properties>
-    <title>Transforming DBDesigner Schemas into Torque Format</title>
+    <title>Transforming other Formats from/to Torque Format</title>
     <author email="tv@apache.org">Thomas Vandahl</author>
+    <author email="fischer@seitenbau.de">Thomas Fischer</author>
   </properties>
 
   <body>
-   <section name="D4-Torque.xslt">
+   <section name="DBDesigner">
      <p>
        <a href="http://fabforce.net/dbdesigner4/">DBDesigner</a> is a tool which 
        helps with database design. It is made for MySQL databases, mostly. 
@@ -35,8 +36,6 @@
        simply fire up the XSLT-processor of your choice and give it the DBDesigner
        model as an input.
      </p>
-   </section>
-   <section name="Status">
      <p>
        This script was made for transforming a certain model into the associated
        Torque schema. So basically, &quot;It works for me&quot;. Mostly the mapping
@@ -49,6 +48,23 @@
        is currently in Beta status. As far as we can see, the format of the
        model files will need adjustment when it's ready.
      </p>
+   </section>
+
+   <section name="Mogwai ERDesigner">
+     <p>
+       <a href="http://mogwai.sourceforge.net/erdesigner/erdesigner.html">Mogwai ERDesigner</a>
+       is a tool for vizualizing the Database structure which uses an
+       XML-based file format.
+       The stylesheet <a href="schema2erd.xsl">schema2erd.xsl</a> translates
+       a Torque-schema into the mogwai-format.  It transforms entities
+       (=tables), attributes (=columns) and relations (=foreign-keys).
+     </p>
+      
+     <p>
+       Only the location of the entities is missing so you have to arrange
+       them by yourself.  If somebody uses mogwai and Torque, this stylesheet
+       may be helpful.
+     </p>
    </section>
   </body>
 </document>

Added: db/torque/site/trunk/xdocs/tools/schema2erd.xsl
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/tools/schema2erd.xsl?rev=417558&view=auto
==============================================================================
--- db/torque/site/trunk/xdocs/tools/schema2erd.xsl (added)
+++ db/torque/site/trunk/xdocs/tools/schema2erd.xsl Tue Jun 27 12:07:38 2006
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+    Document   : schema2erd.xsl
+    Created on : 7. September 2004, 13:12
+    Author     : carlptr
+
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="html"/>
+
+    <xsl:template match="database">
+        <ERDesignerModel version="0.9.2">
+            
+            <Entities>
+                <xsl:apply-templates select="table"/>
+            </Entities>
+            <Relations>
+                <xsl:for-each select="table/foreign-key">
+                    <xsl:call-template name="f-key"/>
+                </xsl:for-each>
+            </Relations>
+        </ERDesignerModel>
+    </xsl:template>
+
+    
+    <xsl:template match="table">
+        <Entity>
+            <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+            <xsl:attribute name="comment"><xsl:value-of select="@description"/></xsl:attribute>
+            <xsl:apply-templates/>
+        </Entity>
+    </xsl:template>
+    
+    <xsl:template match="column">
+        <Attribute>
+            <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+            <xsl:attribute name="isrequired"><xsl:value-of select="@required"/></xsl:attribute>
+            <xsl:attribute name="isprimarykey"><xsl:value-of select="@primaryKey"/></xsl:attribute>
+            <xsl:attribute name="defaultvalue"><xsl:value-of select="@default"/></xsl:attribute>
+            <xsl:attribute name="comment"><xsl:value-of select="@description"/></xsl:attribute>
+        </Attribute>
+    </xsl:template>
+    
+    <xsl:template name="f-key">
+        <Relation>
+            <xsl:attribute name="type">non-identifying</xsl:attribute>
+            <xsl:attribute name="delete-rule">DATABASE_DEFAULT</xsl:attribute>
+            <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+            <xsl:attribute name="primary"><xsl:value-of select="@foreignTable"/></xsl:attribute>
+            <xsl:attribute name="secondary"><xsl:value-of select="parent::table/@name"/></xsl:attribute>
+            <Mapping>
+                <xsl:attribute name="primary"><xsl:value-of select="reference/@foreign"/></xsl:attribute>
+                <xsl:attribute name="secondary"><xsl:value-of select="reference/@local"/></xsl:attribute>                
+            </Mapping>
+        </Relation>
+    </xsl:template>
+</xsl:stylesheet>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org