Database Reference
In-Depth Information
Figure 5. Transition trees for the e-Ticket DTD
Relational Schema Generation
for the xML Source
name is nID : the concatenation of node
name n to the string ' ID' .
In this stage, the typed transition trees are trans-
formed into relational schemas based on the links
among the transition trees. This transformation is
conducted through the algorithm XML2R which
uses the following notation:
Algorithm XML2R( )
1. N R = the set of transition
trees reduced to roots, i.e. , with-
out any descendant.
2. N T = the set of nodes all of
whose children are leaves not an-
notated with #.3. For each node n
N R do {
3.1
Ref
n : the set of nodes that can be foreign
keys in the relation R n (constructed on
node n )
Build_R (n): a function that builds on node
R n = Build_R (n);
3.2
Add_attribute(n, R n );
n a relation called R n
ID (R
3.3
Mark_PK({n}, R n );
n ): a function that returns the primary
key of a relation R n
Add_attribute (a, R
}
4. For each node n N T do { // n
has only leave children not anno-
tated with #
n ): Adds attribute a as a
column to the relation R n
Mark_PK (pk, R
4.1
R n = Build_R (n);
n ): Marks the pk list of at-
tributes as the primary key of the relation
R n
Mark_FK (a, R
4.2
ID_found = False;
4.3
For each child a of n
do {
4.3.1
n ): Marks the a attribute as
a foreign key in the relation R n
ADD_ID (R
Add_attribute(a, R n );
4.3.2
If (arc(n, a) = ID)
n ): adds an artificial primary
key to the relation R n . The primary key
then {
4.3.2.1
Mark_
Search WWH ::




Custom Search