objects object identity reference types

13
OBJECTS OBJECT IDENTITY REFERENCE TYPES

Upload: aline-baldwin

Post on 02-Jan-2016

37 views

Category:

Documents


5 download

DESCRIPTION

OBJECTS OBJECT IDENTITY REFERENCE TYPES. Object identifier - oid. FILE SYSTEM. Data object. Object identifier - oid. DBMS. ?. FILE SYSTEM. Data object. Differences between URL and Oid. Oid. URL. Notions of equality. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: OBJECTS OBJECT IDENTITY REFERENCE TYPES

OBJECTS OBJECT IDENTITY REFERENCE TYPES

Page 2: OBJECTS OBJECT IDENTITY REFERENCE TYPES

Object identifier - oid

FILE SYSTEM

Data object

Page 3: OBJECTS OBJECT IDENTITY REFERENCE TYPES

Object identifier - oid

FILE SYSTEM

Data object

DBMS

?

Page 4: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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

Page 5: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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.

Page 6: OBJECTS OBJECT IDENTITY REFERENCE TYPES

Notions of equality

Shallow equal: two objects that have the same reference type ( if they both refer to the same object).

Page 7: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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, budget

float);

create table countries (name text, boundarypolygon, population integer, language text)

Page 8: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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

Page 9: OBJECTS OBJECT IDENTITY REFERENCE TYPES

INHERITANCE

• Defining Types with Inheritance• Binding of Methods• Collection Hierarchies, Type Extents, and

Queries

Page 10: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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

Page 11: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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.

Page 12: OBJECTS OBJECT IDENTITY REFERENCE 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!!!

Page 13: OBJECTS OBJECT IDENTITY REFERENCE TYPES

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)