1 / 46

THE NETWORK DATA MODEL SECTION 8

THE NETWORK DATA MODEL SECTION 8. An early DBMS. Background. Networks are a natural way of representing relationships among objects. The network data model represents data in network structures of record types connected in one-to-one or one-to-many relationships.

sanne
Download Presentation

THE NETWORK DATA MODEL SECTION 8

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. THE NETWORK DATA MODELSECTION 8 An early DBMS

  2. Background • Networks are a natural way of representing relationships among objects • The network data model represents data in network structures of record types connected in one-to-one or one-to-many relationships

  3. Conference on Data Systems Language • Early 1960s • American Standards Institute (ANSI) – 1971 • IDS and IDMS

  4. Concepts • Schema • Subschema • Physical details

  5. Records and Sets • Record type • Set • Owner record type • Member record type

  6. CUSTOMER SALESPERSON OWNER OWNER CUSTPO SET SALESPO SET PURCHASE-ORDER OWNER MEMBER One-to-many relationship One-to-one relationship POITEM SET LINE-ITEMS MEMBER A Bachman Diagram A Data Structure Diagram

  7. CUSTOMER SALESPERSON Smith Jones Bean Darwin Wallace PO #1 PO #2 PO #3 PO #4 Pens Pencils Erasers Envelopes Instance or Occurrence An Example of a Network Data Structure

  8. Types of Networks • Simple networks • Complex networks • Link record type

  9. STUDENT STUDENT TAKING CLASS SET CLASS STUDENT- ID CLASS-ID SC ENROLLED SET CLASS Thus a complex network An Example of a Link Record

  10. Peter Black Sue White Judy Dench PB A461 PB B304 PB E230 SW A461 SW E230 JD A461 Accounting 461 Botany 304 English 230 Expanded Example Converts a complex network into a simple network

  11. CUST-ID NAME ADDRESS ACCT # BALANCE HAS- ACCOUNT CUSTOMER ACCOUNT 1 N CUST-ID NAME ADDRESS ACCT # BALANCE CUSTOMER ACCOUNT CUSTOMER/ACCOUNT SET The Model’s Relationship to Conceptual Modeling Semantics • An example of a conceptual model?

  12. RULE 1 • For each entity of set E in a conceptual schema, create a record type R in the network data structure. All attributes of E are represented as fields in R

  13. Representing One-to-Many Relationships CUSTOMER ACCOUNT CUSTOMER ACCOUNT RULE 2 For one-to-many relationships, the record type on the “one” side of the relationship becomes the owner, the record type on the “many” side becomes the member record type. If the relationship is strictly one-to-one, then the owner and member record types are chosen arbitrarily.

  14. Transforming n-ary Relationships SOLD PRODUCT COUNTRY N M M DATE • An example could be a three-way relationship

  15. Must create a link record PRODUCT DATE COUNTRY Date/Link Set Product/Link Set Country/Link Set LINK RECORD RULE 3 For each n-ary relationships, n > 2, create a linking record L, and make it the member record type in n set types. Designate the owner of each set type as the record type on the “one” side of the resulting on-to-many relationship.

  16. Nov. 2, 1999 Dec. 5, 1999 Jan. 13 2000 Jan. 15, 2000 DATES • The Database from the above example LINK 1 PRODUCTS COUNTRIES Widget Australia LINK 2 Clamp Canada LINK 3 Gadget USA LINK 4

  17. Transforming Many-To-Many Relationships MANUFACTURER PRODUCT RULE 4 • For each may-to-many relationship between entity sets E1 and E2 create a link record type L and make it the member record type in two set types, of which the set type owners are the record types corresponding to E1 and E2. • An manufacturer may produce many products, and any one of these products can be made by several manufacturers

  18. LREC 1 MANUFACTURER PRODUCT Ron Smith Gamma, Inc Bean Mfg. 450 Maple St. 68 Main St.. 26 Harris Ave. 115 116 120 Clamp Gadget Widget 2 3 MANUFACTURER PRODUCT Manufacturer/LRec Set Product/LRec Set 4 LREC

  19. Data Definition Language • What is the DDL? • Use the DDL to define the database schema • The following procedure should be used.

  20. Procedure • Create the conceptual data model • Map the conceptual data model to network data structure diagrams • Use the DDL to implement the schema

  21. A schema is made up of: • Schema section • Record sections • Set sections

  22. Create the conceptual model HAS- INVOICE CUSTOMER INVOICE 1 M 1 CONTAINS M LINE-ITEM

  23. Map to a network structure CUSTINV CUSTOMER INVOICE INVITEM LINE-ITEM

  24. Implement the schema • SCHEMA NAME IS ACCOUNTSREC • RECORD NAME IS CUSTOMER • CUST-ID TYPE IS NUMERIC INTEGER • NAME TYPE IS CHARACTER 15 • ADDRESS TYPE IS CHARACTER 20 • ACCOUNT-BALANCE TYPE IS NUMERIC (5,2) • RECORD NAME IS INVOICE • INVONO TYPE IS NUMERIC INTEGER • DATE TYPE IS CHARACTER 9 • AMOUNT TYPE IS NUMERIC (5,2) • STATUS TYPE IS CHARACTER 2 • RECORD NAME IS LINE-ITEM • STOCKNO TYPE IS NUMERIC INTEGER • DESCRIPTION TYPE IS CHARACTER 20 • PRICE TYPE IS NUMERIC (4,2) • CUSTINV • OWNER IS CUSTOMER • MEMBER IS INVOICE • INVITEM • OWNER IS INVOICE • MEMBER IS LINE-ITEM

  25. From Schema to Subschema • Title division • Mapping division • Structure division • Subschema record section • Subschema set section

  26. Subschema Example • SS INVSTATUS WITHIN ACCOUNTSREC. • MAPPING DIVISION. • ALIAS SECTION. • AD RECORD CUSTOMER IS OWEDBY. • AD SET CUST-INV IS OWEDBY – INV. • STRUCTURE DIVISION. • RECORD SECTION. • 01 OWEDBY. • 05 CUST-ID. • 05 NAME. • 05 ACCOUNT-BALANCE. • 01 INVOICE ALL. • SET SECTION. • SD OWEDBY-INV

  27. Data Manipulation Language • What is the DML? • Process records one at a time • The following procedure should be used.

  28. Basic Commands • Navigational commands • Retrieval commands • Update commands • Records • Sets

  29. Basic DML Commands Command Type FIND GET ERASE STORE MODIFY CONNECT DISCONNECT RECONNECT Navigation Retrieval Record Update Set Update

  30. Some terms defined • User working area • Currency indicators • Status flags • Record templates

  31. OWEDBY TEMPLATE 14 16 14 10 Bean Smith Bean Black 75 100 150 150 205 205 213 210 06-29-99 05-31-99 06-20-90 05-31-99 55 42 25 25 01 01 01 02 INVOICE TEMPLATE CURRENCY POINTERS OWEDBY INSTANCES OWEDBY INVOICE INVOICE INSTANCES OWEDBY- INVOICE RUN-UNIT User Working Area in Primary Memory Relationship of User Working Area to Database Instances

  32. Retrieval and Update A Simple Record Retrieval MOVE 105 TO CUST-ID IN CUSTOMER FIND ANY CUSTOMER USING CUST-ID GET CUSTOMER • FIND Command • GET Command

  33. Retrieval of all Records with a Particular Characteristic MOVE 0 TO ACCOUNT-BALANCE IN CUSTOMER FIND ANY CUSTOMER USING ACCOUNT-BALANCE DOWHILE DB-STATUS = 0 GET CUSTOMER (process customer record) FIND DUPLICATE CUSTOMER USING ACCOUNT-BALANCE END-DO

  34. Deleting Records MOVE 0 TO ACCOUNT-BALANCE IN CUSTOMER FIND FOR UPDATE ANY CUSTOMER USING ACCOUNT-BALANCE DOWHILE DB-STATUS = 0 ERASE CUSTOMER FIND FOE UPDATE DUPLICATE CUSTOMER USING ACCOUNT-BALANCE END-DO • ERASE Command

  35. Modifying Record Contents MOVE 502 TO CUST-ID IN CUSTOMER FIND FOR UPDATE ANY CUSTOMER USING CUST-ID GET CUSTOMER IF DB-STATUS = 0 THEN MOVE “455 Cherry Lane, Hamilton, Ontario” TO ADDRESS IN CUSTOMER MODIFY CUSTOMER ELSE (perform error routine) END-IF • MODIFY Command

  36. Adding New Records MOVE 503 TO CUST-ID IN CUSTOMER MOVE “James W. Smith” TO NAME IN CUSTOMER MOVE “201 Scenic Drive, Hamilton,Ontario” TO ADDRESS IN CUSTOMER MOVE 500.00 TO ACCOUNT-BALANCE IN CUSTOMER STORE CUSTOMER • STORE Command

  37. Set Operations Placing a Record in a Set MOVE 231 TO INVNO IN INVOICE MOVE “7/7/99” TO DATE IN INVOICE MOVE 100.00 TO INVOICE-AMOUNT IN INVOICE STORE INVOICE MOVE 431 TO CUST-ID IN CUSTOMER FIND ANY CUSTOMER USING CUST-ID CONNECT INVOICE TO CUSTOMER • CONNECT Command

  38. Removing a Record from a Set MOVE 254 TO INVNO OF INVOICE FIND ANY INVOICE USING INVNO DISCONNECT INVOICE FROM CUSTINV • DISCONNECT Command

  39. Changing Set Membership MOVE 510 TO INVNO OF INVOICE FIND ANY INVOICE USING INVNO MOVE 431 TO CUST-ID IN CUSTOMER FIND ANY CUSTOMER USING CUST-ID RECONNECT INVOICE IN CUSTINV • RECONNECT Command

  40. Set Membership Classification • Set insertion class • Defined by the statement: • INSERTION IS <insert mode> • Manual insertion or Automatic insertion

  41. Subschema Fragment SET NAME IS CUSTINV. OWNER IS CUSTOMER MEMBER IS INVOICE INSERTION IS MANUAL RETENTION IS OPTIONAL • Manual Insertion Mode • Must be placed by using CONNECT • CONNECT <record type> TO <set type>

  42. Placing a Record in a Set MOVE 231 TO INVNO IN INVOICE MOVE “7/7/99” TO DATE IN INVOICE MOVE 100.00 TO INVOICE-AMOUNT IN INVOICE STORE INVOICE MOVE 431 TO CUST-ID IN CUSTOMER FIND ANY CUSTOMER USING CUST-ID CONNECT INVOICE TO CUSTOMER

  43. Placing a Record in a Set MOVE 431 TO CUST-ID IN CUSTOMER FIND ANY CUSTOMER USING CUST-ID MOVE 231 TO INVNO IN INVOICE MOVE “7/7/99” TO DATE IN INVOICE MOVE 100.00 TO INVOICE-AMOUNT IN INVOICE STORE INVOICE • Automatic Insertion Mode • Must be placed by using STORE • STORE <record type>

  44. Set Retention • Retention options are: • Fixed • Mandatory • Optional

  45. Subschema Fragment CUSTINV. OWNER IS CUSTOMER MEMBER IS INVOICE INSERTION IS MANUAL RETENTION IS OPTIONAL INVITEM OWNER IS INVOICE MEMBER IS LINE-ITEM INSERTION IS MANUAL RETENTION IS OPTIONAL

  46. Implementation • Large size • Well-defined repetitive queries • Well-defined transactions • Well-defined applications

More Related