1 / 44

Database Design: Object-Oriented Modeling

Database Design: Object-Oriented Modeling. University of California, Berkeley School of Information Management and Systems SIMS 202: Information Organization and Retrieval. Review. New Personal Database assignment Database Design Process Basics of ER Diagrams. Database Design Process.

Download Presentation

Database Design: Object-Oriented Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Design: Object-Oriented Modeling University of California, Berkeley School of Information Management and Systems SIMS 202: Information Organization and Retrieval Information Organization and Retrieval

  2. Review • New Personal Database assignment • Database Design Process • Basics of ER Diagrams Information Organization and Retrieval

  3. Database Design Process Application 1 Application 2 Application 3 Application 4 External Model External Model External Model External Model Application 1 Conceptual requirements Application 2 Conceptual requirements Conceptual Model Logical Model Internal Model Application 3 Conceptual requirements Application 4 Conceptual requirements Information Organization and Retrieval

  4. Entity • An Entity is an object in the real world (or even imaginary worlds) about which we want or need to maintain information • Persons (e.g.: customers in a business, employees, authors) • Things (e.g.: purchase orders, meetings, parts, companies) Employee Information Organization and Retrieval

  5. Birthdate First Age Employee Middle Name SSN Last Projects Attributes • Attributes are the significant properties or characteristics of an entity that help identify it and provide the information needed to interact with it or use it. (This is the Metadata for the entities.) Information Organization and Retrieval

  6. Project Attends Student Class Supplies project parts Supplier Part Relationships Information Organization and Retrieval

  7. 1/1/1 1/n/n n/n/1 SSN Manager Date Project 4(2-10) 1 Assigned Employee Project Manages Employee Evaluation Employee Project More Complex Relationships Manages 1 Is Managed By n Information Organization and Retrieval

  8. Customer No DiveCust 1 Destination Name ShipVia Customer No Destination no n ShipVia ShipVia 1 n DiveOrds n Dest 1 1 Destination Order No Order No n DiveItem Item No n 1 DiveStok Item No Ordering: Full ER Information Organization and Retrieval

  9. Site No Destination no Sites 1 n Site No BioSite Species No n 1 BioLife Species No Sites and Sea Life 2 Information Organization and Retrieval

  10. Site No Destination no Sites 1 1/n ShipWrck Site No Sites and Shipwrecks Information Organization and Retrieval

  11. DiveCust ShipVia DiveOrds Dest Sites DiveItem BioSite ShipWrck DiveStok BioLife DiveShop ER Diagram Customer No 1 Destination Name ShipVia Customer No Destination no n ShipVia 1 n n 1 1 Destination no 1 Destination Order No Site No n Order No n 1 1 Site No n 1/n Item No n Species No n Site No 1 1 Item No Species No Information Organization and Retrieval

  12. Today • Object Oriented Modeling and UML • Semantic Object Model • Introduced in earlier editions of Kroenke • An alternative approach to modeling the sorts of entities and relationships of a database Information Organization and Retrieval

  13. Object-Oriented Modeling • Becoming increasingly important as • Object-Oriented and Object-Relational DBMS continue to proliferate • Databases become more complex and have more complex relationships than are easily captured in ER or EER diagrams Information Organization and Retrieval

  14. Object Benefits • Encapsulate both data and behavior • Object-oriented modeling methods can be used for both database design and process design • Real-World applications have more than just the data in the database they also involve the processes, calculations, etc performed on that data to get real tasks done • OOM can be used for more challenging and complex problems Information Organization and Retrieval

  15. Unified Modeling Language (UML) • Combined three competing methods • Can be used for graphically depicting Information Organization and Retrieval

  16. CLASS • A class is a named description of a set of objects that share the same attributes, operations, relationships, and semantics. • An object is an instance of a class that encapsulates state and behavior. • These objects can represent real-world things or conceptual things. • An attribute is a named property of a class that describes a range of values that instances of that class might hold. • An operation is a named specification of a service that can be requested from any of a class's objects to affect behavior in some way or to return a value without affecting behavior Information Organization and Retrieval

  17. UML Relationships • A relationship is a connection between or among model elements. • The UML defines four basic kinds of relationships: • Association • Dependency • Generalization • Realization Information Organization and Retrieval

  18. UML Diagrams • The UML defines nine types of diagrams: • activity diagram • class diagram • Describes the data and some behavioral (operations) of a system • collaboration diagram • component diagram • deployment diagram • object diagram • sequence diagram • statechart diagram • use case diagram Information Organization and Retrieval

  19. Class Diagrams • A class diagram is a diagram that shows a set of classes, interfaces, and/or collaborations and the relationships among these elements. Information Organization and Retrieval

  20. DIVEORDS Order No Customer No Sale Date Shipvia PaymentMethod CCNumber No of People Depart Date Return Date Destination Vacation Cost CalcTotalInvoice() CalcEquipment() UML Class Diagram Class Name List of Attributes List of operations Information Organization and Retrieval

  21. 307:DIVORDS Order No = 307 Customer No = 1480 Sale Date = 9/1/99 Ship Via = UPS PaymentMethod = Visa CCNumber = 12345 678 90 CCExpDate = 1/1/01 No of People = 2 Depart Date = 11/8/00 Return Date = 11/15/00 Destination = Fiji Vacation Cost = 10000 Object Diagrams Information Organization and Retrieval

  22. Differences from Entities in ER • Entities can be represented by Class diagrams • But Classes of objects also have additional operations associated with them Information Organization and Retrieval

  23. Operations • Three basic types for database • Constructor • Query • Update Information Organization and Retrieval

  24. Associations • An association is a relationship that describes a set of links between or among objects. • An association can have a name that describes the nature of this relationship. You can put a triangle next to this name to indicate the direction in which the name should be read. • An association contains an ordered list of association ends. • An association with exactly two association ends is called a binary association • An association with more than two ends is called an n-ary association. Information Organization and Retrieval

  25. 0..1 * Person Employee Is-married-to manages 0..1 0..1 Associations: Unary relationships manager Information Organization and Retrieval

  26. Employee Student Product Line Product Parking Place Course 0..1 * 1 contains Registers-for Is-assigned * * 0..1 One-to-one Many-to-many One-to-many Associations: Binary Relationship Information Organization and Retrieval

  27. Associations: Ternary Relationships Part * Vendor Supplies Warehouse * * Information Organization and Retrieval

  28. Association Classes Student Course Registers-for * * Registration ________________ Term Grade ________________ CheckEligibility() Computer Account _________________ acctID Password ServerSpace issues * 0..1 Information Organization and Retrieval

  29. Derived Attributes, Associations, and Roles Student _________ name ssn dateOfBirth /age Course Offering ____________ term section time location Course ____________ crseCode crseTitle creditHrs Scheduled-for Registers-for * * * 1 Derived attribute * * Derived role /participant {age = currentDate – dateOfBirth} /Takes Derived association Information Organization and Retrieval

  30. Generalization Employee ____________ empName empNumber address dateHired ____________ printLabel() Consultant _______________ contractNumber billingRate _______________ computeFees() Salaried Employee _______________ Annual Sal stockoption _______________ Contributepension() Hourly Employee _______________ HourlyRate _______________ computeWages() Information Organization and Retrieval

  31. Semantic Objects • Very similar to UML representation • Similar to an Entity • Represents something in the organization’s work environment that we want to keep information about. • Formally “A named collection of attributes that sufficiently describes a distinct identity” (Kroenke, p. 74) Information Organization and Retrieval

  32. Semantic Objects • Semantics objects are grouped into classes • Object class names are spelled in capitals (e.g. STUDENT, DEPARTMENT, DIVECUST, etc.) • SO’s have collections of attributes • SO’s represent distincts identities • Difference between “Objects” and “Object Instances” • Need not be physical entities (e.g. P.O.’s) Information Organization and Retrieval

  33. SOM Attributes • Three types: • Simple attributes • have a single value • Group attributes • composites of other attributes (e.g. Address is a composite of Street, City, State, Zip) • Semantic Object Attributes • establish a relationship between one semantic object and another. Information Organization and Retrieval

  34. DEPARTMENT idDepartmentName CampusAddress Building OfficeNumber PhoneNumber FaxPhoneNumber COLLEGE PROFESSOR STUDENT SOM Example 1.1 1.1 1.1 0.1 1.N 0.1 1.1 1.N 1.N Information Organization and Retrieval

  35. Object Instance School of Information Management and Systems South Hall 202 642-1464 642-9980 642-1465 642-5814 School of Information Management and Systems Larson Hearst Varian Etc... Smith Etc... Information Organization and Retrieval

  36. Developing a Semantic Object Model • We will look at a small business -- a diveshop that offers diving adventure vacations • Assume that we have done interviews with the business and found out the following information about the forms used and types of information kept in files and used for business operations... Information Organization and Retrieval

  37. Primary Business Operations • The shop takes orders from customers for dive vacations. • It ships information about the dive vacation to the customers. • It rents diving equipment for the divers going on the trips (these may include additional people other than the customer) • It bills the customer for the vacation and for equipment rental or sales. Information Organization and Retrieval

  38. Business Operations (cont.) • It arranges sub-trips to particular dive sites at the primary location. • It provides information about the features of various sites to help customers choose their destinations. • Features include sea life found at the location and shipwrecks Information Organization and Retrieval

  39. Business Operations (cont.) • Each dive order (or sale or trip) is on an invoice to one customer. • Invoices contain: • Line items for each type of equipment ordered, • Total amount due for the invoice, • Customer information: • Name, address, phone, credit card info. • Information must be kept on inventory of dive equipment. • There are multiple types of dive equipment: • The prices charged for sale or rental are maintained. Information Organization and Retrieval

  40. Business Operations (cont.) • Destination information includes: • Name of the destination • information about the location (accomodations, night life, travel cost, average temperatures for different times of the year • Destinations have associate dive sites. • Dive Sites have associated features • Sea life • Shipwrecks Information Organization and Retrieval

  41. Business Operations (cont.) • One record is kept for each order by a customer and will include the method of payment, total price, and location information. (I.e. Customers may have multiple orders) • The company needs to know how an order is to be shipped. • The shop has to keep track of what equipment is on-hand and when replacements or additional equipment is needed Information Organization and Retrieval

  42. Application of SOM to Diveshop DIVECUST Name 1.1 Address Street City StateProvince ZIPPostalCode Country Phone FirstContact 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 DIVEORDS 1.N Information Organization and Retrieval

  43. DIVEORDS DIVEORDS id OrderNo SaleDate DIVECUST SHIPVIA DESTINATION DIVEITEM PaymentMethod CCNumber CCExpDate NoOfPeople DepartDate ReturnDate VacationCost Information Organization and Retrieval

  44. Assignment 1 • What are the answers? • Access examples Information Organization and Retrieval

More Related