1 ODB Design Handling Associations in ODL M. Akhtar Ali School of Informatics.

Slides:



Advertisements
Similar presentations
Advanced Database: Seminar # 12: Object-Oriented Databases1 Object Oriented Databases Seminar 12 Exploring ODMG - OQL Using Lambda-DB.
Advertisements

Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Accounting System Design
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
1 CS 426 Senior Projects Chapter 9: Relationships Chapter 10: Inheritance and Polymorphism [Arlow and Neustadt, 2005] February 12, 2009.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
1 CS 426 Senior Projects Chapter 9: Relationships Chapter 10: Inheritance and Polymorphism [Arlow and Neustadt, 2002] February 27, 2007.
MORE ON CLASS MODELS Lecture Outline Aggregation and composition Roles Navigability Qualified association Derived association Constraints Association.
1 Data Modelling Which data to include in the database.
Databases Illuminated Chapter 7 The Object-Oriented Model.
Transforming Data Models into Database Designs
1 ODB Design: Handling Associations and Inheritance in ODL M. Akhtar Ali School of Informatics.
Microsoft ® Office Access ® 2007 Training Build a database III: Build relationships for a new Access database ICT Staff Development presents:
CS 405G Introduction to Database Systems
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
ระบบฐานข้อมูลขั้นสูง (Advanced Database Systems) Lecturer AJ. Suwan Janin Phone:
Object Query Language (OQL) and Language Binding
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Seminar #: 9 (Object Oriented Database Schema in ODL) Advanced Databases (CM036) 1 Seminar 9 : OODB Schema in ODL Purpose To understand how an OODB is.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Microsoft Access Intro Class 6 Relationships.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
1 Advanced Databases (CM036) – Lecture # 12: The ODMG Standard for Object Databases Object Query Language (OQL) & Language Binding Advanced Database Technologies.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
© Copyright 1999, Objectivity, Inc., All Rights Reserved Objectivity/DB for C++ Developers - 1 Associations Library Container Members Container Database.
Object Oriented Software Development
Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.
Build a database III: Build relationships for a new Access database Overview: You can relate This course teaches you how to build relationships between.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Seminar 10: OODB Design (Self-Study)
Database Design – Lecture 12 Object Oriented Database Design cont’d.
1 Class Relationships in C++ CS 123/CS Class Diagram Notation Revisited zMultiplicity zAssociation and Navigability zComposition zAggregation.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Seminar 10 : OODB Design Purpose To understand how an OODB is structured.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
The ODMG Standard for Object Databases
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036) 1 Seminar 10a : OODB Design Purpose This seminar is the continuation of seminar.
Java Persistence API (JPA) Relationships. Kinds of relationships UML associations and aggregations (ER non- identifying relationships, shared semantics)
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Advanced Database: Seminar # 12: Object-Oriented Databases1 Object Oriented Databases Seminar 12 Exploring ODMG standard Using Lambda-DB.
Database Relationships Objective 5.01 Understand database tables used in business.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
1 Information System Analysis Topic-3. 2 Entity Relationship Diagram \ Definition An entity-relationship (ER) diagram is a specialized graphic that illustrates.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
1 ODB Design Handling Inheritance in ODL M. Akhtar Ali School of Informatics.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
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.
Chapter 9: Relationships Chapter 10: Inheritance and Polymorphism [Arlow and Neustadt, 2005] CS 426 Senior Projects in Computer Science University of Nevada,
1 Entity Relationship Approach u Top-down approach to data modeling u Uses diagrams u Normalization - confirms technical soundness u Entity Relationship.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Object-Oriented Databases (chapter 2/3) Object Persistence - Introduction Persistent Programming Languages Specifying Object Persistence via Naming and.
Class Relationships in C++
Seminar 10 : OODB Design (Self-Study)
Seminar 6 : OODB Schema in ODL
Seminar 9: OODB Design (Self Study)
Chapter 18: Refining Analysis Relationships
ODB Design: Handling Associations and Inheritance in ODL
Presentation transcript:

