250 likes | 274 Views
Object Oriented Databases. Chapter 11-Object Oriented Databases Database Systems Design, Implementation and Management By Rob Coronel. Outline. History of OODBs Stages of OO Development Cycle Object Oriented Modeling Concepts Associations Comparison of OO and E-R Model Components
E N D
Object Oriented Databases Chapter 11-Object Oriented Databases Database Systems Design, Implementation and Management By Rob Coronel
Outline • History of OODBs • Stages of OO Development Cycle • Object Oriented Modeling Concepts • Associations • Comparison of OO and E-R Model Components • Abstract Data Types • Features of Object Oriented DBMS • OO Database Development • Features of Object Oriented DBMS • Object Oriented DBMS Products
History • How OO Databases came into existence? • In 1980s and 1990s, DB experts faced increasingly complex data requirements that were difficult to handle with existing DB technology • Complex data including graphics, video, audio, maps, diagrams, fingerprints, numbers and text invited reorganization of existing databases • OO databases came into existence - based on object oriented concepts and addition of new features to relational databases
Stages of OO Development Cycle • Analysis • Model the real-world application showing important properties • Specify functional behavior of the system - What the system must do and how it will be done • Understanding of requirements • Design • Model the system from implementation point of view • System design (caters for overall architecture) • System architecture • subsystenms • Object design (caters for implementation details) • Data structures • Algorithms • controls
Stages of OO Development Cycle • Development • Implement design using • Programming language and/or • DBMS UML notations are used for object-oriented analysis or design model
Object Oriented Modeling Concepts • Defined as a set of design and development principles based on objects • An object represents a real-world entity which can act on itself and interact with other objects • In OO systems, everything we deal with is an object, e.g., student, invoice, employee, etc. • Objects characteristics • It is Real-world entity • Has unique identity • Has embedded properties • Has ability to interact with other objects and act upon itself
Object Oriented Modeling Concepts • An object oriented model is built around objects just like an ER model is built around entities. • Object is different from entity as entity has data components and relationships but lacks the manipulative ability • For a real-world application model, both data and processes that act on data need to be defined and object-oriented approach can achieve this.
Object Oriented Modeling Concepts • Object • An entity that has a well defined role in an application domain – Object can be • A tangible or visible entity – person,place,etc • A concept or event – registration, performance,etc. • An artifact of design process – UI, controller, scheduler, etc. • An object has a • State – properties (attributes and relationships) and values of those properties, i.e., values of attributes and links to other objects • behavior – how an object acts and reacts to other objects. Object’s behavior depends on its state and operation being performed • Identity – no two objects are same, each has its own identity
Object Oriented Modeling Concepts • Object instance • single object • Object Class • set of objects that share a common structure and behavior • Class diagram • represents static structure of object-oriented model • Object diagram • A diagram of instances that are compatible with a given class diagram • Operation • A function or service provided by all instances of a class
Object Oriented Modeling Concepts • Encapsulation • Hiding internal implementation details (attributes & methods) of an object from its external view • Constructor operation • Creates a new instance of a class, e.g., ‘create_stdnt’ operation • Query operation • Accesses that state of an object but does not change the state, e.g., ‘get_year’ operation will retrieves the year in which student is studying • Update operation • Alters state of an object, e.g., ‘promote_stdnt’ operation will change value of attribute ‘year’ • Scope operation • Applies to a class rather than an object, e.g. ‘avg_gpa’ operation of Student class will apply across the class (all students)
Object Oriented Modeling Concepts • Inheritance • Single inheritance (only one immediate parent) • Multiple inheritance (more than one immediate parent) • Inheritance promotes the concept of reusability • Aggregation • “Part-of” relationship among classes • Polymorphism • A method can have same name in different classes and have different implementation in each class. • Overloading • Same method name but different signatures (no. of arguments) in same class • Overriding • Same method name with same signatures in different classes. It happens in inheritance. Override a base class method in derived class
Associations • Named relationship between object classes • Degree of association can be • Unary • Binary • Ternary • N-ary • Multiplicity • how many objects participate in a given relationship. Equivalent to cardinality constraints • represented as lower-bound..upper-bound • Association class • an association that has its own attributes and operations, or that participates in relationships with other classes
Abstract data types (ADT) • A data type is a set of objects with similar characteristics, e.g., integer, string… • Abstract data types also describe a set of similar objects but are different from conventional data types in that: • ADT operations are user defined • ADT does not allow access to its internal data representation or method implementation (encapsulation) • Abstract data type definition resembles a class definition • Some OO systems differentiate between class and type, using type to refer to class data structure and methods and class to refer to collection of object instances. • type is a static concept and class is a runtime concept • When you define a new class, you define a new type
Abstract data types (ADT) • Together with inheritance, ADT’s provide support for complex objects • A complex object is formed by combining other objects in a set of complex relations • Example • Conventional employee data, e.g., name, phone, etc. • Bitmapped data to store employee’s picture • Voice data to store employee’s voice pattern
Abstract data types DEFINING THREE ABSTRACT DATA TYPES/ CLASSES OBJECT REPRESENTATION FOR INSTANCES OF THE CLASS PERSON WITH ADTs
OBJECT STATE FOR AN INSTANCE OF THE CLASS PERSON , USING ADTS
Reading Assignment Rob-Coronel Book (soft copy) – pg. 525 • 11.4.3 Interobject relationships: Attribute-Class Links • 1:M relationships • 1:1 relationships • M:N relationships
OO Database Development • ODMG (Object Database Management Group) • ODMG - formed in 1991 by OODB vendors to create standards • ODMG proposed the Object Model for defining and querying an OO DB • ODMG 3.0 standard specified ODL and OQL for defining and querying an OO DB respectively • ODMG has prescribed versions of ODL and OQL for C++, Small Talk and Java • ODL (Object Definition Language) • Just like we use SQL-DDL for SQL-compliant DBMS, ODL can be used to implement ODMG-complaint ODBMS • ODL is programming-language independent specification language for defining OODB schemas • OQL (Object Query Language) • Like SQL-DML component, OQL can be used to query and manipulate the ODBMS • Similar to SQL-92
ODL • Defining a class and its attributes Class Student{ attributestring name; attributeDate dateOfBirth; attribute Address address; … // relationship …// operations }; • Defining relationships and operations Class Student{ attributestring name; attributeDate dateOfBirth; attribute Address address; //relationship between Student and CourseOffering relationshipset <CourseOffering> takes inverse CourseOffering::taken_by; // operations short age() ; boolean register_for(string crse, short sec, string term); }; See slide notes
ODL • Defining User Structures struct Address{ string street_address; string city; }; • Adding the key word extent to class definition. Extent is set of all instances of a class within the database class Student{ ( extent students) //attributes //relationships //operations }; • Creating Object Instance Jack student ( name: “Jack Ben”, dateOfBirth: 2/12/80, address: {street_address “xyz xyz”, city “London”}
OQL • Simple query • Jack.dateOfBirth • Jack.address.city • Complex query: • Data retrieval with select-from-where structure Select c.crse_title, c.credit_hrs from courses c where c.crse_code=“MBA 664”
Features of Object Oriented DBMS • There are 13 Rules that depict the features of an OO DBMS • Rules that make it an OO System • System must support complex objects • Object identity must be supported • Objects must be encapsulated • System must support inheritance • System must avoid premature binding • System must be computationally complete • System must be extensible
Features of Object Oriented DBMS • Rules that make it a DBMS • System must be able to remember data locations • System must be able to manage very large databases • System must accept concurrent users • System must be able to recover from hardware and software failures • Data query must be simple
Object Oriented DBMS Products • Jasmine • By Computer Associates • AllegroSCL • By Franz • GemStone (has been used by Lucent Technologies) • By GemStone Systems • neoAccess • By neoLogic • ObjectStore • By Object design • Objectivity/DB (has been used by Motorola) • By Objectivity • POET Object Server • POET Software • Versant ODBMS (has been used by Chicago Stock Exchange) • By Versant • Etc.