Hierarchy Data Model

Содержание

Слайд 2

CONTENTS Definition of the data model Hierarchy data structure Hierarchy data

CONTENTS

Definition of the data model
Hierarchy data structure
Hierarchy data

structure operations
Integrity constraints
Advantageous and drawbacks
Слайд 3

Data model definition Data structure Operations Integrity constraints schema – data

Data model definition

Data structure
Operations
Integrity constraints

schema – data description
instance –

data value
data structure = schema + instance
data algebra = data structure + operations
data model = data algebra + integrity constraints
Слайд 4

Field and Segment Graphic notation: TEACHER (Name, Post, Address) Data field

Field and Segment

Graphic notation:

TEACHER (Name, Post, Address)

Data field – elementary named

data. Its instance is a data value.
Segment – is a named set of field names:

TEACHER

Name

Post

Address

Segment instance – ordered set of fields instances:

TEACHER

Johnson

professor

Kiev

Слайд 5

Hierarchy Data Schema It is hierarchy ordered set of segments with

Hierarchy Data Schema

It is hierarchy ordered set of segments with

the following properties:

every segment has 0 or 1 parent segment and 0 or more child segments;
root do not have parent segment;
leaves do not have child segments;
twin segments have the same parent segment.

Слайд 6

Hierarchy Data Schema (2) TEACHER Name Post Address DEPARTMENT Name Head

Hierarchy Data Schema (2)

TEACHER

Name

Post

Address

DEPARTMENT

Name

Head

Building

FACULTY

Name

Dean

Fund

FACULTY

DEPARTMENT

TEACHER

Слайд 7

Hierarchy Data Schema (3)

Hierarchy Data Schema (3)

Слайд 8

Hierarchy Schema Instance (1) Integrity constraints: Every instance of a segment

Hierarchy Schema Instance (1)

Integrity constraints:
Every instance of a segment is connected

with the only instance of its parent segment.
Instance of any segment cannot exist without connection to the instance of its parent segment.

Hierarchy Schema Instance – it is one instance of the root segment and 0 or more instances of the child segments for each instance of the parent segment.

Слайд 9

Hierarchy Schema Instance (2) FACULTY DEPARTMENT STUDENT Informatics CAD Alex Operating

Hierarchy Schema Instance (2)

FACULTY

DEPARTMENT

STUDENT

Informatics

CAD

Alex

Operating systems

Bobby

Diana

Helen

Mary

John

Schema Schema instance

Слайд 10

Hierarchy Data Structure Hierarchy data structure is a collection of hierarchy

Hierarchy Data Structure

Hierarchy data structure is a collection of hierarchy data

schema and a set of instances of this schema.

Schema Schema instances

Слайд 11

Hierarchy Data Base Hierarchy data base is a set of hierarchy

Hierarchy Data Base

Hierarchy data base is a set of hierarchy data

structures.

Schemas Schemas instances


Слайд 12

Hierarchy Data Structure Operations Data selection: GET UNIQUE GET NEXT GET

Hierarchy Data Structure Operations

Data selection:
GET UNIQUE
GET NEXT
GET NEXT WITHIN

PARENT
Data manipulation:
INSERT
GET HOLD
REPLACE
DELETE
Слайд 13

Data selection (1) Direct access. It finds the first segment of

Data selection (1)

Direct access. It finds the first segment of the

specified type that satisfies specified condition. Allows to fix initial position for the future sequential navigation in hierarchy structure.

GET UNIQUE

Syntax:

Example:

GET UNIQUE
[WHERE ];

GET UNIQUE TEACHER
WHERE FACULTY.Name = "informatics" AND
DEPARTMENT.Name = "SE" AND
TEACHER.Post = "professor";

Слайд 14

Data selection (2) Sequential access. It selects the next segment located

Data selection (2)

Sequential access. It selects the next segment located after

the current segment. A default segment ordering is used.

GET NEXT

GET NEXT
[WHERE ];

Syntax:

Example:

GET NEXT TEACHER
WHERE FACULTY.Name = "informatics" AND
DEPARTMENT.Name = "SE" AND
TEACHER.Post = "professor";

Слайд 15

Data selection (3) Example. Select all professors of the mathematics department

Data selection (3)

Example. Select all professors of the mathematics department of

the informatics faculty:

GET UNIQUE TEACHER
WHERE FACULTY.Name = "informatics" AND
DEPARTMENT.Name = "mathematics" AND
TEACHER.Post = "professor";
...
NT: GET NEXT TEACHER
WHERE FACULTY.Name = "informatics" AND
DEPARTMENT.Name = "mathematics " AND
TEACHER.Post = "professor";
...
goto NT

Слайд 16

Data selection (4) Sequential access to the segments within specified parent

Data selection (4)

Sequential access to the segments within specified parent segment


GET NEXT WITHIN PARENT

Syntax:

GET NEXT WITHIN PARENT <тsegment-type>
[WHERE ];

Слайд 17

Data manipulation (1) INSERT – insertion of segment instances. Example. Enter

Data manipulation (1)

INSERT – insertion of segment instances.
Example. Enter segment about

CAD department of the informatics faculty and information about teacher Smith of this department.

DEPARTMENT.Name = "CAD";
DEPARTMENT.Head = "Nemiroff";
DEPARTMENT.Building = 3;
INSERT DEPARTMENT
WHERE FACULTYТ.Name = "informatics";
TEACHER.Name = "Smith";
TEACHER.Post = “assistant"
TEACHER.Address = "Shevchenko avenue 13/17";
INSERT TEACHER
WHERE FACULTY.Name = "informatics" AND DEPARTMENT.Name = "CAD";

Слайд 18

Data manipulation (2) GET HOLD – selection the segment to be

Data manipulation (2)

GET HOLD – selection the segment to be replaced REPLACE

– segment replacing.
Example. Change address of the Smith teacher of the CAD department of the informatics faculty.

GET HOLD UNIQUE TEACHER
WHERE = FACULTY.Name = "informatics" AND DEPARTMENT.Name = "CAD" AND TEACHER.Name = "Smith";
TEACHER.Address = " Teremkovskaya str. 1/19";
REPLACE;

Слайд 19

Data manipulation (3) GET HOLD – selection the segment to be

Data manipulation (3)

GET HOLD – selection the segment to be deleted DELETE

– selected segment deletion.
Example. Delete segment about Smith teacher of the CAD department of the informatics faculty.

GET HOLD UNIQUE Teacher
WHERE = Faculty.Name = "informatics" AND
DEPARTMENT.Name = "CAD" AND
TEACHER.Name = "Smith";
DELETE;

Слайд 20

Hierarchy data model advantages Advanced low level facilities to control of

Hierarchy data model advantages

Advanced low level facilities to control of data

in external memory
An opportunity of efficient usage of the memory
An opportunity to implement an efficient application systems