xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkro...@apache.org
Subject svn commit: r111460 - in xmlbeans/trunk/samples: . db db/vxsdb db/vxsdb/doc db/vxsdb/schemas db/vxsdb/sql db/vxsdb/src db/vxsdb/src/java db/vxsdb/src/java/org db/vxsdb/src/java/org/apache db/vxsdb/src/java/org/apache/xmlbeans db/vxsdb/src/java/org/apache/xmlbeans/samples db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb db/vxsdb/xml
Date Fri, 10 Dec 2004 03:04:42 GMT
Author: kkrouse
Date: Thu Dec  9 19:04:41 2004
New Revision: 111460

URL: http://svn.apache.org/viewcvs?view=rev&rev=111460
Log:
Initial checkin of XMLBeans + Velocity sample
Added:
   xmlbeans/trunk/samples/db/
   xmlbeans/trunk/samples/db/vxsdb/
   xmlbeans/trunk/samples/db/vxsdb/README.txt
   xmlbeans/trunk/samples/db/vxsdb/build.xml
   xmlbeans/trunk/samples/db/vxsdb/datamodel.vm
   xmlbeans/trunk/samples/db/vxsdb/doc/
   xmlbeans/trunk/samples/db/vxsdb/doc/NOTES.txt
   xmlbeans/trunk/samples/db/vxsdb/doc/vxsdb.html
   xmlbeans/trunk/samples/db/vxsdb/global.vm
   xmlbeans/trunk/samples/db/vxsdb/property.vm
   xmlbeans/trunk/samples/db/vxsdb/run.xml
   xmlbeans/trunk/samples/db/vxsdb/schemas/
   xmlbeans/trunk/samples/db/vxsdb/schemas/easypo.xsd
   xmlbeans/trunk/samples/db/vxsdb/sql/
   xmlbeans/trunk/samples/db/vxsdb/sql/create.sample.sql
   xmlbeans/trunk/samples/db/vxsdb/src/
   xmlbeans/trunk/samples/db/vxsdb/src/java/
   xmlbeans/trunk/samples/db/vxsdb/src/java/log4j.xml
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb/
   xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb/VelocityXmlBeansDB.java
   xmlbeans/trunk/samples/db/vxsdb/type.vm
   xmlbeans/trunk/samples/db/vxsdb/xml/
   xmlbeans/trunk/samples/db/vxsdb/xml/datamodel.sample.xml
Modified:
   xmlbeans/trunk/samples/build.xml

Modified: xmlbeans/trunk/samples/build.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/build.xml?view=diff&rev=111460&p1=xmlbeans/trunk/samples/build.xml&r1=111459&p2=xmlbeans/trunk/samples/build.xml&r2=111460
==============================================================================
--- xmlbeans/trunk/samples/build.xml	(original)
+++ xmlbeans/trunk/samples/build.xml	Thu Dec  9 19:04:41 2004
@@ -21,6 +21,7 @@
         clean-SampleTemplate,
         clean-MixedContent,
         clean-OrderMatters,
+        clean-vxsdb,
         clean-SchemaEnum,
         clean-SubstitutionGroup,
         clean-DateTime">
@@ -39,6 +40,10 @@
         <ant dir="cursor/OrderMatters" target="clean"/>
     </target>
 
+    <target name="clean-vxsdb">
+        <ant dir="db/vxsdb" target="clean"/>
+    </target>
+
     <target name="clean-SchemaEnum">
         <ant dir="enumeration/SchemaEnum" target="clean"/>
     </target>
@@ -57,6 +62,7 @@
         build-SampleTemplate,
         build-MixedContent,
         build-OrderMatters,
+        build-vxsdb,
         build-SchemaEnum,
         build-SubstitutionGroup,
         build-DateTime">
@@ -74,6 +80,10 @@
         <ant dir="cursor/OrderMatters" target="build"/>
     </target>
 
+    <target name="build-vxsdb">
+        <ant dir="db/vxsdb" target="build"/>
+    </target>
+
     <target name="build-SchemaEnum">
         <ant dir="enumeration/SchemaEnum" target="build"/>
     </target>
@@ -93,6 +103,7 @@
         test-SampleTemplate,
         test-MixedContent,
         test-OrderMatters,
+        test-vxsdb,
         test-SchemaEnum,
         test-SubstitutionGroup,
         test-DateTime">
@@ -110,6 +121,10 @@
         <ant dir="cursor/OrderMatters" target="test"/>
     </target>
 
+    <target name="test-vxsdb">
+        <ant dir="db/vxsdb" target="test"/>
+    </target>
+
     <target name="test-SchemaEnum">
         <ant dir="enumeration/SchemaEnum" target="test"/>
     </target>
@@ -128,6 +143,7 @@
         dist-SampleTemplate,
         dist-MixedContent,
         dist-OrderMatters,
+        dist-vxsdb,
         dist-SchemaEnum,
         dist-SubstitutionGroup,
         dist-DateTime">
@@ -186,6 +202,21 @@
             basedir="cursor"
             includes="OrderMatters/**"
             excludes="OrderMatters/build/**"
+            compression="gzip"
+            />
+    </target>
+
+    <target name="dist-vxsdb">
+        <mkdir dir="build"/>
+        <zip destfile="build/vxsdb.zip"
+            basedir="db"
+            includes="vxsdb/**"
+            excludes="vxsdb/build/**"
+            />
+        <tar destfile="build/vxsdb.tgz"
+            basedir="db"
+            includes="vxsdb/**"
+            excludes="vxsdb/build/**"
             compression="gzip"
             />
     </target>