1 ODB Design Handling Associations in ODL M. Akhtar Ali School of Informatics

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 2 Lecture outline Different ways of representing links between objects Single/Collection valued Attribute Single reference or Collection of references Relationships Multiplicity of Associations in UML Optional or Mandatory one-to-one, one-to-many, and many- to-many Types of Associations in UML Directed, Bi-directional and Aggregation Mapping Associations in ODL Attributes (Uni-directional relationships), without referential integrity management. True Relationships (Bi-directional) with referential integrity management.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 3 Different ways of representing links Single valued attribute Single reference Collection valued attribute Collection of references A B A B A B1, B2, … Bn A B1 B2 Bn

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 4 Multiplicity of associations in UML 0..1 (to-one, optional) 1..1 (to-one, mandatory) 0..* (to-many, optional) 1..* (to-many, mandatory)

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 5 Example Class Diagram for UNN-IS

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 6 Types of Associations: Bi-Directional These are true relationships so they require automatic referential integrity (in UML shown as lines without arrows or symbols). Since bi-directional, both participating classes (e.g., A and B) know about each other. Any changes to the state (e.g., initialising relationship) of an object of class A may affect the state of some object(s) of class B and vice versa. For example, when a Student object’s enrolledOn relationship is initialised with a reference to a Course object, that Course object’s students relationship will be automatically updated to include that Student object as one of the students enrolled on the course.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 7 Types of Associations: Aggregation Aggregation represents a part-whole relationship between two classes. Two kinds of Aggregation: Weak or shared aggregation (shown by ) Lets you model a part-whole relationship in which one object owns another object, but yet other objects can own that object as well. For example, several Person objects may share a same Address object. However, if no Person or Department object is associated with an Address object then that Address object should be deleted. Strong aggregation/composition (shown by ) Lets you model the part-whole relationship where one object exclusively owns another object. The life-time of the part depends on the life-time of the whole object. For example, a Person object owns a Passport object exclusively and whenever a Person object is deleted any associated Passport objects are also deleted.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 8 Bi-Directional Associations in ODL Syntax diagram of relationship declaration in ODL

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 9 Bi-Directional Associations in ODL … Implementing the to-one (1..1) relationship from Student to Course class. relationship Course enrolledOn inverse Course::students;

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 10 Bi-Directional Associations in ODL … Implementing the to-many (0..*) relationship from Course to Student class. relationship set students inverse Student::enrolledOn;

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 11 Aggregation in ODL Week Aggregation (part-whole relationship) Maps onto an attribute in the aggregating class. Single valued (if 0..1 or 1..1). Collection valued (if 0..* or 1..*). For example, a Course is a whole object made up of several Module objects. The modules aggregation in the Course class is defined as follows: attribute set modules; The application need to maintain the integrity of modules attribute and to make sure that the set must contain at least one reference to a module object.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 12 Aggregation in ODL … Strong Aggregation (part-whole relationship) Maps onto an attribute in the aggregating class. Single valued (if 0..1 or 1..1). Collection valued (if 0..* or 1..*). The aggregated class becomes a structured literal if it does not participate in any association with another class. Otherwise, it becomes a self-standing class. For example, a Person object owns at least one or more Passport objects. The aggregated class: Passport becomes a structure: struct Passport { string passportNum; string nationality; date issueDate; date expiryDate; }; The passports aggregation in the Person class is defined as follows: attribute set passports; There is no automatic referential integrity for the passports attribute.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 13 Association Classes When the association is one-to-one The association can be implemented as bi- or uni-directional depending on the situation. Add the attributes of the Association class to the participating class whose objects are more likely to get involved in the relationship. For example, suppose that every department has a chair who is one of the lecturer’s in the department. It would be better to define the association as an attribute (uni- directional relationship) in Department including startDate as only few lecturer will ever participate in the relationship. attribute Lecturer hasChair; attribute date startDate;

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 14 Association Classes … When the association is one-to-many The association can be implemented as bi- or uni-directional depending on the situation though preferably bi-directional. Add the attributes of the Association class to the participating class on the to-many side. For example, part-time lecturers works for a department for certain hours. It is better to use bi-directional relationship for the above. class PartTimeLecturer {... relationship Department worksFor inverse Department::partTimeStaff; attribute unsigned short hours; };

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 15 Association Classes … When the association is many-to-many The association class becomes a self-standing ODL class with bi-directional relationships to both participating classes. The attributes of the association class becomes attribute of the ODL class representing it. For example, the many-to-many association between Student and Module (having the association class) becomes: class StudentModule (extent AllStudentMoudles) { attribute unsigned short marks; relationship Student ofStudent inverseStudent::takes; relationship Module forModule inverseModule::takenBy; };

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 16 Association Classes … When the association is many-to-many … The Student class will include to-many relationship with StudentModule class: relationship list takes inverseStudentModule::ofStudent; list is used to keep track of the order in which modules were taken. The Module class will include to-many relationship with StudentModule class: relationship set takenBy inverseStudentModule::forModule;

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 17 Association Classes … But in some situations you may implement many-to- many Association classes differently. That is you may embed the association class inside one of the participating classes if navigation from both sides is not desirable/required. For example: In the above case the association class can be embedded inside the Invoice class if it is not necessary for products to have information about invoices on which they appear.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 18 Association Classes … struct ItemType { unsigned short units; Productitem; }; class Invoice (...) {... // attributes etc attribute set items; }; class Product (...) {... // attributes etc, no need to define attribute // of type Invoice or ItemType or relationship // with Invoice class. }; Invoice objects will not be dependent upon Product objects or will not require joins or navigation to obtain information about items.

Advanced Databases – Lecture # 11: The ODMG Standard for Object Databases 19 UNN-IS COMPLETE CLASS DIAGRAM