OFFERS: relates an instrcutor who
offers a course during a semester
(i,c,s)
Constraint: (i,c,s) cannot exist unless
(i,c),(i,s),(s,c) exist, but converse
is not true.
The following figures illustrate
(a) ternary relationship type SUPPLY; (b) three binary relationship types
are not equivalent to one ternary relationship type SUPPLY;
(c) another example of ternary versus binary relationship type:
A weak entitye type INTERVIEW with a ternary identifying
relationship type:
THE UML MODEL
The Unified Modeling Language(UML) is an object-oriented
analysis and design that evolved as a result of the combined
work of James Rumbaugh, Grady Booch, and Ivar Jacobson.
In 1997, a UML consortium(which include Microsoft,
Hewlett-Packard, Oracle, MCI Systemhouse, IBM, IntelliCorp
and more) submitted the 1.1 version of the UML to the Object
Management Group(OMG). Since then, UML has become a de
facto standard in the software industry, and it continues to
evolve.
For database modeling, the most useful part of UML is the
Class Diagram and Object Diagram.
We can use these diagrams for object-oriented
database design.
An example of the conceptual design of a library information system
A library is planning to develop a library information system. This
library will serve only registered students. Each book has title,
author, publisher, date-of-publication, ISBN number and a set of keywords.
Each student has SSN, first name, last name, address, telephone number.
A student can borrow a book for up to two weeks, so it is necessary
to keep track of the date-of-borrow. He can then renew the
book for another two weeks. Two renewals are allowed. After
two renews, the student must return a borrowed book.
If a book is overdue, the student must pay a fine of $0.5 a day.
ER Model for library information system
Entity type BOOK(ISBN,title,author,publisher,date-of-pub,{keywords})
Notice {keywords} is a multi-valued attribute.
The key is ISBN.
Entity type STUDENT(SSN,fname,lname,address,telephone)
The key is SSN.
Relation type BORROW(SSN,ISBN,date-of-borrow,no-of-renewal,fine)
The BORROW relation type is one-to-many.
Participation of BOOK is partial
Participation of STUDENT is partial
The UML Class Diagram
---------------
| Borrow |
------------------|-------------|-------------------------
1 | N | SSN, ISBN | 1 1 |
-------------- | data-borrow | ---------------
| Student | | no-renewal | | Book |
|------------| | telephone | |-------------|
| SSN | | fine | | ISBN |
| fanme | |-------------| | author |
| lname | | borrow() | | title |
| address | | renewal() | | publisher |
| telephone | | cal-fine9) | | date-pub |
|------------| --------------- | keywords |
| add() | |-------------|
| delete() | | add() |
-------------- | delete() |
---------------
The UML Object Diagram
-------------------
--------------|Doe,book1: Borrow|-------------------------------
| ------------------- |
| ------------------- -------------
| -------------|Doe,book2: Borrow|----------- |book1: Book|
| | ------------------- | -------------
-------------- |
|Doe: Student| -------------
-------------- |book2: Book|
-------------