Added: xmlbeans/trunk/samples/db/vxsdb/README.txt
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/README.txt?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/README.txt	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,51 @@
+Sample: VelocityXmlBeans
+Category: sql
+Author: Philip Mark Donaghy
+Last Updated: Dec. 4, 2004
+
+Versions:
+    xmlbeans-v1 1.0.3
+    xmlbeans-v2
+
+--------------------------------------------------------------------------------
+
+Vxsdb is a XmlBeans sample application which derives a Jakarta Commons SQL data 
+model from an xml schema. It was conceived from things I have learned from using
+XmlBeans and talking to people at the ASF conference. Vxsdb uses Jakarta 
+Velocity as its templating engine.
+
+Features:
+
+    - Inputs a xml schema
+    - Outputs an Commons SQL data model in xml
+
+Building this sample requires Jakarta dependancies which are automatically 
+downloaded to the lib directory when Ant is executed.
+
+To try out this sample:
+
+1. Set XMLBEANS_HOME in your environment
+2. Ant must be on your PATH
+3. To compile the sample source, run "ant"
+4. To execute the sample, run "ant -f run.xml"
+5. The files xml/datamodel.xml and sql/create.sql are generated
+
+To build this sample without downloading dependencies
+-----------------------------------------------------
+ant -Ddeps.exist=true
+
+By default run creates a ddl for the Postgres RDBMS. To change the target 
+database add a directive on the command line.
+
+Change database
+---------------
+ant -f run.xml -DtargetDatabase=oracle
+
+Postgres quickstart
+-------------------
+$ su -
+# su - postgres
+$ initdb
+$ createdb easypo
+$ psql easypo
+# \i xml/create.sql

Added: xmlbeans/trunk/samples/db/vxsdb/build.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/build.xml?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/build.xml	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2002-2004 Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<project name="vxsdb-build" default="build">
+
+    <property environment="env" />
+    <property name="targetDatabase" value="postgresql" />
+
+    <description>
+            Sample integration of Velocity and XmlBeans to produce a Jakarta commons-sql datamodel.xml file.
+    </description>
+
+    <target name="build" depends="init,getdeps" description="Compile the sample code">
+        <javac srcdir="src/java" destdir="build">
+            <classpath>
+                <pathelement location="lib/ant-1.6.2.jar" />
+                <pathelement location="lib/commons-logging-1.0.3.jar" />
+                <pathelement location="lib/velocity-1.4.jar" />
+                <path refid="xmlbeans.path" />
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="getdeps" unless="deps.exist">
+        <get dest="lib/ant-1.6.2.jar" src="http://www.ibiblio.org/maven/ant/jars/ant-1.6.2.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-beanutils-1.7.0.jar" src="http://www.ibiblio.org/maven/commons-beanutils/jars/commons-beanutils-1.7.0.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-betwixt-0.5.jar" src="http://www.ibiblio.org/maven/commons-betwixt/jars/commons-betwixt-0.5.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-collections-3.1.jar" src="http://www.ibiblio.org/maven/commons-collections/jars/commons-collections-3.1.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-digester-1.5.jar" src="http://www.ibiblio.org/maven/commons-digester/jars/commons-digester-1.5.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-logging-1.0.3.jar" src="http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.3.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/commons-sql-1.0-dev.jar" src="http://www.ibiblio.org/maven/commons-sql/jars/commons-sql-1.0-dev.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/dom4j-1.4.jar" src="http://www.ibiblio.org/maven/dom4j/jars/dom4j-1.4.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/log4j-1.2.8.jar" src="http://www.ibiblio.org/maven/log4j/jars/log4j-1.2.8.jar" verbose="true" usetimestamp="true" />
+        <get dest="lib/velocity-1.4.jar" src="http://www.ibiblio.org/maven/velocity/jars/velocity-1.4.jar" verbose="true" usetimestamp="true" />
+    </target>
+
+    <target name="init" description="Precompiler initialization">
+
+        <property name="xmlbeans.home" value="${env.XMLBEANS_HOME}" />
+        <echo message="xmlbeans.home: ${xmlbeans.home}" />
+
+        <!-- check for xbean.jar from binary distribution -->
+        <available property="xmlbeans.lib" value="${xmlbeans.home}/lib" file="${xmlbeans.home}/lib/xbean.jar" />
+
+        <!-- check for xbean.jar compiled from source -->
+        <available property="xmlbeans.lib" value="${xmlbeans.home}/build/lib" file="${xmlbeans.home}/build/lib/xbean.jar" />
+
+        <fail message="Set XMLBEANS_HOME in your enviornment." unless="xmlbeans.lib" />
+
+        <echo message="xmlbeans.lib: ${xmlbeans.lib}" />
+        <path id="xmlbeans.path">
+            <fileset dir="${xmlbeans.lib}" includes="*.jar" />
+        </path>
+
+        <mkdir dir="lib" />
+        <mkdir dir="build" />
+        <copy file="src/java/log4j.xml" todir="build" />
+    </target>
+
+    <target name="clean" description="Delete the compiled code">
+        <delete dir="build" />
+    </target>
+
+</project>

Added: xmlbeans/trunk/samples/db/vxsdb/datamodel.vm
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/datamodel.vm?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/datamodel.vm	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,47 @@
+## Copyright 2002-2004 Apache Software Foundation
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## Database template used by the sample XmlBeans Velocity integration.
+## Using the SchemaTypeSystem of XmlBeans this template produces an 
+## Jakarta commons-sql datamodel.xml file.
+## This template expoits the SchemaTypeSystem XmlBeans object
+## present in the Velocity context using the $xsd identifier.
+<?xml version="1.0" encoding="UTF-8"?>
+
+<database name="sample">
+
+    <!-- Global Elements -->
+#foreach($global in $xsd.globalElements())## SchemaGlobalElement[]
+
+    <!-- Table $global.name -->
+    <table name='$global.name.localPart.toUpperCase().replace("-","_")'>
+
+    #set($global = $global.type)
+    #parse("global.vm")
+
+    </table>
+#end
+
+    <!-- Global Types -->
+#foreach($global in $xsd.globalTypes())## SchemaType[]
+
+    <!-- Table $global.name -->
+    <table name='$global.name.localPart.toUpperCase().replace("-","_")'>
+
+    #parse("global.vm")
+
+    </table>
+#end
+
+</database>

