Databases Illuminated

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

Chapter 10: Designing Databases
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.
Object-Orientation in Query Languages By: Toan Nguyen Class: CS 157A.
SLIDE 1IS 257 – Spring 2004 Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 14 (Web): Object-Oriented Data Modeling
Chapter 15 (Web): Object-Oriented Database Development
Object-Oriented Databases
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
Chapter 2: Entity-Relationship Model (Continued)
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.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
Chapter 14: Object-Oriented Data Modeling
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
Chapter 14: Object-Oriented Data Modeling
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.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Entities and Attributes
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
Databases Illuminated Chapter 8 The Enhanced Entity-Relationship Model and the Object-Relational Model.
1 Announcements Research Paper due Friday November 19 For Wednesday read
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
Object Definition Language
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
By: Richard Fleischman & Sharon Young Advanced Data Models.
Object-Oriented Data Modeling
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Databases Illuminated Chapter 3 The Entity Relationship Model.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
The ODMG Standard for Object Databases
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
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 ODMG: ODL and OQL This lecture is a short version of: Lecture 11 (on ODL) & Lecture 12 (on OQL) M. Akhtar Ali School of Informatics.
1. 2 Standards group: ODMG = Object Data Management Group. ODL = Object Description Language, like CREATE TABLE part of SQL. OQL = Object Query Language,
Entity Relationship (E-R) Model
Data Modeling Using the Entity- Relationship (ER) Model
DATA REQIREMENT ANALYSIS
Object-Oriented Database Management System (ODBMS)
Chapter 7: Entity-Relationship Model
Appendix D: Network Model
Chapter 12 Outline Overview of Object Database Concepts
Lec 3: Object-Oriented Data Modeling
Module 8 – Database Design Using the E-R Model
ISC321 Database Systems I Chapter 10: Object and Object-Relational Databases: Concepts, Models, Languages, and Standards Spring 2015 Dr. Abdullah Almutairi.
Systems Analysis – ITEC 3155 Modeling System Requirements – Part 2
ITEC 3220A Using and Designing Database Systems
Chapter 15: Object-Oriented Database Development
Chapter 6b: Database Design Using the E-R Model
Presentation transcript:

Databases Illuminated Chapter 7 The Object-Oriented Model

Why OO? Traditional relational model does not represent complex data and relationships well Need support for advanced applications software engineering, telecommunications, computer-aided design and manufacturing, geographical information systems, molecular biology, engineering design, digital publishing OO paradigm widely used for programming languages Simula, Smalltalk, Java, C++, C#, Python, Ruby OO database provides persistent objects to correspond to temporary objects in programs Examples: ObjectStore, Versant, Objectivity, Caché

OO Data Concepts An object has a state and behavior State includes attributes and relationships Behavior includes methods Objects are encapsulated data and methods form a unit, and access to the data is restricted to object’s methods Object interface external description of the object’s state and the signatures of its methods Every object has a unique identifier, OID, not an attribute of the object A literal has a state but no identifier

Classes A class Set of objects in a class is called the extent objects having the same structure- same variables with the same datatypes, same methods, and same relationships Roughly equivalent to an entity type Includes data atributes, methods, and relationships Datatypes can be predefined atomic types (integer, real, char, boolean), more complex types, or user-defined types Set of objects in a class is called the extent like extension Class extent is roughly equivalent to an entity set Objects in the class (instances, object instances, objects) are similar to entity instances

