OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.

Slides:



Advertisements
Similar presentations
Final and Abstract Classes
Advertisements

Jane Reid, BSc/IT DB, QMUL, 25/2/02 1 Object-oriented DBMS Background to ODBMS ODBMS requirements Object components ODB conceptual design –Graphical ODB.
Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Chapter Object-Oriented Practices. Agenda Object-Oriented Concepts Terminology Object-Oriented Modeling Tips Object-Oriented Data Models and DBMSs.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-Oriented Databases
Programs with SQL Host language + Embedded SQL Preprocessor Host Language + function calls Host language compiler Host language program Preprocessor Host.
Object Oriented Databases - Overview
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
1 Announcements Research Paper due Monday November 22.
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.
Object-Oriented Database Design using UML and ODMG
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
Object-Relational DBMSs By Yao-Wen Tu CS157b12/09/2003 Prof. Sin-Min Lee.
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.
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.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.
Object-Oriented Programming. An object is anything that can be represented by data in a computer’s memory and manipulated by a computer program.
Databases Illuminated
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
© 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
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
OODBMS and ORDBMS. Background Object-oriented software, based on the principles of user-defined datatypes, along with inheritance and polymorphism, is.
CSCE 240 – Intro to Software Engineering Lecture 3.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Modeling with UML – Class Diagrams
CSE202 Database Management Systems
Object-Oriented Databases and the ODMG Standard
Inheritance ITI1121 Nour El Kadri.
Lecture 12 Inheritance.
(Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997)
Database Design Oct. 3, 2001.
Database Design Why do we need it? Consider issues such as:
Final and Abstract Classes
Inheritance and Polymorphism
Object-Oriented Database Management System (ODBMS)
Object – Oriented Databases
Review: Two Programming Paradigms
Chapter 4 Relational Databases
Chapter 12 Outline Overview of Object Database Concepts
Introduction to Database Systems
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment.
Relational Databases The Relational Model.
Relational Databases The Relational Model.
Lec 3: Object-Oriented Data Modeling
Java Programming Language
ISC321 Database Systems I Chapter 10: Object and Object-Relational Databases: Concepts, Models, Languages, and Standards Spring 2015 Dr. Abdullah Almutairi.
Object-Oriented Knowledge Representation
Data Model.
Object Databases: Logical Data Modeling
ITEC 3220A Using and Designing Database Systems
Chapter 15: Object-Oriented Database Development
Final and Abstract Classes
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment Pearson Education © 2009.
CS 240 – Advanced Programming Concepts
Presentation transcript:

OBJECTS & DATABASES Arnaud Sahuguet – CIS-550

OO terminology is very loose. Don’t be surprised Contents Why objects Basics of OO class inheritance encapsulation object identity Object-Oriented Database what’s a schema ODL OQL Examples Final remarks OO terminology is very loose. Don’t be surprised Misc.. ORDBMS Arnaud Sahuguet – CIS-550

Why objects? Better modeling DB & programming languages objects seem to be a “friendly” paradigm “Jack” project at PENN (virtual reality) relational modeling 1 table for people’s heads 1 table for people’s arms etc. object-oriented modeling 1 object per person 1 object is composed of sub-objects DB & programming languages embedded query languages C++, Java prefer to speak directly to objects Arnaud Sahuguet – CIS-550

functional programming has no state What’s an object? Object = a human abstraction Object = a black box from the object point of view 1 state some associated methods from the outside point of view 1 hidden state 1 interface (some methods that can be called) functional programming has no state Example a Win’95 window Arnaud Sahuguet – CIS-550

How objects are defined An object is an instance of a CLASS constructor/destructor CLASS type definition (attributes) method signature & implementation abstract class when some implementation is missing an abstract class cannot be instantiated interface only signatures Abstract classes and interfaces are extremely useful. Arnaud Sahuguet – CIS-550

Class Person & Subclass Patient public class Person { String first_name; public String _get_first_name(){return first_name;} public void _set_first_name(String target){first_name = target;} String last_name; public String _get_last_name(){ return last_name;} public void _set_last_name(String target){last_name = target;} /* missing code */ }; public class Patient extends Person { Date dob; char sex; long mrn; String insurance_carrier = new String(); long insurance_number; Provider primary_care_provider; } Arnaud Sahuguet – CIS-550

