written 8.0 years ago by |
Object Identity:
Any object has 2 properties i.e. state & behaviour hence, it’s similar to the program variable but object has complex structure.
There are two types of object :-
1.) Transient object 2.) Persistent object
1.) Transient object: - These objects exist during the execution but destroy ones the program terminates.
2.) Persistent object: - These objects persist & store into database even if program terminate. Whenever any object created DBMS assigns unique identifier called as object identity & its abbreviated as OID.
OID is used for two purposes.
- To identity each objects uniquely.
- Make reference to another object.
- Properties of OID
- Its unique
- Its system generated
- Its invisible to the user
- It’s not possible t perform operation on OID
- It’s in mutable i.e. once its generated
- It cannot be regenerated
- It has along integer values
- Object structure
Every object has internal structure that can be specified by using 6 types of type constructor (AST LAM)…
- ATDM: - Internal structure of object consists of automatic values that may be of type integer float, character, string, data etc.
- SET:- Internal structure of object, consist of collection of OID’s of other objects that may be constructed from different type constructor its denoted by {i1 , i2 , i3 , …}
- Tuples:- Internal structure of object, consist of collection of OID’s other objects that may be constructed from different type constructor its denoted by {a1 : i1 ; a2 : i2 ; a3 : i3, …} where a1 , a2 , a3 , … be the attributers & i1 , i2 , i3 be OID’s
- List :- Its similar to the set but it’s an ordered collection its denoted by { i1 , i2 , i3 , …}
- ARRAY: - It’s similar to list but it has limitations I.e. it’s of fixed size.
- MULTISET or bag: - It’s similar to the set but it may contain duplicate. Any object structure is represented
By triplet i.e. {I, C, V}
I = Object identifier.
E = type constructer.
V = value.
For e.g.:- Let us consider the following relation.
Dno | Dname | - - - |
---|---|---|
5 | Research | - - - |
Location:-
Dno | Dname |
---|---|
5 | 4 |
5 | 12 |
For above 2 relations object structure can be created as follows:-
01 = <i1, atom,="" 5="">
02 = <i2, atom,="" “research="">”
03 = <i3, atom,="" “l1”><="" p="">
04 = <i4, atom,="" “l2”><="" p="">
05 = <i5, set,="" <i3,="" i4="" ><="" p="">
06 = <i6, tuple="" ;<="" dno;="" i="" 1,="" d="" name="" i2,="" coc="">
Type constructor
It’s used to define the data structure for object oriented, DB there are six types of type constructor. (Refer objects structure)
Let us consider employee & department relation.
Type constructor can be created as follows:-
Define type employees Type (id: integer; Name: string, Gender: string, DOB: date, Address: string, Salary: Float Manager: Employee, D no: Department.) End; Define type name Type (fname Mname Dname) End; Define type address Type (apt no: Area: City: Pin code: End; ) Define type department Type (dno: integer Dname: string Location: set (string), manager Employees) End;