Added: xmlbeans/trunk/samples/db/vxsdb/doc/NOTES.txt
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/doc/NOTES.txt?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/doc/NOTES.txt	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,27 @@
+This document keeps track of issues with sql-commons, xmlbeans, or velocity 
+integration in this sample.
+
+The easypo.xsd file implies a foreign key in the table line-item. This can 
+be determined by the unbounded definition of the purchase order element. A 
+better mechanism would be to include database primary and foreign key 
+relationships in the xml schema itself.
+
+Problems running the sample. Java 1.5.0 seems to be the only runtime to 
+resolve the String method replace("-","_").
+
+The run target fails with the following error:
+
+BUILD FAILED: /home/phil/soft/work/vxsdb/run.xml:30: 
+org.apache.xmlbeans.XmlException: Thread main: The 0th supplied input is 
+not a schema or a config document: its type is N=
+
+Execute a script containing the java command below if Ant is not available.
+
+Unix:
+run
+
+Cygwin:
+runcygwin
+
+Windows:
+run

Added: xmlbeans/trunk/samples/db/vxsdb/doc/vxsdb.html
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/doc/vxsdb.html?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/doc/vxsdb.html	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,391 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+	<TITLE></TITLE>
+	<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.1  (Linux)">
+	<META NAME="CREATED" CONTENT="20041121;23172400">
+	<META NAME="CHANGED" CONTENT="20041205;321800">
+	<STYLE>
+	<!--
+		@page { size: 8.5in 11in; margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
+		H1 { margin-bottom: 0.08in }
+		H1.western { font-family: "Bitstream Vera Sans", sans-serif; font-size: 16pt }
+		H1.cjk { font-family: "HG Mincho Light J", "MS Mincho", "HG Mincho J", "HG Mincho L", "HG Mincho", "Mincho", "MS PMincho", "HG Mincho Light J", "MS Gothic", "HG Gothic J", "HG Gothic B", "HG Gothic", "Gothic", "MS PGothic", "Andale Sans UI", "Arial Unicode MS", "Lucida Sans Unicode", "Tahoma"; font-size: 16pt }
+		H1.ctl { font-family: "Tahoma", "Lucidasans", "Lucida Sans", "Arial Unicode MS"; font-size: 16pt }
+		P { margin-bottom: 0.08in }
+		H2 { margin-bottom: 0.08in }
+		H2.western { font-family: "Bitstream Vera Sans", sans-serif; font-size: 14pt; font-style: italic }
+		H2.cjk { font-family: "HG Mincho Light J", "MS Mincho", "HG Mincho J", "HG Mincho L", "HG Mincho", "Mincho", "MS PMincho", "HG Mincho Light J", "MS Gothic", "HG Gothic J", "HG Gothic B", "HG Gothic", "Gothic", "MS PGothic", "Andale Sans UI", "Arial Unicode MS", "Lucida Sans Unicode", "Tahoma"; font-size: 14pt; font-style: italic }
+		H2.ctl { font-size: 14pt; font-style: italic }
+	-->
+	</STYLE>
+</HEAD>
+<BODY LANG="en-US" DIR="LTR">
+<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT FACE="Times, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Creating
+a Jakarta Commons SQL datamodel using XmlBeans and Velocity</B></FONT></FONT></P>
+<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT FACE="Times, serif"><FONT SIZE=3><I><B>Philip
+Mark Donaghy</B></I></FONT></FONT></P>
+<H1 CLASS="western">1 <FONT FACE="Times, serif">About Vxsdb</FONT></H1>
+<P><FONT SIZE=3><FONT FACE="Times, serif">Vxsdb is a sample XmlBeans
+application which derives a Jakarta Commons SQL data model from an
+xml schema. It was conceived from things I have learned from using
+XmlBeans and talking to people at the ASF conference.</FONT></FONT></P>
+<P><FONT FACE="Times, serif">Vxsdb uses Jakarta Velocity as its
+templating engine. At runtime a SchemaTypeSystem XmlBeans object is
+created from compiling an xml schema. This object is placed in a
+Velocity context. A template processes the objects global elements,
+global types and generates a Jakarta Commons SQL xml datamodel
+descriptor of tables and columns.</FONT></P>
+<H2 CLASS="western">1.1 Requirements</H2>
+<P><FONT FACE="Times, serif">Java 1.5</FONT></P>
+<H2 CLASS="western">1.2 Getting Started</H2>
+<P><FONT FACE="Times, serif">The basic utilization compiles the
+sample and produces a database schema for a given xml schema.</FONT></P>
+<P><FONT FACE="Times, serif">Execute the command “ant”</FONT></P>
+<P><FONT FACE="Times, serif">This compiles the sample.</FONT></P>
+<P><FONT FACE="Times, serif">Execute the command “ant -f run.xml”</FONT></P>
+<P><FONT FACE="Times, serif">This creates the Jakarta Commons SQL
+datamodel.xml and creates the create.sql ddl.</FONT></P>
+<H2 CLASS="western"><FONT FACE="Bitstream Vera Sans">1.3
+Configuration</FONT></H2>
+<P><FONT FACE="Times, serif">Vxsdb can be configured by modifying the
+command line parameters to specify another template, output or xml
+schema.</FONT></P>
+<P><FONT FACE="Times, serif">ant -f run.xml -Dtemplate=datamodel.vm
+-Doutput=database.xml -Dschema=easypo.xsd</FONT></P>
+<H2 CLASS="western">1.4 Generating database schema</H2>
+<P><FONT FACE="Times, serif">Included in the sample run.xml is an Ant
+target which generates the ddl used to create the database tables.
+The default database is PostgreSQL.</FONT></P>
+<P><FONT FACE="Times, serif">ant -f run.xml</FONT></P>
+<P><FONT FACE="Times, serif">To change the target database use,</FONT></P>
+<P><FONT FACE="Times, serif">ant -f run.xml -DtargetDatabase=oracle</FONT></P>
+<H2 CLASS="western">1.5 Determining Tables, Columns, and Table
+relationships</H2>
+<P><FONT FACE="Times, serif">Tables are created from all global
+elements and most global types.</FONT></P>
+<P><FONT FACE="Times, serif">For each schema property the sample
+application determines if it is a column, an exported key (foreign
+key to another table), or an imported foreign key (another entity
+who's table contains a foreign back to this entity).</FONT></P>
+<P><FONT FACE="Times, serif">If a schema property (attribute or
+element) is a simple type without restriction a column is created and
+one of the following Commons SQL values is assigned to the property.
+DATE, DECIMAL, FLOAT, INTEGER, TIME, TIMESTAMP, or VARCHAR.</FONT></P>
+<P><FONT FACE="Times, serif">If a schema property is a simple type
+with a restriction then a column is created and one of the above
+values is assigned in addition to a size attribute.</FONT></P>
+<P><FONT FACE="Times, serif">If a schema property is a complex type
+with no maxOccurs or minOccurs (meaning that it is required) then a
+foreign key column is entered into the database table descriptor and
+the required attribute is set to true.</FONT></P>
+<P><FONT FACE="Times, serif">If a schema property is a complex type
+with maxOccurs equal to one then a foreign key column is entered into
+the database table.</FONT></P>
+<P><FONT FACE="Times, serif">If a schema property is a complex type
+with maxOccurs greater than one or unbounded then a imported key
+(foreign key from this type's table) is required. This presents a
+problem. The Velocity template may have already encountered this
+complex type and created its table descriptor without even knowing
+about this relationship. This is known as the Imported Key Question.</FONT></P>
+<H2 CLASS="western">1.6 Solving the Imported Key Question</H2>
+<P><FONT FACE="Times, serif">Iterate the SchemaTypeSystem in the Java
+class to determine imported keys.</FONT></P>
+<P><FONT FACE="Times, serif">Cliff told me that ms has a solution to
+this which may be included in the xml schema.</FONT></P>
+<H2 CLASS="western">1.7 Additional ideas</H2>
+<P><FONT FACE="Times, serif"><FONT SIZE=3>Combining XmlBeans and
+Velocity templates can result in other interesting xml schema related
+technologies.</FONT></FONT></P>
+<P><FONT FACE="Times, serif">Using a similar approach to this sample
+XmlBeans and Velocity can harness the xml schema and generate
+documentation, a relational database model, or even data access
+objects.</FONT></P>
+<H2 CLASS="western">1.8 Sample datamodel.xml</H2>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;?xml
+version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;database
+name=&quot;sample&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+Global Elements --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;table
+name=&quot;PURCHASE_ORDER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PK&quot; type=&quot;INTEGER&quot; required=&quot;true&quot;
+primaryKey=&quot;true&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=customer@http://openuri.org/easypo --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;FK_CUSTOMER&quot; required=&quot;true&quot; type=&quot;INTEGER&quot;
+/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;foreign-key
+foreignTable=&quot;CUSTOMER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;reference
+local=&quot;FK_CUSTOMER&quot; foreign=&quot;PK&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/foreign-key&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=dateTime@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;DATE&quot; type=&quot;TIMESTAMP&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+Foreign key imported from table named LINE_ITEM --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=shipper@http://openuri.org/easypo --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;FK_SHIPPER&quot; type=&quot;INTEGER&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;foreign-key
+foreignTable=&quot;SHIPPER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;reference
+local=&quot;FK_SHIPPER&quot; foreign=&quot;PK&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/foreign-key&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/table&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+Global Types --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;table
+name=&quot;CUSTOMER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PK&quot; type=&quot;INTEGER&quot; required=&quot;true&quot;
+primaryKey=&quot;true&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=string@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;NAME&quot; type=&quot;VARCHAR&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=string@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;ADDRESS&quot; type=&quot;VARCHAR&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=int@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;AGE&quot; type=&quot;TINYINT&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=int@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;MOO&quot; type=&quot;TINYINT&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=int@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;POO&quot; type=&quot;TINYINT&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/table&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;table
+name=&quot;LINE_ITEM&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PK&quot; type=&quot;INTEGER&quot; required=&quot;true&quot;
+primaryKey=&quot;true&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=string@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;DESCRIPTION&quot; type=&quot;VARCHAR&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=decimal@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PER_UNIT_OUNCES&quot; type=&quot;DECIMAL&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=decimal@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PRICE&quot; type=&quot;DECIMAL&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=integer@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;QUANTITY&quot; type=&quot;INTEGER&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+Exported key --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;FK_PURCHASE_ORDER&quot; required=&quot;true&quot;
+type=&quot;INTEGER&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;foreign-key
+foreignTable=&quot;PURCHASE_ORDER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;reference
+local=&quot;FK_PURCHASE_ORDER&quot; foreign=&quot;PK&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/foreign-key&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/table&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;table
+name=&quot;SHIPPER&quot;&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PK&quot; type=&quot;INTEGER&quot; required=&quot;true&quot;
+primaryKey=&quot;true&quot;/&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=string@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;NAME&quot; type=&quot;VARCHAR&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;!--
+T=decimal@http://www.w3.org/2001/XMLSchema --&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;column
+name=&quot;PER_OUNCE_RATE&quot; type=&quot;DECIMAL&quot; /&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/table&gt;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>&lt;/database&gt;</FONT></FONT></P>
+<H2 CLASS="western">1.9 Sample create.sql</H2>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>drop
+table SHIPPER;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>drop
+table LINE_ITEM;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>drop
+table CUSTOMER;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>drop
+table PURCHASE_ORDER;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+PURCHASE_ORDER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>create
+table PURCHASE_ORDER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>(</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PK
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>FK_CUSTOMER
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>DATE
+TIMESTAMP NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>FK_SHIPPER
+INTEGER NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PRIMARY
+KEY (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>);</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ALTER
+TABLE PURCHASE_ORDER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ADD
+CONSTRAINT PURCHASE_ORDER_FK_1 FOREIGN KEY (FK_CUSTOMER)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>REFERENCES
+CUSTOMER (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ALTER
+TABLE PURCHASE_ORDER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ADD
+CONSTRAINT PURCHASE_ORDER_FK_2 FOREIGN KEY (FK_SHIPPER)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>REFERENCES
+SHIPPER (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+CUSTOMER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>create
+table CUSTOMER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>(</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PK
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>NAME
+VARCHAR NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ADDRESS
+VARCHAR NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>AGE
+TINYINT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>MOO
+TINYINT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>POO
+TINYINT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PRIMARY
+KEY (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>);</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+LINE_ITEM</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>create
+table LINE_ITEM</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>(</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PK
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>DESCRIPTION
+VARCHAR NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PER_UNIT_OUNCES
+DECIMAL NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PRICE
+DECIMAL NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>QUANTITY
+INTEGER NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>FK_PURCHASE_ORDER
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PRIMARY
+KEY (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>);</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ALTER
+TABLE LINE_ITEM</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>ADD
+CONSTRAINT LINE_ITEM_FK_1 FOREIGN KEY (FK_PURCHASE_ORDER)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>REFERENCES
+PURCHASE_ORDER (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>;</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+SHIPPER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>--
+-----------------------------------------------------------------------</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>create
+table SHIPPER</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>(</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PK
+INTEGER NOT NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>NAME
+VARCHAR NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PER_OUNCE_RATE
+DECIMAL NULL ,</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>PRIMARY
+KEY (PK)</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><FONT FACE="Monospace"><FONT SIZE=2>);</FONT></FONT></P>
+<P STYLE="margin-bottom: 0in"><BR>
+</P>
+<P><BR><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file

Added: xmlbeans/trunk/samples/db/vxsdb/global.vm
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/global.vm?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/global.vm	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,33 @@
+## Copyright 2002-2004 Apache Software Foundation
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## This template expoits the SchemaType XmlBeans object using the $global
+## identifier.
+
+        <column name="PK" type="INTEGER" required="true" primaryKey="true"/>
+    #foreach($property in $global.properties)## SchemaProperty[]
+        ## Column name and data type. Columns may be foreign keys
+
+        #parse("property.vm")
+    #end
+    #if( $exportedKeyMap.get($global.name.toString()) )## Map returns a List
+        #foreach($exportedKey in $exportedKeyMap.get($global.name.toString()))## String in List
+
+        <!-- Exported key -->
+        <column name="FK_$exportedKey" type="INTEGER" />
+        <foreign-key foreignTable="$exportedKey">
+            <reference local="FK_$exportedKey" foreign="PK"/>
+        </foreign-key>
+        #end
+    #end

Added: xmlbeans/trunk/samples/db/vxsdb/property.vm
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/property.vm?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/property.vm	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,46 @@
+## Copyright 2002-2004 Apache Software Foundation
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## Property template used by the sample XmlBeans Velocity integration.
+## This template expoits the SchemaProperty XmlBeans object to determine
+## if the column is a data type or foreign key
+#if($property.type.simpleType)
+
+        <!-- $property.type -->
+        <column name='$property.name.localPart.toUpperCase().replace("-","_")' type='#parse("type.vm")' />
+#elseif( $property.maxOccurs.intValue() == 1 && $property.minOccurs.intValue() == 0 )
+
+        <!-- $property.type -->
+        <column name='FK_$property.name.localPart.toUpperCase().replace("-","_")' type="INTEGER" />
+        <foreign-key foreignTable='$property.name.localPart.toUpperCase().replace("-","_")'>
+            <reference local='FK_$property.name.localPart.toUpperCase().replace("-","_")' foreign="PK"/>
+        </foreign-key>
+#elseif( $property.maxOccurs.intValue() == 1 )
+
+        <!-- $property.type -->
+        <column name='FK_$property.name.localPart.toUpperCase().replace("-","_")' required="true" type="INTEGER" />
+        <foreign-key foreignTable='$property.name.localPart.toUpperCase().replace("-","_")'>
+            <reference local='FK_$property.name.localPart.toUpperCase().replace("-","_")' foreign="PK"/>
+        </foreign-key>
+#elseif( $property.maxOccurs.intValue() > 1 || "$!property.maxOccurs" == "")## Greater than one or unbounded
+
+        <!-- Foreign key imported from table named $property.name.localPart.toUpperCase().replace("-","_") -->
+#else
+
+        <!-- This is a debug line that provides information for properties -->
+        <!-- that are not handled in the property.vm template logic. -->
+        <!-- SimpleType:$property.type.simpleType -->
+        <!-- maxOccurs:"$property.maxOccurs" -->
+        <!-- column name='$property.name.localPart.toUpperCase().replace("-","_")' type=""/ -->
+#end

Added: xmlbeans/trunk/samples/db/vxsdb/run.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/run.xml?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/run.xml	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2002-2004 Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<project name="vxsdb-runtime" default="create-db-sql">
+
+    <description>
+        Execute vxsdb sample.
+    </description>
+
+    <property environment="env" />
+    <property name="targetDatabase" value="postgresql" />
+    <property name="schema" value="schemas/easypo.xsd" />
+    <property name="template" value="datamodel.vm" />
+    <property name="output" value="xml/datamodel.xml" />
+    <property name="ddl" value="sql/create.sql" />
+
+    <path id="vxsdb.runtime.classpath">
+        <pathelement path="build" />
+        <pathelement location="lib/ant-1.6.2.jar" />
+        <pathelement location="lib/commons-collections-3.1.jar" />
+        <pathelement location="lib/commons-logging-1.0.3.jar" />
+        <pathelement location="lib/log4j-1.2.8.jar" />
+        <pathelement location="lib/velocity-1.4.jar" />
+        <path refid="xmlbeans.path" />
+    </path>
+
+    <path id="commons-sql.runtime.classpath">
+        <pathelement location="lib/commons-beanutils-1.7.0.jar" />
+        <pathelement location="lib/commons-betwixt-0.5.jar" />
+        <pathelement location="lib/commons-collections-3.1.jar" />
+        <pathelement location="lib/commons-digester-1.5.jar" />
+        <pathelement location="lib/commons-logging-1.0.3.jar" />
+        <pathelement location="lib/commons-sql-1.0-dev.jar" />
+        <pathelement location="lib/dom4j-1.4.jar" />
+    </path>
+
+    <target name="run" depends="init" description="Run the sample code">
+        <!-- VelocityXmlBeans Task -->
+        <taskdef name="vxsdb" classname="org.apache.xmlbeans.samples.vxsdb.VelocityXmlBeansDB" description="The task used to run the sample code." classpathref="vxsdb.runtime.classpath" />
+        <!-- Substitute any of your own schemas templates and output files -->
+        <vxsdb schema="${schema}" template="${template}" output="${output}" />
+    </target>
+
+    <target name="runjava" depends="init" description="Run the sample code">
+        <!-- VelocityXmlBeans Task -->
+        <java classname="org.apache.xmlbeans.samples.vxsdb.VelocityXmlBeansDB" fork="yes" failonerror="yes" classpathref="vxsdb.runtime.classpath">
+            <arg value="${template}" />
+            <arg value="${output}" />
+            <arg value="${schema}" />
+        </java>
+    </target>
+
+    <target name="create-db-sql" depends="runjava" description="Create an sql script (DDL) from the xml datamodel">
+        <!-- Jakarta Commons SQL Task-->
+        <taskdef name="ddl" classname="org.apache.commons.sql.task.DDLTask" description="The task used to create a ddl from the datamodel xml." classpathref="commons-sql.runtime.classpath" />
+        <ddl xmlFile="${output}" targetDatabase="${targetDatabase}" output="${ddl}" />
+    </target>
+
+    <target name="clean" description="Delete the generated files">
+        <delete file="xml/datamodel.xml" />
+        <delete file="sql/create.sql" />
+    </target>
+
+    <target name="init" description="Preexecution initialization">
+
+        <property name="xmlbeans.home" value="${env.XMLBEANS_HOME}" />
+        <echo message="xmlbeans.home: ${xmlbeans.home}" />
+
+        <!-- check for xbean.jar from binary distribution -->
+        <available property="xmlbeans.lib" value="${xmlbeans.home}/lib" file="${xmlbeans.home}/lib/xbean.jar" />
+
+        <!-- check for xbean.jar compiled from source -->
+        <available property="xmlbeans.lib" value="${xmlbeans.home}/build/lib" file="${xmlbeans.home}/build/lib/xbean.jar" />
+
+        <fail message="Set XMLBEANS_HOME in your enviornment." unless="xmlbeans.lib" />
+
+        <echo message="xmlbeans.lib: ${xmlbeans.lib}" />
+        <path id="xmlbeans.path">
+            <fileset dir="${xmlbeans.lib}" includes="*.jar" />
+        </path>
+
+    </target>
+
+</project>
+

Added: xmlbeans/trunk/samples/db/vxsdb/schemas/easypo.xsd
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/schemas/easypo.xsd?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/schemas/easypo.xsd	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,57 @@
+<!-- Copyright 2004 The Apache Software Foundation
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License. -->
+<xs:schema
+   xmlns:xs="http://www.w3.org/2001/XMLSchema"
+   xmlns:po="http://openuri.org/easypo"
+   targetNamespace="http://openuri.org/easypo"
+   elementFormDefault="qualified">
+
+  <xs:element name="purchase-order">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="customer" type="po:customer"/>
+        <xs:element name="date" type="xs:dateTime"/>
+        <xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
+        <xs:element name="shipper" type="po:shipper" minOccurs="0" maxOccurs="1"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:complexType name="customer">
+    <xs:sequence>
+      <xs:element name="name" type="xs:string"/>
+      <xs:element name="address" type="xs:string"/>
+    </xs:sequence>
+    <xs:attribute name="age" type="xs:int"/>
+    <xs:attribute name="moo" type="xs:int" default="100"/>
+    <xs:attribute name="poo" type="xs:int" fixed="200"/>
+  </xs:complexType>
+
+  <xs:complexType name="line-item">
+    <xs:sequence>
+      <xs:element name="description" type="xs:string"/>
+      <xs:element name="per-unit-ounces" type="xs:decimal"/>
+      <xs:element name="price" type="xs:decimal"/>
+      <xs:element name="quantity" type="xs:integer"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="shipper">
+    <xs:sequence>
+      <xs:element name="name" type="xs:string"/>
+      <xs:element name="per-ounce-rate" type="xs:decimal"/>
+    </xs:sequence>
+  </xs:complexType>
+
+</xs:schema>

Added: xmlbeans/trunk/samples/db/vxsdb/sql/create.sample.sql
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/sql/create.sample.sql?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/sql/create.sample.sql	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,68 @@
+drop table SHIPPER;
+
+drop table LINE_ITEM;
+
+drop table CUSTOMER;
+
+drop table PURCHASE_ORDER;
+
+-- -----------------------------------------------------------------------
+-- PURCHASE_ORDER
+-- -----------------------------------------------------------------------
+
+create table PURCHASE_ORDER
+(
+    PK INTEGER NOT NULL ,
+    FK_CUSTOMER INTEGER NULL ,
+    DATE INTEGER NULL ,
+    FK_SHIPPER INTEGER NULL ,
+    PRIMARY KEY (PK)
+);
+
+-- -----------------------------------------------------------------------
+-- CUSTOMER
+-- -----------------------------------------------------------------------
+
+create table CUSTOMER
+(
+    PK INTEGER NOT NULL ,
+    NAME INTEGER NULL ,
+    ADDRESS INTEGER NULL ,
+    AGE INTEGER NULL ,
+    MOO INTEGER NULL ,
+    POO INTEGER NULL ,
+    PRIMARY KEY (PK)
+);
+
+-- -----------------------------------------------------------------------
+-- LINE_ITEM
+-- -----------------------------------------------------------------------
+
+create table LINE_ITEM
+(
+    PK INTEGER NOT NULL ,
+    DESCRIPTION INTEGER NULL ,
+    PER_UNIT_OUNCES INTEGER NULL ,
+    PRICE INTEGER NULL ,
+    QUANTITY INTEGER NULL ,
+    FK_PURCHASE_ORDER INTEGER NULL ,
+    PRIMARY KEY (PK)
+);
+
+ALTER TABLE LINE_ITEM
+    ADD CONSTRAINT LINE_ITEM_FK_1 FOREIGN KEY (FK_PURCHASE_ORDER)
+    REFERENCES PURCHASE_ORDER (PK)
+;
+
+-- -----------------------------------------------------------------------
+-- SHIPPER
+-- -----------------------------------------------------------------------
+
+create table SHIPPER
+(
+    PK INTEGER NOT NULL ,
+    NAME INTEGER NULL ,
+    PER_OUNCE_RATE INTEGER NULL ,
+    PRIMARY KEY (PK)
+);
+

Added: xmlbeans/trunk/samples/db/vxsdb/src/java/log4j.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/src/java/log4j.xml?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/src/java/log4j.xml	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d %p %c %L%n%m%n"/>
+        </layout>
+    </appender>
+
+    <root>
+        <priority value="INFO"/>
+        <appender-ref ref="ConsoleAppender"/>
+    </root>
+
+</log4j:configuration>

Added: xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb/VelocityXmlBeansDB.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb/VelocityXmlBeansDB.java?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/src/java/org/apache/xmlbeans/samples/vxsdb/VelocityXmlBeansDB.java	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,191 @@
+/* Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xmlbeans.samples.vxsdb;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * @author Philip Mark Donaghy
+ */
+public class VelocityXmlBeansDB extends Task {
+
+    private static final Log log = LogFactory.getLog(VelocityXmlBeansDB.class);
+
+    private String template;
+
+    private String output;
+
+    private String schema;
+
+    /**
+     * @param output
+     *            The output to set.
+     */
+    public void setOutput(String output) {
+        this.output = output;
+    }
+
+    /**
+     * @param schema
+     *            The schema to set.
+     */
+    public void setSchema(String schema) {
+        this.schema = schema;
+    }
+
+    /**
+     * @param template
+     *            The template to set.
+     */
+    public void setTemplate(String template) {
+        this.template = template;
+    }
+
+    /**
+     * Default Constructor
+     */
+    public VelocityXmlBeansDB() {
+    }
+
+    /**
+     * Puts the XmlBeans SchemaTypeSystem into the Velocity Context
+     */
+    public void execute() throws BuildException {
+
+        // Create a Velocity Context and a Velocity Template
+        VelocityContext ctx = new VelocityContext();
+        Template template = null;
+
+        // Output to a file
+        FileWriter writer = null;
+
+        // XmlBeans
+        SchemaTypeSystem schemaTypeSystem = null;
+
+        try {
+
+            // Initialize Velocity
+            Velocity.init();
+            log.info("Using the Velocity template, " + this.template);
+            template = Velocity.getTemplate(this.template);
+
+            // Create Schema Type System
+            log.info("Using the xml schema, " + this.schema);
+            schemaTypeSystem = XmlBeans.compileXsd(
+                    new XmlObject[] { XmlObject.Factory.parse(new File(
+                            this.schema)) }, XmlBeans.getBuiltinTypeSystem(),
+                    null);
+
+            // Place SchemaTypeSystem in the Velocity Context
+            ctx.put("xsd", schemaTypeSystem);
+
+            // Place a exported key Map in the Velocity Context
+            ctx.put("exportedKeyMap", createExportedKeyMap(schemaTypeSystem));
+
+            // Write to the file
+            log.info("Using the output file, " + this.output);
+            writer = new FileWriter(new File(this.output));
+            template.merge(ctx, writer);
+            writer.close();
+
+        } catch (Exception e) {
+            throw new BuildException(e);
+        }
+    }
+
+    /**
+     * 
+     * @param sts
+     * @return
+     */
+    private Map createExportedKeyMap(SchemaTypeSystem sts) {
+        
+        // Map of exported keys (foreign keys)
+        // The key is the name of the element exporting key(s)
+        // The value is a List of tables importing this key
+        Map exportedKeyMap = new HashMap();
+
+        // For all global elements and all global types
+        // Create a map of exported key lists
+        SchemaGlobalElement[] globals = sts.globalElements();
+        for (int i = 0; i < globals.length; i++) {
+            processProperties(globals[i].getName().getLocalPart().toUpperCase().replace('-','_'), globals[i].getType().getProperties(), exportedKeyMap);
+        }
+        return exportedKeyMap;
+    }
+
+    private void processProperties(String tableName, SchemaProperty[] properties, Map exportedKeyMap) {
+        // For all properties
+        for (int i = 0; i < properties.length; i++) {
+            processProperty(tableName, properties[i], exportedKeyMap);
+        }
+    }
+
+    private void processProperty(String tableName, SchemaProperty property, Map exportedKeyMap) {
+        // If property maxOccurs is greater than one or unbounded (null)
+        if (property.getMaxOccurs() == null || property.getMaxOccurs().compareTo(BigInteger.ONE) > 0) {
+            
+            // Tables that import this properties type (ex. line-item type exports a foreign key to purchase-order,
+            // PURCHASE_ORDER is in the list of importers) 
+            List importers = (List) exportedKeyMap.get(property.getType().getName().toString());
+            if (importers == null) {
+                importers = new ArrayList();
+                exportedKeyMap.put(property.getType().getName().toString(), importers);
+            }
+            importers.add(tableName);
+        }
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        VelocityXmlBeansDB beans = new VelocityXmlBeansDB();
+
+        // Verify arguments
+        if (args.length < 3) {
+            log
+                    .error("Usage : java org.apache.xmlbeans.samples.vxsdb.VelocityXmlBeansDB TEMPLATE OUTPUT SCHEMA1 [SCHEMA2] [...]");
+            System.exit(1);
+        }
+        beans.setTemplate(args[0]);
+        beans.setOutput(args[1]);
+        beans.setSchema(args[2]);
+        try {
+            beans.execute();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
\ No newline at end of file

Added: xmlbeans/trunk/samples/db/vxsdb/type.vm
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/type.vm?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/type.vm	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,22 @@
+## Copyright 2002-2004 Apache Software Foundation
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+## Type template used by the sample XmlBeans Velocity integration.
+## This template expoits the SchemaProperty XmlBeans object to determine
+## the data type for the given column. Type returns a SchemaType XmlBeans
+## object.
+##
+## See doc for constant values:
+## http://xmlbeans.apache.org/docs/v2/reference/constant-values.html
+#if($property.type.simpleVariety == 1)#if($property.type.name.localPart == "boolean")BOOLEAN#elseif($property.type.name.localPart == "dateTime")TIMESTAMP#elseif($property.type.name.localPart == "decimal")DECIMAL#elseif($property.type.name.localPart == "int")TINYINT#elseif($property.type.name.localPart == "integer")INTEGER#elseif($property.type.name.localPart == "long")INTEGER#elseif($property.type.name.localPart == "string")VARCHAR#end#end
\ No newline at end of file

Added: xmlbeans/trunk/samples/db/vxsdb/xml/datamodel.sample.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/samples/db/vxsdb/xml/datamodel.sample.xml?view=auto&rev=111460
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/samples/db/vxsdb/xml/datamodel.sample.xml	Thu Dec  9 19:04:41 2004
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<database name="sample">
+
+    <!-- Global Elements -->
+
+    <table name="PURCHASE_ORDER">
+
+        <column name="PK" type="INTEGER" required="true" primaryKey="true"/>
+            
+        
+        <!-- T=customer@http://openuri.org/easypo -->
+        <column name="FK_CUSTOMER" required="true" type="INTEGER" />
+        <foreign-key foreignTable="CUSTOMER">
+            <reference local="FK_CUSTOMER" foreign="PK"/>
+        </foreign-key>
+            
+        
+        <!-- T=dateTime@http://www.w3.org/2001/XMLSchema -->
+        <column name="DATE" type="TIMESTAMP" />
+            
+        
+        <!-- Foreign key imported from table named LINE_ITEM -->
+            
+        
+        <!-- T=shipper@http://openuri.org/easypo -->
+        <column name="FK_SHIPPER" type="INTEGER" />
+        <foreign-key foreignTable="SHIPPER">
+            <reference local="FK_SHIPPER" foreign="PK"/>
+        </foreign-key>
+    
+    
+    </table>
+
+    <!-- Global Types -->
+
+    <table name="CUSTOMER">
+
+        <column name="PK" type="INTEGER" required="true" primaryKey="true"/>
+            
+        
+        <!-- T=string@http://www.w3.org/2001/XMLSchema -->
+        <column name="NAME" type="VARCHAR" />
+            
+        
+        <!-- T=string@http://www.w3.org/2001/XMLSchema -->
+        <column name="ADDRESS" type="VARCHAR" />
+            
+        
+        <!-- T=int@http://www.w3.org/2001/XMLSchema -->
+        <column name="AGE" type="TINYINT" />
+            
+        
+        <!-- T=int@http://www.w3.org/2001/XMLSchema -->
+        <column name="MOO" type="TINYINT" />
+            
+        
+        <!-- T=int@http://www.w3.org/2001/XMLSchema -->
+        <column name="POO" type="TINYINT" />
+    
+    
+    </table>
+
+    <table name="LINE_ITEM">
+
+        <column name="PK" type="INTEGER" required="true" primaryKey="true"/>
+            
+        
+        <!-- T=string@http://www.w3.org/2001/XMLSchema -->
+        <column name="DESCRIPTION" type="VARCHAR" />
+            
+        
+        <!-- T=decimal@http://www.w3.org/2001/XMLSchema -->
+        <column name="PER_UNIT_OUNCES" type="DECIMAL" />
+            
+        
+        <!-- T=decimal@http://www.w3.org/2001/XMLSchema -->
+        <column name="PRICE" type="DECIMAL" />
+            
+        
+        <!-- T=integer@http://www.w3.org/2001/XMLSchema -->
+        <column name="QUANTITY" type="INTEGER" />
+    
+    
+    </table>
+
+    <table name="SHIPPER">
+
+        <column name="PK" type="INTEGER" required="true" primaryKey="true"/>
+            
+        
+        <!-- T=string@http://www.w3.org/2001/XMLSchema -->
+        <column name="NAME" type="VARCHAR" />
+            
+        
+        <!-- T=decimal@http://www.w3.org/2001/XMLSchema -->
+        <column name="PER_OUNCE_RATE" type="DECIMAL" />
+    
+    
+    </table>
+
+</database>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message