Information Technology Reference
In-Depth Information
Hierarchical
database
template
Relational
schema
(optional)
Unload
process
Upload
process
Target
sequential
files
Transfer
Relational
database
Hierarchical
database
Sequential
files
Fig. 4.9 System flow diagram for data conversion from hierarchical to relational
4.6
Data Conversion from Hierarchical to Relational
In a similar manner to the data conversion from network to relational, data conver-
sion from hierarchical to relational requires some initial processing followed by a
sequence of three steps, as shown in Fig. 4.9 .
Preprocess step 1—Translate hierarchical schema to relational schema by map-
ping each segment type to a relation and each segment “Access path” key to a rela-
tion key.
Step 1—Unloading the hierarchical database, writing each segment type data
into a file.
The algorithm for this proces is shown below.
ProgramUnloadhierarchicaldatabase to sequential files
Begin
/* H = thenumberof segment types*/
Get allsegment type H 1 , H 2,.. H h from thehierarchical input schema;
Fori = 1 to hdo /* foreach target segment type */
begin
Get H i1 , H i2… H ii segment types;
/* get target segment H ii parent segments H i1… H i(i-1) */
Let j = 1 /* start from level 1of root segment */
Whilej > 0do /* processing all target segment occurrences */
begin
case jof
j=1: begin /* processall root segment occurrences */
Get next H i1 segment;
If segment found
then Let j = j + 1 /* go down toward target segment */
else Let j = j-1 /* go up to get out of theloop*/
end
 
Search WWH ::




Custom Search