What is Object Oriented Data Modeling?• Centers around objects and classes• Involves inheritance• Encapsulates both data and behavior• Benefits of Object-Oriented Modeling– Ability to tackle challenging problems– Improved communication between users, analysts, designer,and programmers– Increased consistency in analysis and design– Explicit representation of commonality among systemcomponents– System robustness– Reusability of analysis, design, and programming results2

Figure 14-1 –Phases of object-oriented systems development cycle3

OO vs. EER Data ModelingObject OrientedClassObjectAssociationInheritance of attributesInheritance of behaviorEEREntity typeEntity instanceRelationshipInheritance of attributesNo representation ofbehaviorObject-oriented modeling is frequently accomplished using theUnified Modeling Language (UML)4

Object• An entity that has a well-defined role in theapplication domain, as well as state,behavior, and identity– Tangible: person, place or thing– Concept or Event: department, performance,marriage, registration– Artifact of the Design Process: user interface,controller, schedulerObjects exhibit BEHAVIOR as well as attributes Different from entities5

State, Behavior, Identity• State: attribute types and values• Behavior: how an object acts and reacts– Behavior is expressed through operations thatcan be performed on it• Identity: every object has a unique identity,even if all of its attribute values are thesame6

Figure 14-2 –UML classand objectdiagrams(a) Classdiagramshowing twoclassesClass diagramClass diagram shows the static structure of an object-orientedmodel: object classes, internal structure, relationships.7

(b) Object diagram with two instancesObject diagramObject diagram shows instances that are compatible with agiven class diagram.8

Operations• A function or service that is provided by allinstances of a class• Types of operators:– Constructor: creates a new instance of a class– Query: accesses the state of an object but does not alterits state– Update: alters the state of an object– Scope: operation applying to the class instead of aninstanceOperations implement the object’s behavior9

Object Definition Language(ODL)• Corresponds to SQL’s DDL (DataDefinition Language)• Specify the logical schema for an objectorienteddatabase• Based on the specifications of ObjectDatabase Management Group (ODMG)10

Figure 15-1 –UML class diagram for a university databaseThe following slides illustrate theODL implementation of thisUML diagram11

Figure 15-2 –ODL Schema for university database12

Querying Objects in the OODB• Object Query Language (OQL)• ODMG standard language• Similar to SQL-92• Some differences:– Joins use class’s relationship name:• Select x.enrollment from courseofferings x, x.belongs_to ywhere y.crse_course = “MBA 664” and x.section = 1;– Using a set in a query• Select emp_id, name from employees where “DatabaseDesign” in skills;13

Current ODBMS Products• Rising popularity due to:– CAD/CAM applications– Geographic information systems– Multimedia– Web-based applications– Increasingly complex data types• Applications of ODBMS– Bill-of-material– Telecommunications navigation– Health care– Engineering design– Finance and trading14

Table15-1 – ODBMS Products15

The role of the ODBMS• Objects have a life that extends beyond theexecution of the OO program• Persistent objects live longer than themethods that create them• An ODBMS stores data when the OOapplication is not running16

Features of an ODBMS• An ODBMS should supports OO concepts– complex objects– abstract data types– encapsulation– inheritance• An ODBMS also should provides– data sharing– concurrent data access– recovery control17

The Object DatabaseStandard• The OMG (Object Management Group) iscreating and promulgating a standard forOO technology• The goal is to minimize incompatibilityacross platforms and standardize somefeatures• OMG has released an Object DatabaseStandard18

The future• RDBMS– Non-complex object stores– Incorporate OO concepts without compromising therelational model• ODBMS– Complex object stores– Incorporate relational concepts without losingadvantages of OO concepts• A hybrid object-relational model19

OO and relational paradigmsOO paradigmBased on software engineeringprinciples of coupling,cohesion, and encapsulationThe goal is to improve thequality of systems, and thereis concern for both data andprocessesTo access data you traverseobjects via relationshipsRelational paradigmFounded on the mathematicalconcepts of set theoryThe goal is to improve datamanagementTo access data you matchprimary and foreign keys20

Class Diagram to ER Diagram• To Convert...– Each class becomes an entity• Class attributes become entity attributes– Type information is maintained• Operation information is ignored– Each association becomes a relationship• Multiplicity information is maintained• IsA Relationship should become an IsA (super/sub)relationships– SA does not do this translation• Overcome be manually adding an entity equivalent tothe class and then created a relationship of typesuper/sub21

ER Diagram to Database• Use entity names for table namesTables• Select a primary key for each entity/table• Post all attributes of an entity as column names in the entity’s table• For 1:1 cardinality relationships– All attributes can be merged into a single table• For 1:N cardinality relationships– Post the identifier from the “one” side as an attribute to the “many”side• For N:M cardinality relationships– Create a new table and post the primary keys from each entity asattributes in the new table22

Mapping attributes• Each attribute is mapped to zero or morecolumns– Non-persistent (i.e., derived) attributes are notmapped– Some attributes need to be broken intocomponents23

Mapping Generalization• Vertical• Each class is mapped to a separate table• Recommended• Horizontal• Filtered• Each subclass is mapped to a different table• The superclass is not mapped to a table• All classes are mapped to the same table• The table contains columns for all attributes in both classeswith a column added to distinguish between the subclasses.24

Mapping Association andaggregation• Associations are mapped like theircorresponding data model parallels• e.g., a m:m association is mapped by creating anassociative entity• Physically, an aggregation might beimplemented using clustering or a linkedlist because the whole and parts are oftenretrieved together25

More magazines by this user
Similar magazines