Chapter B:Hierarchical Model Basic Concepts Tree-Structure Diagrams Data-Retrieval Facility Update Facility Virtual Records Mapping of Hierarchies to Files The IMS Database System Database System Concepts,5th Ed. B.1 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 B.1 ©Silberschatz, Korth and Sudarshan th Ed. Chapter B: Hierarchical Model Basic Concepts Tree-Structure Diagrams Data-Retrieval Facility Update Facility Virtual Records Mapping of Hierarchies to Files The IMS Database System
Basic Concepts A hierarchical database consists of a collection of records which are connected to one another through links a record is a collection of fields,each of which contains only one data value. A link is an association between precisely two records. The hierarchical model differs from the network model in that the records are organized as collections of trees rather than as arbitrary graphs. Database System Concepts,5th Ed. B.2 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 B.2 ©Silberschatz, Korth and Sudarshan th Ed. Basic Concepts A hierarchical database consists of a collection of records which are connected to one another through links. a record is a collection of fields, each of which contains only one data value. A link is an association between precisely two records. The hierarchical model differs from the network model in that the records are organized as collections of trees rather than as arbitrary graphs
Tree-Structure Diagrams The schema for a hierarchical database consists of boxes,which correspond to record types lines,which correspond to links Record types are organized in the form of a rooted tree. No cycles in the underlying graph. Relationships formed in the graph must be such that only one-to-many or one-to-one relationships exist between a parent and a child. Database System Concepts,5th Ed. B.3 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.3 ©Silberschatz, Korth and Sudarshan th Ed. Tree-Structure Diagrams The schema for a hierarchical database consists of boxes, which correspond to record types lines, which correspond to links Record types are organized in the form of a rooted tree. No cycles in the underlying graph. Relationships formed in the graph must be such that only one-to-many or one-to-one relationships exist between a parent and a child
General Structure A B1 B2 Ck A parent may have an arrow pointing to a child,but a child must have an arrow pointing to its parent. Database System Concepts,5th Ed. B.4 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.4 ©Silberschatz, Korth and Sudarshan th Ed. General Structure A parent may have an arrow pointing to a child, but a child must have an arrow pointing to its parent
Tree-Structure Diagrams (Cont.) Database schema is represented as a collection of tree-structure diagrams. single instance of a database tree The root of this tree is a dummy node The children of that node are actual instances of the appropriate record type When transforming E-R diagrams to corresponding tree-structure diagrams,we must ensure that the resulting diagrams are in the form of rooted trees. Database System Concepts,5th Ed. B.5 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.5 ©Silberschatz, Korth and Sudarshan th Ed. Tree-Structure Diagrams (Cont.) Database schema is represented as a collection of tree-structure diagrams. single instance of a database tree The root of this tree is a dummy node The children of that node are actual instances of the appropriate record type When transforming E-R diagrams to corresponding tree-structure diagrams, we must ensure that the resulting diagrams are in the form of rooted trees
Single Relationships customer-streef account-number balance customer-name customer-city customer depositor account (a)E-R diagram customer-name customer-street customer-city customer account-number balance account (b)Tree-structure diagram Database System Concepts,5th Ed. B.6 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 B.6 ©Silberschatz, Korth and Sudarshan th Ed. Single Relationships
Single relationships (Cont.) Example E-R diagram with two entity sets,customer and account related through a binary,one-to-many relationship depositor. Corresponding tree-structure diagram has the record type customer with three fields:customer-name, customer-street,and customer-city. the record type account with two fields:account-number and balance the link depositor,with an arrow pointing to customer Database System Concepts,5th Ed. B.7 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.7 ©Silberschatz, Korth and Sudarshan th Ed. Single relationships (Cont.) Example E-R diagram with two entity sets, customer and account, related through a binary, one-to-many relationship depositor. Corresponding tree-structure diagram has the record type customer with three fields: customer-name, customer-street, and customer-city. the record type account with two fields: account-number and balance the link depositor, with an arrow pointing to customer
Single Relationships (Cont.) If the relationship depositor is one to one,then the link depositor has two arrows. customer-name customer-street customer-city customer account-number balance account Only one-to-many and one-to-one relationships can be directly represented in the hierarchical mode. Database System Concepts,5th Ed. B.8 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.8 ©Silberschatz, Korth and Sudarshan th Ed. Single Relationships (Cont.) If the relationship depositor is one to one, then the link depositor has two arrows. Only one-to-many and one-to-one relationships can be directly represented in the hierarchical mode
Transforming Many-To-Many Relationships Must consider the type of queries expected and the degree to which the database schema fits the given E-R diagram. In all versions of this transformation,the underlying database tree (or trees)will have replicated records. Database System Concepts,5th Ed. B.9 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 B.9 ©Silberschatz, Korth and Sudarshan th Ed. Transforming Many-To-Many Relationships Must consider the type of queries expected and the degree to which the database schema fits the given E-R diagram. In all versions of this transformation, the underlying database tree (or trees) will have replicated records
Many-To Many Relationships (Cont.) customer-street account-number balance customer-nane customer-city customer depositor account (a)E-R diagram customer-name customer-street customer-city account-number balance customer account account-number balance customer-name customer-street customer-city account customer tree T1 treeT2 (b)Tree-structure diagrams Database System Concepts,5th Ed. B.10 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 B.10 ©Silberschatz, Korth and Sudarshan th Ed. Many-To Many Relationships (Cont.)