Encapsulation The inside of the object can be hidden Visibility to make the object appear simple to prevent attempt to change the object’s state Visibility attribute and methods can be set to public full visibility from the outside private cannot be accessed from the outside “restricted” access granted through methods getXXX() setXXX() Arnaud Sahuguet – CIS-550

!!! Multiple Inheritance can create AMBIGUITY !!! Inheritance (I) Rationale better modeling “factoring” common features specialization code reuse Inheritance of attributes methods Single/Multiple inheritance !!! Multiple Inheritance can create AMBIGUITY !!! Arnaud Sahuguet – CIS-550

Inheritance (II) Class hierarchy Method overriding super-class(es) sub-class(es)  casting/coercion Method overriding methods can be inherited a class can rely on a method form its super-class a class can redefine inherited methods (overriding) e.g. toString() in Java, display for o2 Arnaud Sahuguet – CIS-550

Object identity Objects  type + method OID objects have a state objects have a unique object identifier (OID) objects have a life time from their construction to their destruction OID Person p1 = new Person(“Peter”, “Buneman”); Person p2 = new Person(“Peter”, “Buneman”); p1 and p2 are NOT the same Each time a constructor is called, a new OID is created. Because of the OID, there is no need for keys, or is there? Arnaud Sahuguet – CIS-550

What is a schema Entities Relations Constraints Documentation 1-1, 1-many, many-1, many-many, Constraints referential integrity (key, foreign keys) null unique cardinality other rules Documentation Arnaud Sahuguet – CIS-550

How to define a schema? using words using diagrams it’s always a good start using diagrams standard representation (see Derby) can be used with computer tools (CASE,etc.) e.g ER diagrams using Data Definition Languages (DDL) ODL for object-oriented schema schema description should be independent of any implementation easily mappable to any implementation easily mappable to any programming language (binding) Arnaud Sahuguet – CIS-550

ODMG (www.odmg.org) Object Model Object Definition Language (ODL) The ODMG Object Model provides the unifying basis for the entire ODMG standard. The ODMG Object Model extends the OMG Object Model with capabilities like relationships and transactions to support database functionality. Object Definition Language (ODL) ODL creates a layer of abstraction such that an ODL-generated schema is independent of both the programming language and the particular ODMG-compliant DBMS. ODL considers only object type definitions and ignores the actual implementation of methods. An ODL-generated schema can be freely moved between compliant DBMSs, different language implementations, or even translated into other DDLs, such as those proposed by SQL3. Object Query Language (OQL) OQL is an SQL-like declarative language that provides a rich environment for efficient querying of database objects, including high-level primitives for object sets and structures. Language bindings Arnaud Sahuguet – CIS-550

ODL The key concepts of the object model include: Attributes and relationships object properties Object operations (behavior) and exceptions Multiple inheritance Extents and keys Object naming, lifetime and identity Atomic, structured and collection literals List, set, bag and array collection classes Concurrency control and object locking Database operations Once again, there are different flavors of ODL Arnaud Sahuguet – CIS-550

Some ODL features class attribute struct relationship/inverse “collection” set, bag, list, array, dictionary enum keys exception extents they define object containers for each class used by queries Arnaud Sahuguet – CIS-550

OQL OQL syntax (previously presented) Use of extents Advantages of OQL various terminologies: names, containers Advantages of OQL OQL take advantage of object-oriented features methods path-expressions (“->”) de-referenciation queries are more elegant than in SQL Examples movie database http://www.unidata.com/derby/firstpage.html Arnaud Sahuguet – CIS-550

Final Remarks OO-DBMS are not studied in the book about ORDBMS they are not really OO, whatever you can read about it data is still stored into tables oo is something like a macro-layer http://www.cis.upenn.edu/~sahuguet/ORDBMS/contents.html Bibliography “A First Course in Database Systems”, by Ullman & Widow Prentice-Hall 1997 “The ODS standard: ODMG-2.0” Morgan Kaufmann 1997 Questions Arnaud Sahuguet – CIS-550