Written and cooked by Janusz R. Getta, School of Computing and Information Technology, University of Wollongong Building 3, room 210, ext 4339, [email protected], http://www.uow.edu.au/˜jrg
CSIT882 Data Management Systems
Re ipe 2.3 How to do design a on eptual s hema with UMLet (Design 2) ?
Table of contents
Step 0 How to begin and what you need to do before you start ?
Step 1 How to find the classes of objects, generalizations, and atributes ? Step 2 How to find the associations, link attributes, and association classes ? Step 3 How to find the identifiers ?
Step 0 How to begin and what you need to do before you start ?
A printable copy of this experiment in pdf format is available here (www.uow.edu.au/~jrg/882/cookbook/ e2-3.pdf).
In this experiment we use UMLet to create a conceptual schema for the following specification of a sample database domain.
A database is needed to store information about the buildings owned by a university.
The buildings owned by a university have unique names and unique numbers. A building includes offices, lecture rooms, laboratory rooms, and utility rooms such as toilets, meeting rooms, and seminar rooms. All rooms are identified within a building by a room number.
The offices, lecture halls, laboratory and utility rooms are described by an area, number of entries/exits, total number of windows, and type of floor cover.
The offices have a number of facilities and equipment installed. The facilities include computer network connections and air conditioning and the equipment items include desk, chair, computer, and small refrigerators with soft drinks. An office may have more than one network connection and more than one chair. We would like to record in the database the names and serial numbers of facility/equipment units installed in each office.
The employees use the offices. An office is usually occupied an academic staff member and some offices are shared by many support staff members. An office may be also empty for a certain period of time. The employees are described by the first and last name, employee number, and name of department an employee belongs to.
It is not allowed to add any artificial identification attributes to the specification above.
One of the many approaches to the analysis of database domains is to read (pass through) a specification several times and to ”discover” the basic components of a conceptual schema in each pass. In the first design we discovered the classes of objects in the first pass, associations in the second pass, attributes in the third pass, identifiers and qualifications in the fourth pass. Finally, in the last pass, we discovered generalization hierarchies and we performed the final refinements. This time, to speed up this process we discover more than one component type in one pass. In the first pass we discover classes of objects, generalizations, and their descriptions of classes of objects with attributes. Next, we discover associations and in the final pass we discover identifications.
Start UMLet and read the first statement from the specification.
A database is needed to store information about the buildings owned by a university.
Use UMLet to create a class of objects BUILDING. No new attributes of the class are determined in a sentence above.
Read the next sentence from the specification. Each building has a unique name and unique number.
No new class of objects is created. We add to a description of a classBUILDINGthe attributesnameandnumber
Read the next sentence from the specification.
A building includes offices, lecture rooms, laboratory rooms, and utility rooms such as toilets, meeting rooms, and seminar rooms.
Use UMLet to create the following classes of objects: OFFICE,LECTURE,LABORATORY,UTILITY,TOILET,MEETING, andSEMINAR.
A sentence also say ”... and utility rooms such as toilets, meeting rooms, and seminar rooms.” Therefore, a set of all toilets is a subset of all rooms. It allows us to add the following generalizations. TOILET Is-an UTILITY,
MEETING Is-an UTILITY, andSEMINAR Is-an UTILITY. Read the next sentence from the specification.
All rooms are identified within a building by a room number. Use UMLet to create a class of objectsROOM.
Next, the existence of a classROOMallows us to create a generalizationOFFICE Is-a ROOM,LECTURE Is-a ROOM,
LABORATORY Is-a ROOM, and UTILITY Is-A ROOM.
Finally, we add an attributeroomnumto a description of a classROOM. Note, that there is no need to add the same attribute to the descriptions of the other classes because due to a generalization the attribute is inherited by the other classes. Simply, if a room has a number and a lecture hall is a room then obviously a lecture hall must have a number, and so on.
Read the next sentence from the specification.
The offices, lecture halls, laboratory and utility rooms are described by an area, number of entries/exits, total number of windows, and type of floor cover.
This statement does not contribute to any new classes of objects. It allows us to add the new attributes to the de-scriptions of classesOFFICE,LECTURE,LABORATORY, andUTILITY. Because of generalizationsOFFICE Is-a ROOM,
LECTURE Is-a ROOM,LABORATORY Is-a ROOM, andUTILITY Is-A ROOM it is enough to add the new attributes to a classROOM.
Use UMLet to add the attributesarea,etrext,windows, andfloorto a description of a classROOM. Read the next sentence from the specification.
The offices have a number of facilities and equipment installed. Use UMLet to create the classes of objectsFACILITYandEQUIPMENT. Read the next sentence from the specification.
The facilities include computer network connections and air conditioning and the equipment items include desk, chair, computer, and small refrigerators with soft drinks.
Use UMLet to create the classes of objectsNETWORK CONNECTION,AIR CONDITIONING,DESK,CHAIR,COMPUTER, andREFRIGERATOR.
At this point we can immediately add the new generalizations: NETWORK CONNECTION Is-a FACILITY,AIR CON-DITIONING Is-a FACILITY, DESK Is-an EQUIPMENT, CHAIR Is-an EQUIPMENT, COMPUTER Is-an EQUIP-MENT, andREFRIGERATOR Is-an EQUIPMENT.
Read the next sentence from the specification.
An office may have more than one network connection and more than one chair. No new class of objects is created.
Read the next sentence from the specification.
We would like to record in the database the names and serial numbers of facility/equipment units installed in each office.
No new class of objects is created.
Use UMLet to add the attributesname, andsernumto the descriptions of the classesFACILITYandEQUIPMENT. Read the next sentence from the specification.
The employees use the offices.
Use UMLet to create a new class of objectsEMPLOYEE. Read the next sentence from the specification.
An office is usually occupied an academic staff member and some offices are shared by many support staff members.
Use UMLet to create the new classes of objectsSTAFFandSUPPORT.
Next use UMLet to create the following generalizations:STAFF is-an EMPLOYEEandSUPPORT is-an EMPLOYEE.
Read the next sentence from the specification.
An office may be also empty for a certain period of time. Use UMLet to create a new classof objectsEMPTY OFFICE.
Next use UMLet to create a generalizationEMPTY OFFICE is-an OFFICE. Read the next sentence from the specification.
The employees are described by the first and last name, employee number, and name of department an employee belongs to.
No new class of objects is created.
Next use UMLet to add the following attributes to a description of a classEMPLOYEE:first-name,last-name,
empnum, anddepartment.
An initial class diagram is availablehere (www.uow.edu.au/~jrg/882/cookbook/A1-1e2-3.png).
Step 2 How to find the associations, link attributes, and association classes ?
We return to the beginning of the specification and we read the first statement again. A database is needed to store information about the buildings owned by a university. No new association created.
Read the next sentence from the specification. Each building has a unique name and unique number. No new association created.
Read the next sentence from the specification.
A building includes offices, lecture rooms, laboratory rooms, and utility rooms such as toilets, meeting rooms, and seminar rooms.
A statement above strongly suggest the associations likeBUILDING Consists-of OFFICE,BUILDING Consists-of LECTURE, ... and so on. However, when we already created the generalizations like OFFICE Is-a ROOM,
LECTURE Is-a ROOM, ... then it is enough to create one association BUILDING Consists-of ROOM and such association will be inherited by the subclasses. The association is ”one-to-many” because each building has many rooms and a room is located in only one building.
Use UMLet to create a new ”one-to-many” associationBUILDING Consists-of ROOM. Read the next sentence from the specification.
All rooms are identified within a building by a room number. No new association created.
Read the next sentence from the specification.
The offices, lecture halls, laboratory and utility rooms are described by an area, number of entries/exits, total number of windows, and type of floor cover.
No new association created.
Read the next sentence from the specification.
The offices have a number of facilities and equipment installed.
The statement suggests two associations OFFICE Has EQUIPMENT and OFFICE Has FACILITY. However, if we generalize the classes FACILITY and EQUIPMENT into hmmmm ... let us say a class INSTALLATION then only one association OFFICE Has INSTALLATION is needed. The association is ”one-to-many” because one physical installation item like facility or equipment is located in one office and an office has many installation items. Use UMLet to create a new classINSTALLATIONand two new generalizations FACILITY Is-an INSTALLATION
andEQUIPMENT Is-an INSTALLATION.
Now, the attributesnameandsernumthat describe the classesFACILITYandEQUIPMENTcan be moved to a class
INSTALLATIONbecause both classesFACILITYandEQUIPMENTinherit the attributes from a classINSTALLATION.
Use UMLet to move the attributesnameand sernumfrom the classes FACILITY andEQUIPMENTto a class IN-STALLATION.
Use UMLet to create a new ”one-to-many” associationOFFICE Has INSTALLATIONthat is optional on INSTAL-LATIONside.
Read the next sentence from the specification.
A department is described by a name, a name of its manager and budget allocated in the current year. No new association is created.
Read the next sentence from the specification.
The facilities include computer network connections and air conditioning and the equipment items include desk, chair, computer, and small refrigerators with soft drinks.
No new association is created.
Read the next sentence from the specification.
An office may have more than one network connection and more than one chair.
No new association is created. It is already recorded that an associationOFFICE Has INSTALLATIONis ”one-to-many”.
Read the next sentence from the specification.
We would like to record in the database the names and serial numbers of facility/equipment units installed in each office.
No new association is created.
The employees use the offices.
Use UMLet to create a new associationEMPLOYEE Use OFFICE. An association is ”many-to-one” because an em-ployee use one office and an office can be used many emem-ployees.
Read the next sentence from the specification.
An office is usually occupied an academic staff member and some offices are shared by many support staff members.
The statement provides more information about multiplicities association between offices and academic staff mem-bers or support staff memmem-bers. To incorporate such information we replace an associationEMPLOYEE Use OFFICE
with ”one-to-one” associationSTAFF Occupies OFFICE optional on STAFFside and ”many-to-one” association
SUPPORT Shares OFFICEalso optional onSUPPORTside. Read the next sentence from the specification.
An office may be also empty for a certain period of time. No new association is created.
Read the next sentence from the specification.
The employees are described by the first and last name, employee number, and name of department an employee belongs to.
No new association is created.
We discovered twoConsists-ofassociations. An extended conceptual schema is availablehere (www.uow.edu. au/~jrg/882/cookbook/A2-1e2-3.png).
Step 3 How to find the identifiers ?
We return to the beginning of the specification and we read the first statement again. A database is needed to store information about the buildings owned by a university. No information about identifiers is provided.
Read the next sentence from the specification. Each building has a unique name and unique number.
We discover two identifers of a classBUILDING. The first identifier is an attribute nameand the second identifier is an attributenumber.
Use UMLet to add a tagID1to an attributenamein a classBUILDINGand add a tagID2to an attributenumber
in the same class.
Read the next sentence from the specification.
A building includes offices, lecture rooms, laboratory rooms, and utility rooms such as toilets, meeting rooms, and seminar rooms.
No information about identifiers is provided. Read the next sentence from the specification.
All rooms are identified within a building by a room number.
An attribute roomnumis a local identifier in a classROOMbecause all rooms have different numbers in a building. However, it frequently happens that two rooms in different building have the same number. Therefore, to distin-guish between such rooms we have create a composite identifier of a room(number, roomnum).
Use UMLet to create a qualification of an associationBUILDING Consists-of ROOM with an attributeroomnum
onBUILDINGside of the association.
Next, change a multiplicity of an associationBUILDING Consists-of ROOM from1..*to0..1on ROOMside of the association.
Remove an attributeroomnumfrom a description of a classROOM. Read the next sentence from the specification.
The offices, lecture halls, laboratory and utility rooms are described by an area, number of entries/exits, total number of windows, and type of floor cover.
No information about identifiers is provided. Read the next sentence from the specification.
The offices have a number of facilities and equipment installed. No information about identifiers is provided.
Read the next sentence from the specification.
A department is described by a name, a name of its manager and budget allocated in the current year. No information about identifiers is provided.
Read the next sentence from the specification.
The facilities include computer network connections and air conditioning and the equipment items include desk, chair, computer, and small refrigerators with soft drinks.
No information about identifiers is provided. Read the next sentence from the specification.
An office may have more than one network connection and more than one chair. No information about identifiers is provided.
We would like to record in the database the names and serial numbers of facility/equipment units installed in each office.
From our knowledge of the real world we find that an attributeserial numberis unique for facilities and equip-ments.
Use UMLet to add a tagID1to an attributesernumin a classINSTALLATION. Read the next sentence from the specification.
The employees use the offices.
No information about identifiers is provided. Read the next sentence from the specification.
An office is usually occupied an academic staff member and some offices are shared by many support staff members.
No information about identifiers is provided. Read the next sentence from the specification.
An office may be also empty for a certain period of time. No information about identifiers is provided.
Read the next sentence from the specification.
The employees are described by the first and last name, employee number, and name of department an employee belongs to.
From our knowledge of the real world we find that an attributeempnumis unique for employees. Use UMLet to add a tagID1to an attributeempnumin a classEMPLOYEE.
In this pass we discovered the identifiers of all classes od objects. The final conceptual schema is available
here (www.uow.edu.au/~jrg/882/cookbook/A3-1e2-3.png).
References
UMLet 14.3
(http://www.umlet.com)
UMLet Online help