mirror of
https://github.com/Wisser/Jailer.git
synced 2026-02-21 18:28:37 -06:00
git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@1254 3dd849cd-670e-4645-a7cd-dd197c8d0e81
378 lines
16 KiB
HTML
378 lines
16 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Jailer - Design</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="description" content="Data Export Tool">
|
|
<meta name="keywords"
|
|
content="data export referential integrity java jdbc dbms">
|
|
<link rel="stylesheet" type="text/css"
|
|
href="design-Dateien/styles.css">
|
|
<link rel="shortcut icon" href="favicon.ico">
|
|
</head>
|
|
<body left-margin="0" top-margin="0">
|
|
<div align="left">
|
|
<table
|
|
style="text-align: left; position: absolute; left: 0pt; top: 0pt;"
|
|
border="0" cellpadding="0" cellspacing="0" height="407" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="2" class="bannerbackground" height="33" width="100%">
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tbody>
|
|
<tr>
|
|
<td><img src="design-Dateien/logo.png" hspace="10"></td>
|
|
<td class="slogan" width="100%">Database Subsetting Tool</td>
|
|
<td style="text-align: right; width: 100%;"><table border="0" cellpadding="0" cellspacing="0"><tr><td><a
|
|
href="http://sourceforge.net/projects/jailer/"><img
|
|
src="http://sflogo.sourceforge.net/sflogo.php?group_id=197260&type=1"
|
|
alt="SourceForge.net Logo" style="border: 0px solid ;"></a></td></tr><tr><td><a href=http://www.java.net><img src="javanet_button_90.gif" width="90" height="25" border="0" alt="java.net Member Button: 90px wide"></a></td></tr></table></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" class="nav1background" height="33" width="100%">
|
|
<b><font color="#ffffff"><a href="home.htm" target="_self"
|
|
class="tlink">Home</a> <a href="quicktour.htm"
|
|
target="_self" class="tlink">Quick Tour</a> <a
|
|
href="exporting-data.htm" target="_self" class="tlink">Tutorial</a> <a href="data-browsing.html" target="_self" class="tlink">Data Browser</a> <a href="faq.html" target="_self" class="tlink">FAQ</a> <a href="api.html" target="_self" class="tlink">API</a>
|
|
<a href="design.htm" target="_self" class="tlinkA">Documentation</a>
|
|
<a
|
|
href="http://sourceforge.net/forum/?group_id=197260" target="_self"
|
|
class="tlink">Forum</a> <a
|
|
href="http://sourceforge.net/project/showfiles.php?group_id=197260"
|
|
target="_self" class="tlink">Download</a>
|
|
</font></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" class="spacer" width="100%">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lmenucontainer" height="100%" valign="top" width="14%">
|
|
<div align="center">
|
|
<center>
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td width="100%"><br>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</center>
|
|
</div>
|
|
<ul>
|
|
<li><a href="design.htm" target="_self" class="llinkA">Design</a></li>
|
|
<li><a href="file-formats.htm" target="_self" class="llink">File
|
|
Formats</a></li>
|
|
</ul>
|
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td class="content2background"><img
|
|
style="width: 160px; height: 1px;" alt=""
|
|
src="architecture-Dateien/vgradp.gif"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p> </p>
|
|
</td>
|
|
<td class="contentbackground" height="418" valign="top"
|
|
width="86%">
|
|
<div align="right">
|
|
<table border="0" cellpadding="0" cellspacing="0" height="542"
|
|
width="98%">
|
|
<tbody>
|
|
<tr>
|
|
<td class="contentbackground" height="21" width="100%"><br>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="content" height="520" valign="top" width="100%">
|
|
<h4>Data flow</h4>
|
|
<h3><a name="modell_des_entitaetsgraphen"></a><img
|
|
alt="architecture" src="architecture-Dateien/arch.png"><br>
|
|
<br>
|
|
</h3>
|
|
<ul>
|
|
<li class="level1">
|
|
<div class="li"><strong>Datamodel.</strong> Describes
|
|
tables and associations.<strong></strong></div>
|
|
</li>
|
|
<li class="level1">
|
|
<div class="li"><strong>Restrictionmodel.</strong>
|
|
Restricts associations and controls the exportation.<br>
|
|
</div>
|
|
</li>
|
|
<li class="level1"><strong>Extractionmodel.</strong>
|
|
Defines the subject and determines the restriction models.</li>
|
|
<li class="level1"><span style="font-weight: bold;">Freedom.</span>
|
|
The database from which data is exported or deleted.</li>
|
|
<li class="level1"><span style="font-weight: bold;">Jail.</span>
|
|
The database to import data into.</li>
|
|
</ul>
|
|
<br>
|
|
<h4><a name="modell_des_entitaetsgraphen">The Entity Graph</a> </h4>
|
|
During exportation a graph of entities will be constructed inside the
|
|
database. For this three tables are required:
|
|
<div class="level3">
|
|
<ul>
|
|
<li class="level1">
|
|
<div class="li"><strong>EntityGraph</strong> the graph<br>
|
|
</div>
|
|
</li>
|
|
<li class="level1">
|
|
<div class="li"><strong>Entity</strong> entity in the
|
|
graph<br>
|
|
</div>
|
|
</li>
|
|
<li class="level1">
|
|
<div class="li"><strong>Dependency</strong>
|
|
dependencies between entities</div>
|
|
</li>
|
|
</ul>
|
|
<p>For each entity in the graph the primary-key <em></em>and
|
|
the type <em></em><span style="font-style: italic;"></span>(as table
|
|
name) is stored. The <em>birthday</em> of an entity is the day of the
|
|
insertion into the graph.<br>
|
|
<br>
|
|
<br>
|
|
</p>
|
|
</div>
|
|
<h4><a name="berechnung_des_transitiven_abschlusses">Finding
|
|
the transitive closure</a> </h4>
|
|
The graph will be constructed day after day (step-by-step) starting at
|
|
day 1:
|
|
<div class="level3">
|
|
<ul>
|
|
<li class="level1">
|
|
<div class="li">at day 1 all subject entities are
|
|
inserted into the graph<br>
|
|
</div>
|
|
</li>
|
|
<li class="level1">at day <big
|
|
style="font-style: italic;"><span style="font-family: monospace;"><font
|
|
size="4">n</font></span></big> all entities referenced by one of the
|
|
entities born at day <big
|
|
style="font-style: italic; font-family: monospace;"><font size="4">n-1</font></big>
|
|
are inserted into the graph. Dependencies between entities are stored.<br>
|
|
</li>
|
|
</ul>
|
|
<p>The <em>progression set</em> of a day is the set of all
|
|
tables from
|
|
which entities are inserted at that day. The progession set of day 1 is
|
|
the subject set. The process stops if the progression set of a day is
|
|
empty.<br>
|
|
<br>
|
|
</p>
|
|
</div>
|
|
<h5>Algorithm</h5>
|
|
<div style="font-family: arial;" class="level4">
|
|
1. insert<span style="font-style: italic;"> </span><font
|
|
style="font-style: italic;" size="4"><small>subject</small></font>
|
|
into graph <em></em><br>
|
|
<small><small><em><font size="4"><small> 2.
|
|
progression-set := { subject }</small></font></em></small> </small><br>
|
|
3. while <em><font size="4"><small>progression-set
|
|
!= {}</small></font></em><small> </small><big><em></em></big><br>
|
|
<em><font size="4"><small>
|
|
1. progression-of-today
|
|
:= {}</small></font></em><br>
|
|
2. for all
|
|
(restricted) associations <em>A
|
|
between tables T<small><font size="2">1</font></small> and T<small><font
|
|
size="2">2</font></small></em><span style="font-style: italic;">, if</span><em>
|
|
T<small><font size="2">1</font></small></em> or <em>T<small><font
|
|
size="2">2</font></small></em> in <em>progression-set:</em><br>
|
|
<em></em>
|
|
1. if <em>T<small><font size="2">2</font></small></em> <span
|
|
style="font-style: italic;">(T<small><font size="2">1</font></small>) </span>depends
|
|
on <em>T<small><font size="2">1 <big>(T<small>2</small>)</big></font></small></em>:
|
|
<br>
|
|
|
|
add
|
|
dependencies from <em>T<small><font size="2">2</font></small></em>(T<small><font
|
|
size="2">1</font></small>)-entities born yesterday <br>
|
|
|
|
to the entities
|
|
they are associated with according to <span style="font-style: italic;">A</span><br>
|
|
<span style="font-style: italic;"></span>
|
|
2. insert
|
|
all entities of <em>T<small><font size="2">1</font></small> (T<small><font
|
|
size="2">2</font></small>)</em>, which are associated according to <span
|
|
style="font-style: italic;">A</span> with an entity of <span
|
|
style="font-style: italic;">T<small><font size="2">2</font></small> (T<small><font
|
|
size="2">1</font></small>)</span> born yesterday
|
|
<div class="li">
|
|
3. if at least one entity of T<small><font size="2">1</font></small> (T<small><font
|
|
size="2">2</font></small>) is
|
|
inserted then <em><font size="4"><small>progression-of-today :=
|
|
progression-of-today + { </small></font></em><font size="4"><small>
|
|
T</small></font><small>1</small><font size="4"><small> (T</small></font><small>2</small><font
|
|
size="4"><small>)</small></font><em><font size="4"><small> }</small></font></em></div>
|
|
<em><font
|
|
size="4"><small>3. progression-set
|
|
:= progression-of-today</small></font></em>
|
|
<ol>
|
|
<ol>
|
|
</ol>
|
|
</ol>
|
|
</div>
|
|
<br>
|
|
<div class="level4">
|
|
<p><font size="4"> Example<br>
|
|
</font></p>
|
|
<p> Subject = <em>{ A<small><font
|
|
size="2">1</font></small></em>, <em>A<small><font size="2">2</font></small></em>
|
|
}<br>
|
|
</p>
|
|
<table style="width: 100%; text-align: left;" border="0"
|
|
cellpadding="2" cellspacing="2">
|
|
<tbody>
|
|
<tr>
|
|
<td style="vertical-align: top;"> <br>
|
|
</td>
|
|
<td style="vertical-align: top;"><img
|
|
style="border: 0px solid ;" alt="desing"
|
|
src="design-Dateien/example.png"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p><br>
|
|
</p>
|
|
<p><br>
|
|
<br>
|
|
</p>
|
|
<table class="inline" border="1" cellpadding="2"
|
|
cellspacing="0">
|
|
<tbody>
|
|
<tr>
|
|
<td style="background-color: rgb(153, 255, 255);"><strong>day</strong></td>
|
|
<td style="background-color: rgb(153, 255, 255);"><strong>progression
|
|
set</strong></td>
|
|
<td style="background-color: rgb(153, 255, 255);"><strong>entities</strong></td>
|
|
<td style="background-color: rgb(153, 255, 255);"><strong>dependencies</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>A</td>
|
|
<td>A1, A2</td>
|
|
<td><br>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2</td>
|
|
<td>B, C</td>
|
|
<td>+ B1, B2, C3, C4</td>
|
|
<td>A2->C3, A2->C4</td>
|
|
</tr>
|
|
<tr>
|
|
<td>3</td>
|
|
<td>B, C</td>
|
|
<td>+ C1, C2, B3, B5</td>
|
|
<td>+ B1->C1, B1->C2</td>
|
|
</tr>
|
|
<tr>
|
|
<td>4</td>
|
|
<td>B</td>
|
|
<td>+ B6</td>
|
|
<td><em>no change</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td>5</td>
|
|
<td><br>
|
|
</td>
|
|
<td><em>no change</em><em></em></td>
|
|
<td><em>no change</em></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<h4><br>
|
|
</h4>
|
|
<h4><a name="sql-anweisungen">SQL-Statements</a></h4>
|
|
<p>Line 1, insert subject<br>
|
|
<span style="font-family: monospace;"><br>
|
|
INSERT INTO Entity(PK, birthday, type)</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> SELECT
|
|
<subject>.PK, 1, '<subject>' </span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> FROM
|
|
<subject></span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
WHERE (<condition> AND 103</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
NOT EXISTS (SELECT * FROM Entity WHERE <subject>.PK=Entity.PK)</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
[fetch first <limit> rows only]</span><br
|
|
style="font-family: monospace;">
|
|
<br>
|
|
<br>
|
|
Line 3.2.1, adding dependencies<br>
|
|
<br>
|
|
<span style="font-family: monospace;">INSERT INTO
|
|
Dependency(from_PK, to_PK)</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> SELECT
|
|
<T2>.PK, <T1>.PK</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> FROM Entity
|
|
E1, Entity E2,</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
<T2> JOIN <T1> ON <join-condition></span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> WHERE
|
|
E1.type='<T1>' AND E2.type='<T2>'</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
AND E1.PK=<T1>.PK</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
AND E2.PK=<T2>.PK<br>
|
|
<br>
|
|
<br>
|
|
</span>Line 3.2.2, adding referenced entities<br>
|
|
<br>
|
|
<span style="font-family: monospace;">INSERT INTO
|
|
Entity(PK, birthday, type)</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> SELECT
|
|
DISTINCT <T2>.PK, <today>, '<T2>'</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> FROM
|
|
<T1> JOIN <T2> ON <join-condition>,</span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
Entity</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;"> WHERE
|
|
<T1>.PK=Entity.PK AND Entity.birthday = <yesterday></span><br
|
|
style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
AND NOT EXISTS</span><br style="font-family: monospace;">
|
|
<span style="font-family: monospace;">
|
|
(SELECT * FROM Entity WHERE <T2>.PK=Entity.PK)</span><br
|
|
style="font-family: monospace;">
|
|
<br>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p> </p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td height="12" valign="top" width="14%"><br>
|
|
</td>
|
|
<td><br>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|