<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\pagebreak
\section{Introduction}

\subsection{This document}

Note: This paper is just a request for comment! Don't expect to find anything in the real implementation !
\\
This draft paper describes the database layout of the Opie PIM applications.
Design goal is a fast and extendable layout on a sql database to support cross referencing.


\subsection{Copyright}

Copyright notice
\copyright 2002-2004, Maximilian Rei{\ss} \&amp; Stefan Eilers \&amp; Holger Freyther

\pagebreak
\section{Relations}
\subsection{About Cross Referencing and Horizontal Data Storage}
Before you read on, it may be helpful to get some information about the solution of ``horizontal'' data storage into the tables and cross referencing.
Some of the tables are just using 5 attributes:
\begin{enumerate}
\item UID: This countains an unique ID for the complete entry. An entry may consist of multiple
rows, seperated by ID.
\item ID: This defines a number to seperate the rows of an entry. UID + ID must be unique for every entry (primary key).
\item Type: Describes the type of this entry.
\item Priority: For instance: Your default email-address will get the priority 1 and the other 2.. . 0 means ``not defined''.
\item Value: The data which was described by ``Type'' is stored here.
\end{enumerate}

These kinds of tables are very flexible in what they may contain, due to the fact that the ``Type'' may be without any constraint. Therefore it is perfectly for storing personal information, which may change in the future, or should be increased.
\\
Let's see how such an entry may look like for the table ``ADDRESSBOOK'':

\begin{tabular}[ht]{|l|l|l|l|}
\hline
\underline{UID} &amp; \underline{ID} &amp; Type &amp; Value\\
\hline
 1231&amp; 00&amp; Title&amp; Herr\\
\hline
 1231&amp; 01&amp; FirstName&amp; Stefan\\
\hline
 1231&amp; 02&amp; LastName&amp; Eilers\\
\hline
\end{tabular}
\\
\\
We need some additional information about this entry, which is stored into the table ``PERSONAL\_DATA'':
\\
\\
\begin{tabular}[ht]{|l|l|l|l|l|}
\hline
\underline{UID} &amp; \underline{ID} &amp; Type &amp; Priority &amp; Value\\
\hline
 2345&amp; 00&amp; Email&amp; 1&amp; eilers.stefan@epost.de\\
\hline
 2345&amp; 01&amp; Email&amp; 2&amp; eilers@sra.uni-hannover.de\\
\hline
 2345&amp; 02&amp; WebPage&amp; 1&amp;  www.sra.uni-hannover.de/$\sim$eilers/\\
\hline
\end{tabular}
\\
\\
The last question is: How to get these information together? This is the job of the cross-referencing-table\footnote{We expecting that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''and ADDRESSBOOK with ``01''!}:
\\
\\
\begin{tabular}[ht]{|l|l|l|l|l|l|}
\hline
\underline{TID1} &amp; \underline{UID1} &amp; \underline{ID1} &amp; \underline{TID2} &amp; \underline{UID2} &amp; \underline{ID2} \\
\hline
 01&amp; 1231&amp; (NULL) &amp; 03&amp; 2345&amp; (NULL) \\
\hline
\end{tabular}
\\
\\
ID was left empty, due to the fact that we wanted to link the complete entry and not some rows of the entry.
\\
In some cases, it may be useful to reference in a much more smaller granularity than complete entries. What should we do, if we want to store the children of a person ? 
The easiest way is to store the children into the table ``PERSONAL\_DATA'':\footnote{We remember that the table ``PERSONAL\_DATA'' was registered in the table ``TABLEID'' as table ``03''!}, too.\\
\\
\begin{tabular}[ht]{|l|l|l|l|l|}
\hline
\underline{UID} &amp; \underline{ID} &amp; Type &amp; Priority &amp; Value\\
\hline
 2345&amp;  11&amp; Child &amp; 0 &amp; Amaly \\
\hline
 2345&amp;  12&amp; Child &amp; 0 &amp; Karl \\
\hline
 2345&amp;  13&amp; Child &amp; 0 &amp; Clarissa\\
\hline
\end{tabular}\\
\\

But what happens if you want to store additional information about the children, as there mobile phone numbers, etc?

In this case we need an entry in addressbook and a reference to this entry. Lets expect ``Amaly'' was stored in the table ``ADDRESSBOOK'' with UID 9213 and Karl with UID 7654. A cross-reference will look like this:\\
\\
\begin{tabular}[ht]{|l|l|l|l|l|l|}
\hline
\underline{TID1} &amp; \underline{UID1} &amp; \underline{ID1} &amp; \underline{TID2} &amp; \underline{UID2} &amp; \underline{ID2} \\
\hline
 03&amp; 2345&amp; 11&amp; 01&amp; 9213&amp; (NULL) \\
\hline
 03&amp; 2345&amp; 12&amp; 01&amp; 7654&amp; (NULL) \\
\hline
\end{tabular}
\\
</pre></body></html>