Hierarchical Data Model
Hierarchical Data Model
DATA
MODEL
Hierarchical Data Model
History:
• The oldest of the three models, dating from 1960’s
• “Ad Hoc” solution to immediate needs of real applications
• The oldest hierarchical database system, IBM’s IMS, was
developed to organize and store information needed by the space
program for the Apollo Landing Project.
• The first hierarchical DBMS is “IMS” and it was released in 1968.
• “IMS” is still the dominant DBMS. The relational DB2 is rapidly
gaining ground.
• Process data efficiently.
• It uses a structure familiar to program.
• Provides predictable performance since all paths are known.
• However not as flexible or as easy to understand as relational
system.
Hierarchical Data Model
Hierarchy
1. Networks that are forests(Collection Trees)
2. All links are from Parent to Child.
Æ ONE-TO-MANY relation.
3. In the previous Data Models Relational & Networks
relationships could be followed easily by operation of the
model, Joins and Link following.
ÆCan not follow links from child to parent.
4. Networks can be converted to hierarchies by Splitting.
5. Hierarchies are easy to store.
- Preserve hierarchy through pointers
- Using Preorder Traversal to get a flat representation of the tree.
SIMPLY EXAMPLE
• Lets assume the following relationships
– Faculty-Class ONE-MANY
– Class-Student ONE-MANY (Instead of n-n)
Simplify Example
• Instate of “Database Record”
Solution
1. Different structure for our tree.
2. Virtual record types.
Example
• Using the “Simplify Example” if the query type:
“Find information about student Y”
• Is more frequent than:
“Find information about all classes taught by Prof. X”
• Then change structure:
Most common way “Virtual Records”
Query:
“Find all the grades issued in CS101”
• If too inefficient several other schemes can be used,
i.e.
Query:
“Find all the grades issued in CS101”
Object Oriented Model
• Features:
1. Object Identity:
Æ The elements with which they deal are
objects(entities) with unique addresses.
2. Complex Objects:
Æ Higher level objects composed by lower level
objects using record formation and set
formation.(This is a basic set of constructors)
3. Type Hierarchy:
Æ Types can have subtypes with special properties.
The notion of Class-Subclass.
Object Types:
1. Elementary types: integer, real, char, string, ...
Thus,
Records of SETS, sets of RECORDS, etc are possible.
Example:
• A relation is an object type:
- Set of records constraining primitive values
- An actual table is an instance of the object type relation.
Faculty
Department
Course
Student
• Easy to get from DEPARTMENT to COURSES but
not vice versa.
– Can be achieved by defining new object types.
• Declare:
TYPE HIERARCHY
• Subtypes
– Structural: more attributes in the subtype.
Example:
• Object Behavior:
– Methods
– Abstract Data Type Operations
• Very Limited Extensions of the Underlying host
Language (C++, Objective-C, Smalltalk)
– Add Data Persistence.
• Easy Direct Manipulation: Browsing.
• Need for a Higher-Level Language e.g. like SQL
(Relation Algebra).