S1: Ch. 22: Object Oriented Databases
- Learning Goals:
- Learn about object data model
- Learn about o.o. query languages, transactions
- Topics:
- Motivation
- Conceptual Data Model - object model, UML class diagram
- Logical Data Model - SQL3
- Physical Data Model - indexing
- Chapter Outline:
- 22.1 SQL and Object-Relational Features
- 22.2 History
- 22.3 Informix Universal Server
- 22.4 OR features of Oracle
- 22.5 Implementation Isues
- 22.6 Nested Relational Model
- Source: Ch#22, Bertino93, Kim 1989, Zdonik, ...
- X3/SPARC/DBSSG/OODBTG final report, 1991.
- OOMG-93: Unified API for all OODBMS products.
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S2: Motivation
- Well-known limitations of Relational DBMS
- Too simple for CAD/CAM, GIS, CASE...
- Support limited set of data types, no user-defined types
- Does not include generalization and aggregation
- Segmentation and Performance penalty
- Impedance mismatch b/w DB language and application languages
- No support for design transactions, versions, , schema evolution,...
- Approaches to Next Generation Databases
- Extended Relational DBs (object-relational)
- ...User defined types, stored procedures/ rules, Xtive closure, generalization
- ...SQL3, Postgres, Oracle , IBM DB2/UDB
- Object Oriented DBs
- ...New data model, OO query languages (e.g. C++)
- ...Itasca, ObjectStore, Versant, Ontos, O2, Gemstone (Smalltalk), ...
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S3: Conceptual Data Model
- Conceptual Data Model
- object model
- UML class diagram
- Basic Object Model - A Review
- 1. Objects and object identifiers
- Object has state (attributes) and behaviour (methods)
- OID, independent of attribute-values, location, structure
- 2. Complex values and types
- Attributes can be primitive (integer), or non-primitive (list)
- Constructors (e.g. set, tuple, list, ...)
- 3. Encapsulation - interferes with querying, may not be enforced
- 4. Classes
- Template for a set of objects with same attributes and methods
- Persistent vs. non-persistent classes
- Meta-classes, An object can change its class
- 5. Inheritance: subclass inherits attributes, methods of its superclass
- Inheritance allows a class called subclass to be defined on the basis
- define additional attributes/methods or redefine inherited ones.
- 6. Overloading, overriding, late binding a method name
- Common name for different operations inside a class or a set of classes.
- Late binding: resolve ambiguity at run-time
- Q? Compare object data model with ER model.
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S4: Conceptual Data Model - UML
- Chapter 12.3-5 pp. 385-405
- Unified Modelling Language
- A family of diagram (section 12.3.3, pp. 387)
- Class Diagrams
- ...Example: University Database Fig. 12.15 (pp. 400)
- Other: package, object, component, deployment, use cases
- Exercise: Compare EER model and class diagrams
- Q? Compare and contrast two model.
- Q? Does EER have any extra information than UML CD?
- Q? Does UML CD have any extra information than EER?
- Inheritance: Fig. 4.7 (EER) vs. Fig. 4.10 (UML), pp. 96, 105
- University DB: Fig. 4.9 (EER) vs. Fig. 12.15 (UML), pp. 102, 400
- Company DB: Fig. 3.15 (EER) vs. Fig. 12.17 (UML), pp. 74, 402
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S5: Object Model - Refinements for Data Modelling
- 1. Relationships
- Generalization/Specialization (subclass1 ISA class1, inheritance),
- Classification/instantiation (instance1 IS A class1)
- Aggregation (part-of, composition hierarchy, composite object),
- Association (e.g. union, grouping of similar objects, for check-out/in)
- Similar to relationship in E-R model, has a degree, cardinality
- (-ve) But, Relationships are not explicit unlike EER
- 2. Integrity Constraints:
- Assertions to be satisfied by objects in a database.
- Uniqueness constraint: Identical vs. Equality
- Referential integrity constraints, vs. object reference,
- Sibling sub-class relationships
- ...disjoint, overlapping, etc.
- 3. Composite Objects, part-of relationship
- Additional semantics for references to other objects
- Exclusive/Shared part (reference to sub-object)
- Dependent/Independent parts: Q? Delete part if whole is deleted?
- Weak (normal) vs. composite (part-of relationship)
- Q? Is object model in database same as that in programming languages?
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S6: Logical Data Model and Objects
- User defined data types
- Define new type
- SQL3 create type - Ex. pp. 703
- methods - Ex. pp. 706
- inheritance - Ex. pp. 708
- Use new type
- ...Table definition example - pp. 704 bottom
- ...Queries - pp. 704 bottom
- ...Note - path expressions
- Nested Relations - section 22.6
- Example - Fig. 22.1 (pp. 726)
- Q? Is Fig. 22.1(b) represented a table in 1NF ?
- Operation: nest, unnest (pp. 727)
- ...Examples using Figure 11.4 (pp.348)
- Recursion - section 22.1.3 (pp. 708)
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S7: Object Data Model Vs. Relational Model
- Attribute/Field values
- Multi-valued composite attributes allowed (Violate 1NF)
- Complex values via user defined types + constructors - list, set, tuple
- Value types: Extensible type system
- Object/Classes Vs. Entities/Instances
- Object-id (independent of value, location and structure) # Primary Key!
- Complex object: Has References (oids), not foreign keys
- Model behaviour as well via methods/stored procedures
- Encapsulation
- Associations: a link b/w entities in an application
- Q? How is an association different from a reference?
- (-ve) References need not be bi-directional, unlike Relational model
- Most OODBs do not represent associations explicitly.
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S8: Query Languages/ Query Optimization in OODB
- Query Language
- Seamless integration with programming languages
- ...Ex. C++/Lisp API, ODMG standard
- Path expressions: aStudent.department.manager.name
- User defined types/methods:
- ...Ex. distance(aStudent.address, aDepartment.location) < 5 miles.
- Transitive Closure: select* (Postgres)
- Query across a class hierarchy: select-any* (Postgres)
- Query Optimization Issues
- User defined methods are hard to optimize
- Class hierarchy based queries: need new strategies
- Multi-valued attribute: need new cost models
- Dual buffering (Separately process objects in the buffer/ on disk)
- ...separate access path for objects in buffer / on disk
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S9: 22.5 Physical data storage
- Data Manager (DM): Relational Vs.OO Storage
- Q?. How will you implement the following on a relational DM?
- complex values, methods, oid, Object reference,
- complex object, inheritance
- Relational DM (e.g. Postgres, Itasca)
- Convert complex values to atomic one (conversion procedures)
- Methods = procedure-valued fields (stored procedures)
- Oid = primary key; Object reference = foreign key
- Complex object: Decompose into multiple tuples
- ...Join relevant relations to compose an object
- Ex. a car = 4 tires + 4 doors + 1 engine + ...
- Inheritance = how many tables for a class hierarchy?
- Object DM
- One tuple per object
- Q? How to generate/mange object-ids, object references?
- Object Index : oid - > location of object (Usually Hashed)
- Index: Nested attribute/Path - > oid, Clustering
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)
S10: Transactions, Locking, Recovery
- Classical Transactions
- Lock granularity: intention lock on large complex object
- ...real locks on smaller parts
- Transactions share objects in memory buffers
- ...database gurantees consistency of objects in the object buffers
- ...Recovery needs to handle object buffers
- Design transaction
- Ex. A programmer fixes a bug: (change 3 modules, test, integrate)
- Long lived, many reads-write
- Concurrency Control
- ...check-in/check-out, versions (working, transient, released)
- Management of changes over time
- Object versions
- Schema evolution (e.g. Orion, Itasca)
- Other Issues
- Versions
- Schema evolution
- Rule Systems
Copyright: S. Shekhar, C. S. Dept.,
University of Minnesota, Minneapolis, MN 55455. ,,.(home)