- •Reznichenko Valery
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
- •Lecture 4. Network Data Model
Lecture 4. Network Data Model
Cycles and loops
|
Cycle |
|
|
|
Loop |
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRODUCT |
|
|
|||
|
|
|
|
|
|
|
||||||||
|
PLANT |
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
Consists of |
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ASSEMBLY |
|
||||
|
|
|
|
|
|
|||||||||
|
CONTRACT |
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
Consists of |
|||
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PART |
|
|||
|
|
|
|
|
|
|||||||||
|
PART |
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSF NAU |
11 |
Lecture 4. Network Data Model
Possible categories of network schemas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Two level schemas |
|
Multilevel schemas |
|
Schema |
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with cycles |
|
||||||
|
|
|
Without |
|
With |
|
Without |
|
With |
|
|
||||||||
|
|
|
branches |
|
branches |
|
branches |
|
branches |
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hierarchical structures
Network structures
Loops
(one level cycles)
CSF NAU |
12 |
Lecture 4. Network Data Model
Application and DBMS
User Work Area (UWA) contains:
current state indicators,
records,
error status.
CSF NAU |
13 |
Lecture 4. Network Data Model
Network data model operations
Data selection (Query Language - QL):
FIND - locates a described record occurrence
GET - reads a record occurrence from the database
Data manipulation (Data Manipulation Language-DML):
STORE - puts a record occurrence into the database
INSERT - inserts member record into a set occurrence
REMOVE - removes member record from a set occurrence
DELETE - deletes current record from DB
MODIFY - updates current record
CSF NAU |
14 |
Lecture 4. Network Data Model
Data searching and selection
FIND Record location. A desired record occurrence is located. Located record occurrence becomes current. Current status indicator in UWA points to a located record occurrence
There is really set of FIND command that allow :
find the record by a key,
find any member record in a set occurrence,
scan a set occurrence for those member records having specified values in certain fields,
find an owner record of a given set occurrence.
GET Puts selected (current) record into UWA.
CSF NAU |
15 |
Lecture 4. Network Data Model
Fine the record by DB-key
Syntax:
FIND [recordname] RECORD BY DATABASE KEY [variable]
Example:
X=10;
FIND Faculty RECORD BY DATABASE KEY X;
If Error_Status=0 then GET Faculty;
Else Print "Not Found !";
CSF NAU |
16 |
Lecture 4. Network Data Model
Fine the record by field values
In order to find a record directly using known values of its fields, such fields should be defined as so-called CALC-keys in the database schema.
Syntax:

FIND [recordname] RECORD BY CALCKEY
Example: Find lecture record with LID field value “L3” (Field LID is defined as как CALC-field)
Lecture.LID = "L3";
FIND Lecture RECORD BY CALCKEY;
|
|
|
TEACHER |
|
T1 |
T2 |
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
Selected record |
|
|
|
|
Has |
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
L1 L2 |
L3 L4 |
L5 |
|
|
|
|
|
LECTURE |
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
CSF NAU |
|
Is taught at |
|
|
|
|
17 |
|||||
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
||||
SUBJECT |
|
|
|
S1 |
S2 |
S3 |
||||||
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
Lecture 4. Network Data Model
Scanning a Set Occurrence
The set occurrence can be viewed as a “ring” consisting of the owner record and all of the member records. Member records are ordered within there owner record.
TEACHER |
T1 |
|
|
T2 |
|
|
T1 |
|
T2 |
|
Has |
|
|
|
|
|
|
|
|
|
|
LECTURE |
L1 |
L2 |
L3 |
L4 |
L5 |
L1 |
L2 |
L3 |
L4 |
L5 |
Is_taught_at |
|
|
|
|
|
|
|
|
|
|
SUBJECT |
S1 |
|
|
S2 |
S3 |
S1 |
|
|
S2 |
S3 |
CSF NAU |
18 |
Lecture 4. Network Data Model
The next member record in the set occurrence
Syntax:

FIND NEXT [recordname] RECORD IN [setname] SET
Example:

FIND NEXT Lecture RECORD IN Has SET;
TEACHER |
|
T1 |
|
T2 |
|
Has |
|
|
|
|
|
LECTURE |
L1 |
L2 |
L3 |
L4 |
L5 |
|
|
|
|
|
|
Is_taught_at |
|
|
|
|
|
SUBJECT |
S1 |
|
|
S2 |
S3 |
CSF NAU
Current occurrence of the set “Has”
L2 - current member record of the set “Has”
L3 - the next member record of the set “Has”
Error_Status != 0 – the end of member records in the set
occurrence is reached
19
Lecture 4. Network Data Model
The prior member record in the set occurrence
Syntax:

FIND PRIOR [recordname] RECORD IN [setname] SET
Пример:

FIND PRIOR Lecture RECORD IN Has SET;
TEACHER |
T1 |
T2 |
|
Has |
|
|
|
LECTURE |
L1 L2 L3 |
L4 |
L5 |
Is_taught_at |
|
|
|
SUBJECT |
S1 |
S2 |
S3 |
CSF NAU
Current occurrence of the set “Has”
L3 - current member record of the set “Has”
L2 - the previous member record of the set “Has”
Error_Status != 0 – the begin of member records in the set
occurrence is reached
20
