the hierarchical data model section 9 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
THE HIERARCHICAL DATA MODEL SECTION 9 PowerPoint Presentation
Download Presentation
THE HIERARCHICAL DATA MODEL SECTION 9

Loading in 2 Seconds...

play fullscreen
1 / 45

THE HIERARCHICAL DATA MODEL SECTION 9 - PowerPoint PPT Presentation


  • 185 Views
  • Updated on

THE HIERARCHICAL DATA MODEL SECTION 9. Fundamentals. Introduction. Relational model Grounded in mathematics . Network model Evolved from effort to establish standards Hierarchical Evolved?. Some Hierarchical Systems. IMS. Most widely used Other Hierarchical Systems.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

THE HIERARCHICAL DATA MODEL SECTION 9


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. THE HIERARCHICAL DATA MODELSECTION 9 Fundamentals

    2. Introduction • Relational model • Grounded in mathematics • Network model • Evolved from effort to establish standards • Hierarchical • Evolved?

    3. Some Hierarchical Systems • IMS • Most widely used • Other Hierarchical Systems

    4. Developed in early 1960s • The reason? • Still remains an actively used DB

    5. Basic Concepts • Special case of the network model • Parent • Child

    6. Tree • Hierarchical data model • Segment types • Parent-child relationship type

    7. A conceptual model RETIREMENT PLAN DEPARTMENT EMPLOYEE 1 1 HAS- EMPLOYEE PROVIDED- FOR M M

    8. A network data model DEPARTMENT RETIREMENT PLAN DEPARTMENT/ EMPLOYEE SET RETIREMNT PLAN/ EMPLOYEE SET EMPLOYEE

    9. A hierarchical data model DEPARTMENT RETIREMENT PLAN DEPARTMENT/ EMPLOYEE PCR RETIREMNT PLAN/ EMPLOYEE PCR EMPLOYEE EMPLOYEE

    10. Tree Structure Conventions • Root segment • Every segment a child • A parent can have many children • A child can only have one parent

    11. A leaf segment • Ancestors and dependent segments • Root of a sub-tree

    12. Hierarchical arrangement of segment types Segment type DEPTNAME EMPNAME PROJNAME SKILLCODE MANAGER YRS-SVC DIVISION SKILLNAME DEPARTMENT EMPLOYEE SKILL ASSIGNEDTO

    13. Hierarchical occurrence tree DEPARTMENT DEPTNAME MANAGER Marketing Smith EMPLOYEE EMPNAME YRS-SVC Carter Blake West Mills Hill Bond Case 12 7 6 5 6 7 3 Engineering Accounting Cook Black Proj.B Proj.A 6 3 SKILL ASSIGNEDTO SKILLCODE SKILLNAME PROJNAME DIV 5 2 3 5 Cost Acct. Engineer Programmer Analyst

    14. Preorder Traversal Method • Begin at the root of the tree and record the root segment in a file • At any point, after recording a segment, record the leftmost child segment of the segment just recorded. If the segment has no child segment, move back up the tree one level and record the leftmost unrecorded child segment of the segment at that level. Continue until all segments are accounted for.

    15. Segment type indicator D A Department Segment Type Level 1 E E E B C D Employee Segment Type Level 2 S A S A A S A E F G H I J K Level 3 Skill and AssignedTo Segment Type Illustration of Preorder Traversal

    16. The following file will be generated

    17. The Models Relationship to Conceptual Modeling • Transforming a conceptual model to a hierarchical data structure • One - Many Relationships

    18. Transforming One-Many Relationships DEPTNAME LOCATION MANAGER EMPNAME ADDRESS YRS-SVC HAS- EMPLOYEE DEPARTMENT EMPLOYEE 1 N DEPARTMENT EMPLOYEE DEPTNAME EMPNAME LOCATION ADDRESS YRS-SVC MANAGER Very simple

    19. DEPTNAME LOCATION MANAGER TYPE ENROLL-DATE AMOUNT DEPARTMENT RETIREMENT PLAN 1 1 HAS- EMPLOYEE PROVIDED- FOR N N EMPLOYEE EMPNAME ADDRESS YRS-SVC • Redundancy problems • What is the problem?

    20. DEPARTMENT RETIREMENT-PLAN EMPLOYEE EMPLOYEE DEPTNAME EMPNAME TYPE EMPNAME LOCATION ADDRESS ENROLL- DATE ADDRESS MANAGER YRS-SVC AMOUNT YRS-SVC

    21. The following rules: • For each entity set E in a conceptual model, create a segment type S in the hierarchical model. All attributes of E are represented as fields of S. • For one-many relationships between two entity sets, create corresponding tree structure diagrams, making each entity a segment and making the one-many relationship a parent-child relationship. The segment on the “many” side becomes the child, and the segment on the one side becomes the parent.

    22. Transforming Many-Many Relationships ID DESCRIPTION PRICE PRODUCT N IS- SUPPLIED- BY M NAME SUPPLIER LOCATION A more complex situation

    23. ID DESCRIPTION PRICE PRODUCT NAME LOCATION MANUFACTURER ID DESCRIPTION PRICE PRODUCT NAME LOCATION MANUFACTURER • For entity sets, E1 and E2, that have a many-many binary relationship, and from which segments S1 and S2 have been identified, construct two different one-many PCRs: S1 to S2, and S2 to S1.

    24. Many-Many Relationship with an Attribute ID DESCRIPTION PRICE PRODUCT N QUANTITY IS- SUPPLIED- BY M NAME SUPPLIER LOCATION

    25. ID DESCRIPTION PRICE ID DESCRIPTION PRICE PRODUCT PRODUCT QUANTITY QUANTITY QUANTITY QUANTITY NAME LOCATION NAME LOCATION MANUFACTURER MANUFACTURER • If a binary many-many relationship has attribute data, create a new intersection segment I, which contains that data.

    26. The IMS Architecture • Hierarchical data model has no standard • Must be hierarchically oriented • Limit on segment types

    27. DL/1 • Database Description (DBD) • Program Specification Block (PSB) • Program Communication Block

    28. Defining the Physical Database – The DBD • The DBD is analogous to the network schema • An example – four segment types • DEPARTMENT • EMPLOYEE • SKILL • ASSIGNEDTO

    29. DBD NAME = DEPTPERS, ACCESS = HISAM • SEGM NAME = DEPARTMENT, PARENT = 0, BYTES = 20 • FIELD NAME = (DEPTNAME,SEQ,U), BYTES = 10, START = 1, TYPE = C • FIELD NAME = MANAGER, BYTES = 10, START = 11, TYPE = C • SEGM NAME = EMPLOYEE, PARENT = DEPARTMENT, BYTES = 22 • FIELD NAME = (EMPNAME,SEQ), BYTES = 20, START = 1, TYPE = C • FIELD NAME = YRS-SVC, BYTES = 2, START = 21, TYPE = P • SEGM NAME = SKILL, PARENT = EMPLOYEE, BYTES = 17 • FIELD NAME = (SKILLCODE,SEQ), BYTES = 2, START = 1, TYPE = P • FIELD NAME = SKILLNAME, BYTES = 15, START = 3, TYPE = C • SEGM NAME = ASSIGNEDTO, PARENT = EMPLOYEE, BYTES = 4 • FIELD NAME = (PROJNI,SEQ), BYTES = 2, START = 1, TYPE = P • FIELD NAME = DIVISION, BYTES = 2, START = 3, TYPE = C • DBGEN

    30. Defining the Logical Database – The PSB • Analogous to the network subschema • The PCB • Sensitive segments

    31. PCB TYPE = DB, DBNAME = DEPTERS, PROCOPT = A, KEYLEN = 18 • SENSEG NAME = DEPARTMENT, PARENT = 0 • SENSEG NAME = DEPTNAME, START = 1 • SENSEG NAME = EMPLOYEE, PARENT = DEPARTMENT • SENFLD NAME = EMPNAME, START = 1 • PROCOPT G = GET I = INSERT R = REPLACE D = DELETE A = ALL

    32. IMS Access Methods • HSAM • HISAM • HDAM • HIDAM

    33. SKILLCODE SKILLCODE SKILLCODE SKILLNAME SKILLNAME SKILLNAME 10 5 2 Programmer Sales Systems Analyst DEPTNAME MANAGER Marketing Smith EMPNAME EMPNAME YRS-SVC YRS-SVC Hill Bond 5 7 Tree Occurrence Example

    34. DEPTNAME MANAGER * Marketing Smith EMPNAME YRS-SVC * Bond 7 * Hill 5 SKILLCODE SKILLNAME * 2 Programmer * 5 Systems Analyst o 10 Sales Hierarchical Pointers

    35. DEPTNAME MANAGER * * Marketing Smith (Child Pointer) (Twin Pointer) EMPNAME YRS-SVC * * Bond 7 * o Hill 5 SKILLCODE SKILLNAME o * 2 Programmer o o 5 Systems Analyst o o 10 Sales Child and Twin Pointers

    36. The IMS Data Manipulation Language • The language? • Program Work Area • Segment templates • Currency templates

    37. GET UNIQUE (GU) GET NEXT (GN) GET NEXT WITHIN PARENT (GNP) <hold options> GHU, GHN, GHNP INSERT (ISRT) REPLACE (REPL) DELETE (DLET) Retrieve the first segment that satisfies a given condition Retrieve the next segment Retrieves the next segment, but only within the current parent Lock the database for GU, GN, GNP Add a new segment to the database Modify the value of a segment field Delete a segment DL/1 • Data Language 1 • Commonly used commands Command <segment name> <WHERE qualification>

    38. Get Unique (GU) • A Simple Segment Retrieval GU DEPARTMENT (DEPTNAME = ‘Marketing’) • Retrieval of a Dependent Segment GU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE? (EMPNAME = ‘Steve Smith’)

    39. Retrieval of dependent Segment When Parent is Not Known GU DEPARTMENT EMPLOYEE (EMPNAME = ‘Steve Smith’) • Get Next (GN) • Retrieval of a Set of Segments GU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE GN EMPLOYEE

    40. Retrieving All Segments of a Particular Type GU DEPARTMENT EMPLOYEE MORE GN EMPLOYEE GOTO MORE • Get Next Within Parent (GNP) • Retrieving Segments for Just One Parent GU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE GNP EMPLOYEE

    41. Retrieving Segments for Just One Parent GU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE (EMPNAME = ‘Steve Smith’) SKILLS NEXT GNP SKILLS GOTO NEXT • Get Hold • GET HOLD UNIQUE • GET HOLD NEXT • GET HOLD NEXT WITHIN PARENT

    42. Replace (REPL) • Modifying Segment Field Values GHU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE (EMPNAME = ‘Irving Valtz’) MOVE 55000 TO SALARY REPL

    43. Delete (DLET) • Deleting a Segment GHU DEPARTMENT (DEPTNAME = ‘Marketing’) EMPLOYEE (EMPNAME = ‘Irving Valtz’) DLET

    44. Insert (INSRT) • Adding a Segment MOVE 598 TO SKILLCODE MOVE ‘ENGINEERING DRAFTSMAN’ TO SKILLNAME MOVE 0 TO YRS-EXPERIENCE INSRT DEPARTMENT (DEPTNAME = ‘Engineering’) EMPLOYEE (EMPNAME = ‘Bob Lee’) SKILL

    45. Hierarchical Data Model Evaluation • Data representation • Data manipulation language