1 Object Oriented Databases Week 9. 2 Problems with Flat Relations Consider a relation Person(SSN, Name, PhoneN, Child) with: FD: SSN  Name Any person.

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

Limitations of the relational model 1. 2 Overview application areas for which the relational model is inadequate - reasons drawbacks of relational DBMSs.
OO databases 1 Object Oriented databases. OO databases 2 Developing OODBMS - motivation motivation more and more application areas require systems that.
Chapter 10: Designing Databases
Why Object-Oriented DBMS? Abstract data types Interface with host programming language (the impedance mismatch). Object identity: (peter, 40, {(john, 15,
Distributed DBMS©M. T. Özsu & P. Valduriez Ch.15/1 Outline Introduction Background Distributed Database Design Database Integration Semantic Data Control.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI 1 Object Databases.
Chapter 12 File Processing and Data Management Concepts
IS698: Database Management Min Song IS NJIT. The Relational Data Model.
The Entity-Relationship (ER) Model
--The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases,
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
OBJECTS Object Oriented ???????. OBJECTS Object-Oriented n OO convenient label for a collection of interconnected ideas n OO approach views computer.
Chapter 16 Introduction to Object Databases. Copyright © 2005 Pearson Addison-Wesley. All rights reserved What’s in This Module? Motivation Conceptual.
Data Management Design
Chapter 11 Data Management Layer Design
Programs with SQL Host language + Embedded SQL Preprocessor Host Language + function calls Host language compiler Host language program Preprocessor Host.
Introduction to Object DBMSs Transparencies © Pearson Education Limited 1995, 2005.
Other Data Models. Text New edition (DBS the complete book): Chapter 4 Old edition (First course in DBS): –Section 2.1 –Section –Section 2.4.1,
Object Oriented Databases - Overview
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
Databases Illuminated Chapter 7 The Object-Oriented Model.
RIZWAN REHMAN, CCS, DU. Advantages of ORDBMSs  The main advantages of extending the relational data model come from reuse and sharing.  Reuse comes.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Chapter 24 Introduction to Object DBMSs Prepared by Kai Huang CS157B Prof Sin-Min Lee.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Chapter 4 The Relational Model.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
Web-Enabled Decision Support Systems
Concepts and Terminology Introduction to Database.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI SEPTEMBER Object Databases.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
1 Chapter 1 Introduction. 2 Introduction n Definition A database management system (DBMS) is a general-purpose software system that facilitates the process.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
1 CS457 Object-Oriented Databases Chapters as reference.
Management Information Systems, 4 th Edition 1 Chapter 8 Data and Knowledge Management.
Object Oriented Database By Ashish Kaul References from Professor Lee’s presentations and the Web.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
The ODMG Standard for Object Databases
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
OODBMS and ORDBMS. Background Object-oriented software, based on the principles of user-defined datatypes, along with inheritance and polymorphism, is.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.
Object-Oriented Database Management System (ODBMS)
Chapter 12 Outline Overview of Object Database Concepts
Translation of ER-diagram into Relational Schema
Chapter 2 Database Environment.
The Entity-Relationship Model
Data Model.
Presentation transcript:

1 Object Oriented Databases Week 9

2 Problems with Flat Relations Consider a relation Person(SSN, Name, PhoneN, Child) with: FD: SSN  Name Any person (identified by SSN) can have several phone numbers and children Children and phones of a person are not related to each other except through that person

3 An Instance of Person SSNNamePhoneNChild Joe Public Joe Public Joe Public Joe Public Bob Public Bob Public Bob Public Bob Public

4 Dependencies in Person Join dependency (JD): Person = (SSN,Name,PhoneN) (SSN,Name,Child) Functional dependency (FD): SSN  Name

5 Redundancies in Person Due to the JD: Every PhoneN is listed with every Child SSN Hence Joe Public is twice associated with and with Similarly for Bob Public and other phones/children Due to the FD: Joe Public is associated with four times! Similarly for with Bob Public

6 Dealing with Redundancies What to do? Normalize! –Split Person according to the JD –Then each resulting relation using the FD –Obtain four relations (two are identical)

7 Normalization removes redundancy: SSNName Joe Public Bob Public SSNPhoneN SSNChild Person1 Phone ChildOf

8 But querying is still cumbersome: Against the original relation: Against the original relation: three cumbersome joins SELECT G.PhoneN FROM Person P, Person C, Person G WHERE P.Name = ‘Joe Public’ AND P.Child = C.SSN AND C.Child = G.SSN Get the phone numbers of Joe’s grandchildren. Against the decomposed relations is even worse: Against the decomposed relations is even worse: four joins SELECT N.Phone FROM ChildOf C, ChildOf G, Person1 P, Phone N WHERE P.Name = ‘Joe Public’ AND P.SSN = C.SSN AND C.Child = G.SSN AND G.SSN = N.SSN

9 Objects Allow Simpler Design Schema: Person(SSN: String, Name: String, PhoneN: {String}, Child: {SSN} ) : No need to decompose in order to eliminate redundancy: the set data type takes care of this. Set data types Object 1: ( , “Joe Public”, { , }, { , } ) Object 2: ( , “Bob Public”, { , }, { , } )

10 Objects Allow Simpler Queries Schema (slightly changed): Person(SSN: String, Name: String, PhoneN: {String}, Child: {Person}) - Because the type of Child is the set of Person-objects, it makes sense to continue querying the object attributes in a path expression Object-based query: SELECT P.Child.Child.PhoneN FROM Person P WHERE P.Name = ‘Joe Public’ - Much more natural! Set of persons Path expression

11 ISA (or Class) Hierarchy Person(SSN, Name) Student(SSN,Major) Query: Get the names of all computer science majors Relational formulation: SELECT P.Name FROM Person P, Student S WHERE P.SSN = S.SSN and S.Major = ‘CS’ Object-based formulation: SELECT S.Name FROM Student S WHERE S.Major = ‘CS’ inherit Student-objects are also Person-objects, so they inherit the attribute Name

12 Object Methods in Queries frameRange(from, to)Movie.Objects can have associated operations (methods), which can be used in queries. For instance, the method frameRange(from, to) might be a method in class Movie. Then the following query makes sense: SELECT M.frameRange(20000, 50000) FROM Movie M WHERE M.Name = ‘The Simpsons’

13 The “Impedance” Mismatch One cannot write a complete application in SQL, so SQL statements are embedded in a host language, like C or Java. SQL: Set-oriented, works with relations, uses high-level operations over them. Host language: Record-oriented, does not understand relations and high-level operations on them. SQL: Declarative. Host language: Procedural. “impedance” mismatchEmbedding SQL in a host language involves ugly adaptors (cursors/iterators) – a direct consequence of the above mismatch of properties between SQL and the host languages. It was dubbed “impedance” mismatch.

14 Can the Impedance Mismatch be Eliminated? This was the original idea behind object databases : Use an object-oriented language as a data manipulation language. Since data is stored in objects and the language manipulates objects, there will be no mismatch! Problems: Object-oriented languages are procedural – the advantages of a high-level query language, such s SQL, are lost C++, Java, Smalltalk, etc., all have significantly different object modeling capabilities. Which ones should the database use? Can a Java application access data objects created by a C++ application? Instead of one query language we end up with a bunch! (one for C++, one for Java, etc.)

15 Is Impedance Mismatch Really a Problem? The jury is out Two main approaches/standards: –ODMG (Object Database Management Group): Impedance mismatch is worse that the ozone hole! –SQL:1999: Couldn’t care less – SQL rules! We will discuss both approaches.

16 Problems of the Relational Model Relational Model and New Applications: –Designed for data-processing-style applications is not adequate for new applications. Relational Model Weaknesses –Set valued attributes not properly handled –IsA hierarchy not supported. –Binary Large Objects (BLOBs) are not adequately supported. –Does not support objects as attribute values. –Others

17 Relational Model Weakness Set valued attributes not properly handled –Leads to redundancy, update anomalies, violations of 4th normal form –Decomposition is the solution in the relational model –Example of better solution: Person ( Ssn: SSN, Name: STRING, PhoneN: {STRING}, ChildSSN: {SSN} )

18 IsA hierarchy not supported. –Would like to extend the schema Person with the schema Student ( Ssn: SSN, Major: STRING ) so that the query: SELECT P.Name FROM Person P, Student S WHERE P.Ssn = S.Ssn AND S.Major = ‘CS’ can be written : SELECT S.Name FROM Student S WHERE S.Major = ‘CS’ Relational Model Weakness

19 Binary Large Objects (BLOBs) are not adequately supported –A domain might contain values that are huge A video can occupy hundreds of megabytes –Attrributes of this type require special treatment. Do not bring entire row to memory to evaluate WHERE –The domain might require special access methods. frameRange (from, to) retrieves selected frames from a video Relational Model Weakness

20 Relational model does not support objects as attribute values. Advantages: –Objects as attribute values can support sets –Inheritance of object model can support IsA –Methods can be integrated into database access statements: SELECT M.frameRange (1000, 2000) FROM Movies M WHERE M.Name = ‘High Noon’ Relational Model Weakness

21 Relational Model Weakness Inflexible –Expects homogeneous data structures. vertical horizontal –Fixed set of operations provided by SQL Semantic Overloading –Relational model has only one construct for representing data and data relationships: the relation.

22 Relational Model and New Applications New technologies such as computer-aided design, computer-aided software engineering, multimedia and image databases, and document/hypertext databases. These new applications require the database system to handle features such as: – complex data types – data encapsulation and abstract data structures – novel methods for indexing and querying

23 Computer-Aided Design (CAD) Design is dynamic and changes as the system evolves. (difficult to design an all purpose schema) Designs are large and typically have complicated relationships (a large number of tables for entities and relations).

24 8 Office Information Systems (OIS) and Multimedia Systems Stores data relating to computer control of information in a business, including electronic mail, documents, invoices, and so on. Modern systems now handle free-form text, photographs, diagrams, audio and video sequences. Documents may have specific structure, perhaps described using mark-up language such as SGML or HTML.

25 9 Digital Publishing Becoming possible to store books, journals, papers, and articles electronically and deliver them over high- speed networks to consumers. As with OIS, digital publishing is being extended to handle multimedia documents consisting of text, audio, image, and video data and animation. Amount of information available to be put online is in the order of petabytes (10 15 bytes), making them largest databases DBMS has ever had to manage.

26 10 Geographic Information Systems (GIS) GIS database stores spatial and temporal information, such as that used in land management and underwater exploration. Much of data is derived from survey and satellite photographs, and tends to be very large. Searches may involve identifying features based, for example, on shape, color, or texture, using advanced pattern-recognition techniques.

27 Object Databases vs. Relational Databases Relational: set of relations; relation = set of tuples Object: set of classes; class = set of objects Relational: tuple components are primitive (int, string) Object: object components can be complex types (sets, tuples, other objects) Unique features of object databases: –Inheritance hierarchy –Object methods –In some systems (ODMG), the host language and the data manipulation language are the same

28 Summary: Object vs Relational Database Schema is a set of classes vs schema is a set of relations. Class is instantiated as a set of objects vs relation is instantiated as a set of tuples. Class attributes are complex types (sets, tuples, objects) vs tuple attributes are primitive types. Classes have methods that can be used within queries Classes organized into a hierarchy in which attributes and methods are inherited

29 The Conceptual Object Data Model (CODM) Plays the same role as the relational data model Provides a common view of the different approaches (ODMG, SQL:1999) Close to the ODMG model, but is not burdened with confusing low-level details

30 Object Data Model The database contains a collection of objects (similar to the concept of entities). An object has a unique ID (OID) and a collection of objects with similar properties is called a class. Properties of an object are specified using ODL and objects are manipulated using OML.

31 Object Id (Oid) Every object has a unique Id: different objects have different Ids Immutable: does not change as the object changes Different from primary key! –Like a key, identifies an object uniquely –But key values can change – oids cannot

32 OID types Logical OIDs are independent of the physical location of the object. Physical OIDs are the actual location of the object on disk. Logical OIDs add a level of indirection that when the logical OID is mapped to a physical location. Physical OIDs have portability issues.

33 Pointer Swizzling Pointer swizzling is the process of converting OIDs into memory pointers. Why? –Converting between OIDs and pointers allows the program to be more efficient. Data access occurs by dereferencing a pointer. –The number of OIDs can exceed the amount of virtual memory.

34 Pointer Swizzling Implementation Eager Swizzling – convert all OIDs when the objects when they are swapped into memory. –adds delay before the objects can be accessed. –Generates overhead when all of the objects aren’t accessed. Lazy Swizzling – convert the OIDs when they are used.

35 Objects and Values An object is a pair: (oid, value) Example: A Joe Public’s object (#32, [ SSN: , Name: “Joe Public”, PhoneN: {“ ”, “ ”}, Child: {#445, #73} ] )

36 Complex Values valueA value can be of one of the following forms: –Primitive: –Primitive value: an integer (eg, 7), a string (“John”), a float (eg, 23.45), a Boolean (eg, false) –Reference –Reference value: An oid of an object, e.g., #445 –Tuple –Tuple value: [A 1 : v 1, …, A n : v n ] –A 1, …, A n – distinct attribute names –v 1, …, v n – values –Set –Set value: {v 1, …, v n } –v 1, …, v n – values ComplexvalueComplex value: reference, tuple, or set. Example: previous slide

37 Classes ClassClass: set of semantically similar objects (eg, people, students, cars, motorcycles) A class has: –Type –Type: describes common structure of all objects in the class (semantically similar objects are also structurally similar) –Method signatures –Method signatures: declarations of the operations that can be applied to all objects in the class. –Extent –Extent: the set of all objects in the class Classes are organized in a class hierarchy –The extent of a class contains the extent of any of its subclasses

38 Complex Types: Intuition Data (relational or object) must be properly structured –Complex data (objects) – complex types Object: (#32, [ SSN: , Name: “Joe Public”, PhoneN: {“ ”, “ ”}, Child: {#445, #73} ] ) Its type: [SSN: String, Name: String, PhoneN: {String}, Child: {Person} ]

39 Complex Types: Definition A is one of the following:A type is one of the following: –Basic –Basic types: String, Float, Integer, etc. –Reference –Reference types: user defined class names, eg, Person, Automobile –Tuple –Tuple types: [A 1 : T 1, …, A n : T n ] –A 1, …, A n – distinct attribute names –T 1, …, T n – types Eg, [SSN: String, Child: {Person}] –Set –Set types: {T}, where T is a type Eg, {String}, {Person}Eg, {String}, {Person} Complex type: reference, tuple, setComplex type: reference, tuple, set

40 Summary on Object Properties Attributes: atomic or structured type (set,bag,list,array). Relationships: reference to an object or set of objects. Methods: functions that can be applied to objects of a class.

41 Encapsulation One key feature of object database systems is the possibility for the user to define arbitrary new data types. A new data type and its associated data type is called Abstract Data Type. How does the DBMS deal with these user defined data types? Encapsulation = data structure +operation. Hides ADTs DBMS does not need to know how the ADT’s data is stored nor how the ADT’s methods work. DBMS only needs to know the available methods and how to call them (input/output types of the methods).

42 Inheritance Type Hierarchy Definition of new types based on other existing types. A subtype inherits all properties of its supertype. Class Hierarchy A sub-class C1of a class C is a collection of objects such that each object in C1 is also an object in C. An object in C1 inherits all properties of C. Multiple Inheritance: inherits from more than one superclass. Selective Inheritance: inherits only some of the properties of a superclass.

43 Subtypes: Intuition subtypeA subtype has “more structure” than its supertype. Example: Student is a subtype of Person Person : [SSN: String, Name: String, Address: [StNumber: Integer, StName: String]] Student: [SSN: String, Name: String, Address: [StNumber: Integer, StName: String], Majors: {String}, Enrolled: {Course} ]

44 Subtypes: Definition subtypeT is a subtype of T’ iff T  T’ and –T, T’ are reference types and T is a subtype T’ –T= [A 1 : T 1, …, A n : T n, A n+1 : T n+1, …, A m : T m ] T’ = [A 1 : T 1 ’, …, A n : T n ’ ] are tuple types and for each i=1,…,n, either T i = T i ’ or T i is a subtype of T i ’ –T = {T 0 } and T’ = {T 0 ’ } are set types and T 0 is a subtype of T 0 ’

45 Domain of a Type domain(T) is the set of all objects that conform to type T. Namely: –domain(Integer) = set of all integers, domain(String) = set of all strings, etc. –domain(T), where T is reference type is the extent of T, ie, oids of all objects in class T –domain( [A 1 : T 1, …, A n : T n ] ) is the set of all tuple values of the form [A 1 : v 1, …, A n : v n ], where each v i  domain(T i ) –domain({T}) is the set of all finite sets of the form { w 1, …, w m }, where each w i  domain(T i )

46 Database Schema For each class includes: –Type –Method signatures (eg, Boolean enroll(Student,Course) ) The subclass relationship The integrity constraints (keys, foreign keys, etc.)

47 Database Instance Set of extents for each class in the schema; each object in the extent of a class must have the type of that class, ie, it must belong to the domain of the type Each object in the database must have unique oid The extents must satisfy the constraints of the database schema

48 The ODMG Standard ODMG 3.0 was released in 2000 Includes the data model (more or less) ODLODL: The object definition language OQLOQL: The object query language A transaction specification mechanism Language bindingsLanguage bindings: How to access an ODMG database from C++, Smalltalk, and Java (expect C# to be added to the mix)

49 The Structure of an ODMG Application

50 Main Idea: Host Language = Data Language Objects in the host language are mapped directly to database objects persistent.Some objects in the host program are persistent. Think of them as “proxies” of the actual database objects. Changing such objects (through an assignment to an instance variable or with a method application) directly and transparently affects the corresponding database object object faultAccessing an object using its oid causes an “object fault” similar to pagefaults in operating systems. This transparently brings the object into the memory and the program works with it as if it were a regular object defined, for example, in the host Java program

51 Architecture of an ODMG DBMS

52 SQL Databases vs. ODMG In SQL: Host program accesses the database by sending SQL queries to it (using JDBC, ODBC, Embedded SQL, etc.) In ODMG: Host program works with database objects directly ODMG has the facility to send OQL queries to the database, but this is viewed as an impedance mismatch evil doer, a misfeature

53 ODL: ODMG’s Object Definition Language Is rarely used, if at all! Relational databases: SQL is the only way to describe data to the DB ODMG databases: can do this directly in the host language Why bother to develop ODL then? Problem: Making database objects created by applications written in different languages (C++, Java, Smalltalk) interoperable Object modeling capabilities of C++, Java, Smalltalk are very different. How can a Java application access database objects created with C++? Hence: Need a reference data model, a common target to which to map the language bindings of the different host languages ODMG says: Applications in language A can access objects created by applications in language B if these objects map into a subset of ODL supported by language A

54 ODMG Data Model Classes + inheritance hierarchy + types ODMG classesODMG interfacesTwo kinds of classes: “ODMG classes” and “ODMG interfaces”, similarly to Java An ODMG interface: – has no attributes or method code – only signatures –does not have its own objects – only the objects that belong to the interface’s ODMG subclasses –cannot inherit from (be a subclass of) an ODMG class – only from another ODMG interface (in fact, from multiple such interfaces) An ODMG class: –can have attributes, methods with code, own objects –can inherit from (be a subclass of) other ODMG classes or interfaces »can have at most one immediate superclass (but multiple immediate super- interfaces)

55 ODMG Data Model (Cont.) literalsDistinguishes between objects and pure values (which are called literals) Both can have complex internal structure, but only objects have oids

56 Example interface PersonInterface: Object { // Object is the ODMG topmost interface String Name(); String SSN(); enum SexType {m,f} Sex(); } class PERSON: PersonInterface // inherits from ODMG interface ( extent PersonExt // note: extents have names keys SSN, (Name, PhoneN) ) : persistent; { attribute ADDRESS Address; attribute Set PhoneN; relationship PERSON Spouse; // note: relationship vs attribute relationship Set Child; void add_phone_number(in String phone); // method signature } struct ADDRESS { // a literal type (for pure values) String StNumber; String StName; }

57 More on the ODMG Data Model Can specify keys (also foreign keys – later) Class extents have their own names – this is what is used in queries –As if relations had their own names, distinct from the corresponding tables relationships attributesDistinguishes between relationships and attributes –Attribute values are literals –Relationship values are objects –ODMG relationships have nothing to do with relationships in the E-R model – do not confuse them!!

58 Example (contd.) class STUDENT extends PERSON { ( extent StudentExt ) attribute Set Major; relationship Set Enrolled; } STUDENT is a subclass of PERSON (both are classes, unlike the previous example) At most one immediate superclass name overloadingNo name overloading: a method with a given name and signature cannot be inherited from more than one place (a superclass or super-interface)

59 Referential Integrity class STUDENT extends PERSON { ( extent StudentExt ) attribute Set Major; relationship Set Enrolled; } class COURSE: Object { ( extent CourseExt ) attribute Integer CrsCode; attribute String Department; relationship Set Enrollment; } Referential integrity: If JoePublic takes CS532, and CS532  JoePublic.Enrolled, then deleting the object for CS532 will delete it from the set JoePublic.Enrolled Still, the following is possible: CS532  JoePublic.Enrolled but JoePublic  CS532.Enrollment Question: Can the DBMS automatically maintain consistency between JoePublic.Enrolled and CS532.Enrollment?

60 Referential Integrity (Contd.) Solution: class STUDENT extends PERSON { ( extent StudentExt ) attribute Set Major; relationship Set Enrolled; inverse COURSE::Enrollment; } class COURSE: Object { ( extent CourseExt ) attribute Integer CrsCode; attribute String Department; relationship Set Enrollment; inverse STUDENT::Enrolled; }

61 OQL: The ODMG Query Language Declarative SQL-like, but better Can be used in the interactive mode Very few vendors support that Can be used as embedded language in a host language This is how it is usually used Brings back the impedance mismatch