the network data model section 8
DESCRIPTION
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. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/1.jpg)
THE NETWORK DATA MODEL
SECTION 8
An early DBMS
![Page 2: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/2.jpg)
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
![Page 3: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/3.jpg)
Conference on Data Systems Language
• Early 1960s
• American Standards Institute (ANSI) – 1971
• IDS and IDMS
![Page 4: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/4.jpg)
Concepts
• Schema
• Subschema
• Physical details
![Page 5: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/5.jpg)
Records and Sets
• Record type
• Set
• Owner record type
• Member record type
![Page 6: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/6.jpg)
A Bachman Diagram A Data Structure Diagram
CUSTOMER
PURCHASE-ORDER
LINE-ITEMS
SALESPERSONOWNER OWNER
MEMBEROWNER
MEMBER
SALESPO SETCUSTPO SET
POITEM SET
One-to-many relationship
One-to-one relationship
![Page 7: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/7.jpg)
Instance or Occurrence
Smith Jones Bean
PO #1 PO #2 PO #3 PO #4
Pens Pencils Erasers Envelopes
Darwin Wallace
CUSTOMER SALESPERSON
An Example of a Network Data Structure
![Page 8: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/8.jpg)
Types of Networks
• Simple networks
• Complex networks
• Link record type
![Page 9: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/9.jpg)
An Example of a Link Record
STUDENT
CLASS
Thus a complex network
STUDENT
STUDENT-ID
CLASS
CLASS-ID
TAKING CLASS SET
ENROLLED SET
SC
![Page 10: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/10.jpg)
Expanded Example
Sue White Judy Dench
PB A461
Peter Black
PB E230 SW A461 SW E230 JD A461PB B304
Botany 304 English 230Accounting
461
Converts a complex network into a simple network
![Page 11: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/11.jpg)
The Model’s Relationship to Conceptual Modeling Semantics• An example of a conceptual model?
CUSTOMER ACCOUNTHAS-
ACCOUNT1 N
CUST-ID NAME ADDRESS ACCT # BALANCE
CUST-ID NAME ADDRESS BALANCEACCT #CUSTOMER ACCOUNT
CUSTOMER/ACCOUNT SET
![Page 12: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/12.jpg)
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
![Page 13: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/13.jpg)
Representing One-to-Many Relationships
CUSTOMER ACCOUNT
CUSTOMER ACCOUNT
RULE 2For 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.
![Page 14: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/14.jpg)
Transforming n-ary Relationships
•An example could be a three-way relationship
PRODUCT
DATE
COUNTRYSOLDN M
M
![Page 15: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/15.jpg)
• Must create a link record
PRODUCT DATE COUNTRY
LINKRECORD
Product/Link Set
Date/Link Set Country/Link
Set
RULE 3For 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.
![Page 16: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/16.jpg)
Nov. 2, 1999 Jan. 15, 2000Jan. 13 2000Dec. 5, 1999DATES
LINK 1
LINK 2
LINK 3
LINK 4
Australia
Canada
USA
Widget
Clamp
Gadget
PRODUCTS COUNTRIES
•The Database from the above example
![Page 17: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/17.jpg)
Transforming Many-To-Many Relationships
•An manufacturer may produce many products, and any one of these products can be made by several manufacturers
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.
![Page 18: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/18.jpg)
MANUFACTURER PRODUCT
LREC
Product/LRec SetManufacturer/LRec Set
Ron Smith 450 Maple St.
Gamma, Inc 68 Main St..
Bean Mfg. 26 Harris Ave.
115 Widget
116 Clamp
120 Gadget
1
2
3
4
MANUFACTURER PRODUCT
LREC
![Page 19: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/19.jpg)
Data Definition Language
• What is the DDL?
• Use the DDL to define the database schema
• The following procedure should be used.
![Page 20: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/20.jpg)
Procedure
• Create the conceptual data model
• Map the conceptual data model to network data structure diagrams
• Use the DDL to implement the schema
![Page 21: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/21.jpg)
A schema is made up of:
• Schema section
• Record sections
• Set sections
![Page 22: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/22.jpg)
1. Create the conceptual model
CUSTOMER
LINE-ITEM
INVOICEHAS-
INVOICE1 M
1
CONTAINS
M
![Page 23: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/23.jpg)
2. Map to a network structure
CUSTOMER
LINE-ITEM
INVOICE
CUSTINV
INVITEM
![Page 24: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/24.jpg)
3. Implement the schema1. SCHEMA NAME IS ACCOUNTSREC
2. RECORD NAME IS CUSTOMER
3. CUST-ID TYPE IS NUMERIC INTEGER
4. NAME TYPE IS CHARACTER 15
5. ADDRESS TYPE IS CHARACTER 20
6. ACCOUNT-BALANCE TYPE IS NUMERIC (5,2)
7. RECORD NAME IS INVOICE
8. INVONO TYPE IS NUMERIC INTEGER
9. DATE TYPE IS CHARACTER 9
10. AMOUNT TYPE IS NUMERIC (5,2)
11. STATUS TYPE IS CHARACTER 2
12. RECORD NAME IS LINE-ITEM
13. STOCKNO TYPE IS NUMERIC INTEGER
14. DESCRIPTION TYPE IS CHARACTER 20
15. PRICE TYPE IS NUMERIC (4,2)
16. CUSTINV
17. OWNER IS CUSTOMER
18. MEMBER IS INVOICE
19. INVITEM
20. OWNER IS INVOICE
21. MEMBER IS LINE-ITEM
![Page 25: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/25.jpg)
From Schema to Subschema
• Title division
• Mapping division
• Structure division• Subschema record section
• Subschema set section
![Page 26: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/26.jpg)
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
![Page 27: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/27.jpg)
Data Manipulation Language
• What is the DML?
• Process records one at a time
• The following procedure should be used.
![Page 28: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/28.jpg)
Basic Commands
• Navigational commands
• Retrieval commands
• Update commands• Records
• Sets
![Page 29: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/29.jpg)
Basic DML Commands
FIND
GET
ERASE
STORE
MODIFY
CONNECT
DISCONNECT
RECONNECT
Command
Navigation
Retrieval
Record Update
Set Update
Type
![Page 30: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/30.jpg)
Some terms defined
• User working area
• Currency indicators
• Status flags
• Record templates
![Page 31: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/31.jpg)
14 Bean 150
OWEDBY TEMPLATE
205 012505-31-99
INVOICE TEMPLATE
OWEDBY
INVOICE
OWEDBY-INVOICE
RUN-UNIT
CURRENCY POINTERS
10 Smith 100
14 Bean 150
16 Black 75
205 012505-31-99
210 024206-20-90
213 015506-29-99
User Working Area in Primary Memory
OWEDBY
INSTANCES
INVOICE
INSTANCES
Relationship of User Working Area to Database Instances
![Page 32: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/32.jpg)
Retrieval and Update
• FIND Command
• GET Command
MOVE 105 TO CUST-ID IN CUSTOMER
FIND ANY CUSTOMER USING CUST-ID
GET CUSTOMER
A Simple Record Retrieval
![Page 33: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/33.jpg)
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
Retrieval of all Records with a Particular Characteristic
![Page 34: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/34.jpg)
• ERASE Command
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
Deleting Records
![Page 35: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/35.jpg)
• MODIFY Command
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
Modifying Record Contents
![Page 36: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/36.jpg)
• STORE Command
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
Adding New Records
![Page 37: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/37.jpg)
Set Operations
• CONNECT Command
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
Placing a Record in a Set
![Page 38: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/38.jpg)
• DISCONNECT Command
MOVE 254 TO INVNO OF INVOICE
FIND ANY INVOICE USING INVNO
DISCONNECT INVOICE FROM CUSTINV
Removing a Record from a Set
![Page 39: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/39.jpg)
• RECONNECT Command
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
Changing Set Membership
![Page 40: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/40.jpg)
Set Membership Classification
• Set insertion class
• Defined by the statement:
• INSERTION IS <insert mode>
• Manual insertion or Automatic insertion
![Page 41: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/41.jpg)
• Manual Insertion Mode
• Must be placed by using CONNECT– CONNECT <record type> TO <set type>
SET NAME IS CUSTINV.
OWNER IS CUSTOMER
MEMBER IS INVOICE
INSERTION IS MANUAL
RETENTION IS OPTIONAL
Subschema Fragment
![Page 42: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/42.jpg)
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
Placing a Record in a Set
![Page 43: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/43.jpg)
• Automatic Insertion Mode
• Must be placed by using STORE– STORE <record type>
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
Placing a Record in a Set
![Page 44: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/44.jpg)
• Set Retention
• Retention options are:
– Fixed
– Mandatory
– Optional
![Page 45: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/45.jpg)
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
Subschema Fragment
![Page 46: THE NETWORK DATA MODEL SECTION 8](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56814a44550346895db76041/html5/thumbnails/46.jpg)
Implementation
• Large size
• Well-defined repetitive queries
• Well-defined transactions
• Well-defined applications