OBJECTS OBJECT IDENTITY REFERENCE TYPES
Object identifier - oid
FILE SYSTEM
Data object
Object identifier - oid
FILE SYSTEM
Data object
DBMS
?
Differences between URL and Oid
Uniquely identify a single object over all time
Are simply identifiers and carry no physical information about the object thay identify
Are automatically generated by the DBMS for each object
The web resource pointed at by an URL can change over time
Include network addresses and often file-system names as well
Are user-generated
Oid URL
Notions of equality
deep equal :Two objects having the same type are defined, if and only if:
The object are of atomic type and have the same value, or
The objects are of reference type, and the deep equals operator is true for the two referenced objects, or
The objects are of structured type, and the deep equals operator is true for all the corresponding subparts of the two objects.
Notions of equality
Shallow equal: two objects that have the same reference type ( if they both refer to the same object).
Notions of equality
Example:create table frames (frameno integer, image jpeg, category integer);create table categories (cid integer, name text, lease_price float, comments
text);create type theater_t as row (tno integer, nametext, address text, phone
integer)create table theaters of theater_t;create table nowshowing (film integer, theaterref(theater_t), start date,
enddate);create table films (filmno integer, title text,stars setof(text), director text, budgetfloat);create table countries (name text, boundarypolygon, population integer,
language text)
Notions of equality
ROW(538, t89, 6-3-97, 8-7-97) ROW(538, t33, 6-3-97, 8-7-97)
Shallow equal
deep equal
INHERITANCE
• Defining Types with Inheritance• Binding of Methods• Collection Hierarchies, Type Extents, and
Queries
Defining Types with Inheritance
Instance:
THEATERtno integerName textaddress textphone integer
THEATER-CAFÉMenu texttno integerName textaddress textphone integer
CREATE TYPE theatercafe UNDER theater (menu text)
supertype subtype
Defining Types with Inheritance
Note: the inheritance mechanism creates rlationship
between the subtype and supertype.(an object of the subtype is also considered to be an object of the supertype.)
The substitution priciple: given a supertype A and a subtype B, it always possible to substitute an object of type B into a legal expression written for objects of type A, without producing type errors.
Inheritance can also be used for atomic types, in addition to row types.
Binding of Methods
Instance:
INMAGE JPEG-IMAGE
CREATE FUNCTION display(jpeg_image) RETURNS jpeg_imageAS EXTERNAL NAME ‘/a/b/cjpeg.class’ LANGUAGE ‘java’;
supertype subtype
The display() method for IMAGE does not work for JPEG images!!!
Collection Hierarchies, type Extents, and Queries
• Create table student_emp under emp (gpa float)• Queries on emp also return tuples from student_emp
(unless you say “emp only”
Collection hierarchies: inheritance on tables
Type extents: al objects of a given type can be selected from a single view (e.g., select * from theater_t)