Defining a Class Defined by listing components Data members (attributes, instance variables) Member methods (functions or procedures that belong to the class) Relationships that the class participates in Simplified Example: class Person { attribute string Id; attribute string name; attribute string address; attribute string phone; void setName(string newName); // method string getName( ); //method relationship Job hasjob; //relates to Job class }

Writing and Using Methods Method body written in OO language-Java, C++, etc. or in DBMS’s own language Ex: void setName(string IN newName) { self.name = newName; } User’s program may have a Person object Person firstPerson = new Person( ); Invoke method using Person object firstPerson.setName(‘Jack Spratt’ ); firstPerson becomes “calling object”,on which method is performed, referred to as self in method body

Overloading Methods Methods have signature-method name, parameter list, etc. Methods of same class may have same name, if they have different signatures Overloaded-the same method name may be used for different classes, but will have different code for them

Class Hierarchies Classes organized into class hierarchies Superclasses (base classes) and subclasses Each subclass has an isa relationship with its superclass Subclasses inherit the data members and methods of their superclasses, and may have additional data members and methods of their own Hierarchy diagram-See example on next slide Represent classes as rectangles Connect subclasses to isa triangle, and connect triangle to superclass

Class Hierarchies

UML Class Diagrams-1 Unified Modeling Language (UML) class diagrams – Rectangles for classes- 3 sections: stereotype (<<persistent>> for DB storage) with class name; attributes; methods Relationships – 2 types Association for relationships between distinct classes represented by directed line connecting rectangles, with optional name attributes of association in box connected to association line Rolenames can appear on line, but placement is opposite that in E-R Aggregation Connects parts to a whole, described by “is part of” Represented by line with diamond on side of aggregate Can be given a name, or interpreted as “has” Reflexive association or reflexive aggregation shown by line back to same class, with rolenames See example on next slide

UML Diagrams-2 Multiplicity indicators show cardinality & participation min..max, but place opposite to placement in E-R Use * for M; use 1 for 1..1 Generalization hierarchies Lines connect subclasses to superclass, with triangle at end, pointing to superclass Filled triangle for overlapping subclasses Open triangle (outline only) for disjoint subclasses Can write constraints in curly braces on line near triangle (Ex. {overlapping, optional} near Person class rectangle) Weak entity represented by rectangle with line to strong entity, with discriminator written in box below strong entity

ODMG Model Object Database Management Group 1991-2001 Group of vendors Developed standards for OO databases Standards for Object model itself Object definition language (ODL) Object query language (OQL) Language bindings for C++, Java, Smalltalk

ODL-Class Declarations See Figure 7.6 Class declarations Begin with word class, then classname Optional extent and key declarations in parentheses List of attributes, methods, and relationships, all enclosed in curly braces extent Set of object instances for that class that are stored in the database at a given time; the extension Like the name of the file where the objects in the class are stored

ODL-Attribute Types Attribute types – atomic or structured Atomic types - integer, float, character, string, boolean, and enumerated types Enumerated types - keyword enum, name of the type, curly braces with a list of literals for the type, and the name of the attribute with that type Ex: attribute enum FacultyRank{instructor, assistant, associate, professor} rank;

ODL-Structured Types Keyword Struct, the name of the type, curly braces with each attribute and its datatype, then the identifier of that type Ex: attribute Struct Addr(string street, string city, string state, string zip) address; If type used again for other classes, identify the class it was defined in, using the scoped name- class name, double colon, and the type name Ex. Person::Addr Other collections types - Set, List, Array, Bag, Dictionary

Relationships in ODL Connections between object instances Represented by references, stored and maintained by DBMS Ex 1: in Faculty class relationship Department belongsTo Inverse Department::hasFaculty; Defines relationship belongsTo connecting Faculty to Department A “one” relationship - only one Department reference per Faculty object inverse relationship hasFaculty in Department (bidirectional relationship) Not all relationships have inverses – unidirectional is OK Ex 2: in Student class relationship Set<ClassSection> takesClass Inverse ClassSection::hasStudent; Defines relationship takesClass connecting Student to ClassSection Each Student object has a set of references to ClassSection objects-a “many” relationship Cardinality of relationship shown by whether or not the word “Set” appears in the relationship specification

ODL Methods A function or procedure for members of the class Declarations specify the signature - the name of the method, the return type (if any), and the number and type of parameters, identified as IN, OUT, or IN/OUT Two methods for the same class may have the same name but if their signatures are different, they are different methods Actual code for the method is not part of the ODL, but written in a host language May be overloaded - same method name used for different classes, with different code for them Class member methods are applied to an instance of the class

Subclasses in ODL class subclass_name extends superclass_name Ex: class Student extends Person Subclass inherits all attributes, relationships, methods Can have additional properties of its own For multiple inheritance, add a colon and the name of the second superclass Second superclass must be an interface, a class definition without an associated extent Ex: If Student also inherited from a Customer interface class Student extends Person:Customer

Relationship Classes For binary M;M relationships without descriptive attributes, use relationship clause in classes, with Set specification in both directions Binary M:M relationships with descriptive attributes Cannot be represented by sets in both directions, since that leaves no place for descriptive attributes Set up a class for the relationship, place the descriptive attributes as attributes of the new class, and define two one-to-many relationships between the new class and the two original classes See Mark class in Figure 7.6 For ternary or higher-order relationships, create a class for the relationship itself New relationship class definition includes three or more relationships that connect the new class to the originally-related classes Also list any descriptive attributes

Keys optional in ODL System uses unique object identifier (OID), automatically given to each object instance, to tell instances apart Designer can identify any candidate keys as well Done at the beginning of the class declaration within the same parentheses as the extent declaration Key may be a single attribute or a composite, identified by parentheses around the component attribute names Can be relationship or method

OQL-Object Query Language-1 Syntax similar to SQL, but operates on objects, not tables Simple form for queries is SELECT expression list FROM list of variables WHERE condition; expression list can contain the names of attributes using dot notation, invoking automatic get method, as in SELECT s.stuId, s.credits FROM students s; Can use methods in the list –get the result of applying the method   SELECT p.name, p.findAge( ) FROM people p; Can use relationship in the list- retrieves the object or set of objects related to the calling object through the relationship SELECT s.stuId, s.takesClass.section FROM students s WHERE s.stuId = ‘S999’;

OQL-FROM line List of variables -similar to an alias in SQL List the name of an extent, such as students or people, and an identifier for the name of the variable, such as s or p Variable is actually an iterator variable that ranges over the extent Alternate forms for declaring an iterator variable FROM students s FROM s in students FROM students as s

OQL-WHERE line Must be boolean expression having constants and variables defined in the FROM clause Can use <, <=, >, >=, !=, AND, OR and NOT Does not eliminate duplicates; returns a bag To eliminate duplicates, add DISTINCT Can optionally add ORDER BY, GROUP BY

Developing an OO Database See process on next slide Natural extension of application development in an object-oriented programming environment Language bindings specified in ODMG standard for C++, Java, and Smalltalk Difference between program objects and database objects is persistence OODBMS provides facilities to make program objects persist, and provides access to database objects for manipulation within programs

Developing an OO Database

Defining the Schema Designer defines the schema using a data definition language such as ODL or an OO programming language such as C++ Class definitions can be standard C++ (or other language) that has been extended to provide persistence and to support relationships between objects, as well as inheritance Persistence is provided by making all objects that are to be persistent inherit from a class provided by the OODBMS just for that purpose

Developing an OO Database in InterSystems Caché™ variety of ways to define classes, create object instances, make objects persist, access data, and write application code Cache Studio write ODL-type code for classes with persistent objects, by adding Extends (%Persistent) after the class name Can write code for methods Can create simple web-based forms for data input Can use SQL to access data in System Management Portal Can use several OO languages Can also use command-line mode