Raju Ordbms
Raju Ordbms
Objectives Introduction
Need for OO/OR-DBMS How (OO)DBMS incorporates OO ideas OODBMS ORDBMS EER/PEER
OO Fundamentals
Database Modeling/Querying
Conceptual ODL/UML
Conclusions
Mapping Conceptual Model into Logical Model OQL vs. SQL-99 Comparison of OODBMS and ORDBMS Conclusions
Learning Objectives
Basic concepts of OO and OR models Extensions at conceptual modeling Mapping Conceptual Model into Logical Model Exposure to additional features in SQL:1999 standard. Ability to model and implement a broader class of applications (spatial, multimedia, engineering, biological, scientific, )
Introduction
Why OODBMS? Let us start with modeling this simple example in a RDBMS
Our objective is to store this graph in a RDBMS and support queries on these simple geometries
What kind of relations we need? Print names of rectangles which are squares Find all objects which are inside1the rectangle 7. 6 5 4 0, 0 8 2 7 3
Relations
RECTANGL E r5 e1
e1 e1 e2 e2 e3 e3 e4 e4
p1 p2 p2 p3 p3 p4 p4 p1
p1 3 p2 3
4 10
r5 r5 r5
e2 e3 e4
p3 10 10 p4 10 4
1 6 5 4 0, 0 8 2 7 3
Logical Flow
rname Edge_length (eName, eLength)
Rectangle r Edge_Pnt_List (eName, stPnt, endPnt) Point p1 Point p2 Edge e1 E1.ename = e2.ename E1.aPoint <> e2.aPoint Edge e2
Introduction
Though we can model and query these simple geometric objects, its
Not clean Complexity increases with complex objects (like irregular polygons) Even with these simple objects, how do you answer queries like find nearest objects to point 2 or find all intersecting objects Support for complex data types Support for predicates (e.g., area, intersect, length)
What is lacking
OODBMS-Fundamentals
State current value Behavior - what operations are permitted PL Objects exist only during program execution (transient objects). DB Objects persist beyond program termination; stored permanently on a secondary storage DB allows sharing of objects among multiple programs and applications
OODBMS-Fundamentals
Compare this with RDBMS primary key Arbitrarily complex in order to contain all necessary information about the object Compare this with RDBMS
Object structure
The state of complex object may be constructed from other objects using type constructors
OODBMS-Fundamentals
Type constructors
Basic atom, tuple, and set Others list, bag, and array (collection/bulk types) tuple also called as a structured type
OODBMS-Fundamentals
Examples
o1 = (i1, atom, Pen-Chung Yew) o2 = (i2, atom, Minneapolis) o3 = (i3, atom, Computer Science) o4 = (i4, set, {i1,i2,i3}) o5 = (i4, tuple, <DNAME:i3, DCHAIR:i1>)
OODBMS-Fundamentals
OODB permits definition of new types based on other predefined types, leading to a type hierarchy TYPE_NAME: function, function, , function PERSON: firstName, lastName, dob, SSN STUDENT: firstName, lastName, dob, SSN, status, GPA FACULTY: firstName, lastName, dob, SSN, rank, salary STUDENT subtype_of PERSON: major, GPA FACULTY subtype_of PERSON: rank, salary
Example
OODBMS-Fundamentals
Exercise: Consider the geometry objects defined in our first example and defined class hierarchies
1 6 5 4 0, 0 8 2 7 3
OODBMS-Fundamentals
example
GEOMETRY_OBJECT: Shape, Area, ReferencePoint RECTANGLE subtype-of GEOMETRY_OBJECT (Shape=rectangle): edge1, edge2, edge3, edge4
OODBMS-Fundamentals
Standards:
Object Model Object Definition Language (ODL) Object Query Language (OQL) Binding to OO programming languages (C++, Smalltalk, Java)
OOBMS
O2 ObjectStore Jasmine
Database Modeling
Enhance Entity Relationship (EER Chap 4, Elmasri/Navathe) Pictogram Enhanced Entity Relationship (PEER Chapter 2, SD A Tour). Unified Modeling Language (UML) Object Definition Language
Database Modeling
Example
We use two examples (school-DB) and park-DB (from SDB-A Tour). Identify typical objects (and hierarchies) in schoolDB
Identify relationships
Includes all the modeling concepts of ER Additionally includes oo concepts of subclass, superclass, specialization and generalization, attribute and relationship inheritance
Person d
rank
major
1
worksin
1
code
Department
name
{disjoint, mandatory}
Student status
Faculty 0..1 Departmen chai rank t r chairOf majorsIn 1 Code worksIn * dept major Name 1
Exactly one Many (0 or More) Optional (0 or One) One or More Numerically Specified Aggregation Inheritance Derived Class
OGC-Geometry
M Fire_Station Name
manages
Geometry
Image
Entity pictograms Relationship pictograms Ease of use Complete grammar Translation rules Pictogram inserted ER diagram to SQL3 level constructs
Advantages
Pictograms
<Pictogram> <Shape> * // any possible shape ! // user-defined shapes <Shape> <Basic Shape> <Multi-Shape> <Derived Shape> <Alternate Shape>
Point
Line
Polygon
0, n
<Derived Shape>
<Basic Shape>
*
Raster TIN Thesian
Part_of (Network)
Part_of (Partition)
Name
manages
Fire_Station Name
Learning Objectives
Understand OO Concepts Conceptual Modeling No support for complex data types and predicates Rich set of features encapsulation, inheritance, .. Helps manage complexity
RDBMS limitations
OO
Next Week
ORDMBS (SQL-3) in depth Mapping of Conceptual Model onto ORDBMS (SQL-3 DDL constructs) Examples using Postgresql/PostGIS Comparison of OODBMS and ORDBMS Conclusions
Additional Readings
http://www.cs.umn.edu/~vatsavai/oo-ordbms.ppt Main Database Management Systems by Raghu Ramakrishnan (Chapter 24: Object Database Systems). Additional References (relevant chapters):
Fundamentals of Database Systems Elmasri & Navathe A First Course In Database Systems Ullman & Widom.
http://www-users.cs.umn.edu/~shekhar/5705/