From 08fe6b1660c130b8b8171b1b41a9be75eca948d8 Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Mon, 2 Jan 2017 20:11:09 +0100
Subject: [PATCH] Rdbms export/import project description

---
 Doc/Sda1/projects.xml | 118 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 114 insertions(+), 4 deletions(-)

diff --git a/Doc/Sda1/projects.xml b/Doc/Sda1/projects.xml
index d68999114..9050eb15e 100644
--- a/Doc/Sda1/projects.xml
+++ b/Doc/Sda1/projects.xml
@@ -45,10 +45,10 @@
 
       <listitem>
         <para>Your team is expected to use the <link
-        xlink:href="https://gitlab.mi.hdm-stuttgart.de">MI Gitlab server</link>.
-        You should commit regularly rather than e.g. one big chunk at the
-        project's end so that your project's progress and the individual
-        participant's contributions become reasonable.</para>
+        xlink:href="https://gitlab.mi.hdm-stuttgart.de">MI Gitlab
+        server</link>. You should commit regularly rather than e.g. one big
+        chunk at the project's end so that your project's progress and the
+        individual participant's contributions become reasonable.</para>
 
         <para>Choose a combination of year, sda1 and your alphabetically
         sorted login names as base name for the git repository e.g.:</para>
@@ -108,6 +108,116 @@
     </orderedlist>
   </section>
 
+  <section xml:id="sda1SectDbXmlExportImport">
+    <title>Exporting and importing relational data</title>
+
+    <para>Design and implement a <xref linkend="glo_Java"/> application which
+    allows for:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>Exporting relational data to <xref linkend="glo_XML"/> using
+        <xref linkend="glo_JDBC"/>.</para>
+      </listitem>
+
+      <listitem>
+        <para>Insert <xref linkend="glo_XML"/> data into a relational
+        database.</para>
+      </listitem>
+    </itemizedlist>
+
+    <para>Your application shall make no assumptions whatsoever regarding a
+    relational database's state. Records from all tables shall be dumped into
+    one or more XML files. In addition the relational schema shall be
+    transformed into a corresponding <xref linkend="glo_XSD"/> schema
+    containing the following meta information:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>Table names among with their corresponding column names and data
+        types.</para>
+      </listitem>
+
+      <listitem>
+        <para>Nullability of attributes</para>
+      </listitem>
+
+      <listitem>
+        <para>Primary / unique key definitions</para>
+      </listitem>
+
+      <listitem>
+        <para>Foreign key definitions</para>
+      </listitem>
+    </itemizedlist>
+
+    <para>Testing your application may be effected by:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>Starting from an arbitrary database state containing records in
+        a given set of tables. As your application matures choose a database
+        of sufficient complexity including ~5 tables with one to many and many
+        to many relationships.</para>
+      </listitem>
+
+      <listitem>
+        <para>Export your database to <xref linkend="glo_XML"/> (e.g.
+        <filename>dump.xml</filename>) and <xref linkend="glo_XSD"/> (e.g.
+        <filename>schema.xsd</filename>) based on the <xref
+        linkend="glo_JDBC"/> <link linkend="jdbcUrlComponents">connection
+        URI</link> , user name and password parameters being provided by a
+        properties file.</para>
+      </listitem>
+
+      <listitem>
+        <para>Drop all database tables.</para>
+      </listitem>
+
+      <listitem>
+        <para>Import from <filename>dump.xml</filename> and the implicitly
+        referenced <filename>schema.xsd</filename> required for recreating the
+        relational schema and subsequently insert all corresponding records.
+        </para>
+      </listitem>
+    </itemizedlist>
+
+    <para>If your application works correctly you should end up with the
+    initial database state.</para>
+
+    <tip>
+      <orderedlist>
+        <listitem>
+          <para>You may limit your work to <xref linkend="glo_Soft_Mysql"/>
+          using <productname>Innodb</productname> tables.</para>
+        </listitem>
+
+        <listitem>
+          <para>Reading a database's schema requires <xref
+          linkend="glo_JDBC"/> meta data support e.g. <interfacename
+          xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSetMetaData.html">ResultSetMetaData</interfacename>
+          and possibly <interfacename
+          xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html">DatabaseMetaData</interfacename>.</para>
+        </listitem>
+
+        <listitem>
+          <para>You may want to create database tables beforehand supplying
+          foreign key constraints later by issuing appropriate <code>ALTER
+          TABLE Xyz ADD CONSTRAINT ...</code><emphasis
+          role="bold">after</emphasis> inserting your data records. This way
+          you avoid topological sorting of foreign key constraint induced
+          table creation dependency problems.</para>
+        </listitem>
+
+        <listitem>
+          <para>You may start by exporting a <filename>schema.xsd</filename>
+          file. Then implement relational schema recreation. This schoud work
+          not yet bothering about actual data.</para>
+        </listitem>
+      </orderedlist>
+    </tip>
+  </section>
+
   <section xml:id="sda1SectPrjDocbookCms">
     <title>Project <productname>Docbook</productname>
     <acronym>CMS</acronym>.</title>
-- 
GitLab