Beruflich Dokumente
Kultur Dokumente
This is a critical step. Without an accurate conceptual schema, resulting information system may not meet our needs or even function properly. Conceptual schema is blueprint for information system design.
81
Lets first describe fundamental data modeling concepts, so that we know how to specify a conceptual schema. We will do this in the context of an old-fashioned bookstore.
Well then see how we can use the discovery process to develop conceptual schema.
82
83
84
e.g., Book entities defined by ISBN,title,author, publisher,year,price,bookId Customer: lastname,firstname,address Supplier: name,state,phone,rating Shelf: shelfId
85
Star Wars: Jedi Trial Band of Brothers Circle of Friends Message In A Bottle The Long Road Home Star Wars: Jedi Trial Beyond Valor Curious George Beyond Valor
86
Customer entities:
address city Blacksburg Blacksburg Christiansburg Radford Christiansburg Lafayette
street 214 Church St. 185 Clay St. 35 Cambria St. 24 Range Road 240 Kent St., Apt. 27 14 2nd Street
state VA VA VA VA VA IN
87
Supplier entities:
name Thomson International ABC Books BookWorld state CA IN VA phone (216)-175-5065 (216)-831-9175, (704)-668-2203 (331)-791-4982, (501)-773-7381 rating A A C
Shelf entities:
shelfId s1 s2 s3 s4 s5 s6 : s40
88
Possible key attributes for our book store entity classes: Book: Supplier: Shelf: If an entity class has more than one key (i.e., sets of key attributes), one of the keys is designated the primary key. The other keys are then called secondary keys. Specification of key attributes for entity classes is an important part of data modeling. So be careful! Primary key: single attribute, value unlikely to change
2009 John P. Shewchuk ISE 3024 Course Notes 8 10
bookId
Key attributes must always have values. But what about the remaining (i.e., non-key) attributes? Such attributes should normally always have values as well. The special case of an empty space (field) is called a null value (or simply null ). While null values are sometimes necessary, they should be avoided if possible due to the ambiguity they create. For example, null could mean the attribute is not applicable for that entity the value is known but missing (i.e., not recorded). the value is unknown.
2009 John P. Shewchuk ISE 3024 Course Notes 8 11
e.g.,
lastName Smith Davis OKeefe Smith firstName John Diane Patrick John 35 Cambria St. 24 Range Road Radford VA VA 24061 24141 street 214 Church St. address city Blacksburg state VA zip 24073
8 12
8 13
e.g.,
Name title Data Type string Length unbounded Format none Domain none none Description Title of a book Example Beyond Valor
Two strings of none 36 characters, one 2-char string, one 5-char string 10 char 5 digits 2 char 4 digits
An address con- 214 Church St., sisting of street, Blacksburg, city, state, and VA, 24073 zipcode A phone number 216-175-5065 Price ($,cents) Shelf identifier 17.42 s3 1994
phone price
string currency
8 14
Attribute values may also have constraints as follows: Key values for associated attributes must be unique for every entity in that class. - this constraint on key values known as a key constraint or entity integrity constraint. - database system responsible for enforcing. Not Null Derived attribute is not entered directly, but rather is calculated from some other information.
8 15
Important part of data modeling: establishing what kinds of relationships can occur and incorporating this information into the data model.
8 16
8 17
We can also think of relationships as instances of a given relationship type. How are relationship types designated? Each relationship type consists of a verb phrase which can be used in a sentence with the entity classes, e.g., Phrase Relationship Type Between A customer buys a book Purchases Customer, Book Books are found on shelves FoundOn Book, Shelf
We can also specify relationship types in reverse order. e.g., Shelf Holds Book
2009 John P. Shewchuk ISE 3024 Course Notes 8 18
Relationship types may have their own attributes. e.g., Customer Purchases Book whenever a customer buys a book, we may want to record the date of the sale. the corresponding attribute, saleDate, only exists for a given sale, i.e., customer and book.
e.g., Book AvailableFrom Supplier price = cost of that book from that supplier =attribute of relationship type AvailableFrom
2009 John P. Shewchuk ISE 3024 Course Notes 8 19
8 20
One-to-One (1:1) an entity from either class may be related to at most one entity from the other class. e.g., relationship type isMarriedTo between Man and Woman Each man may be married to at most one woman. Each woman may be married to at most one man. Man to Woman is 1:1
8 21
One-to-Many (1:M) an entity from the first class may be related to multiple entries from the second: an entity from the second may be related to at most one entity from the first. e.g., Customer Purchases Book Each customer may purchase many books.
Many-to-Many (M:N) an entity from either class may be related to multiple entries from the other class. e.g., Book AvailableFrom Supplier Each book may be available from multiple suppliers.
8 23
Other types of constraints on relationships: Min/Max Constraints specifies how many relationships of a given type an entity may have. e.g., Shelf Holds Book. Each shelf can hold no more than 60 books. - max cardinality of Book = 60 - min cardinality of Book = 0 every Shelf entity can be associated with between 0 and 60 Book entities. some Shelf entities may not be associated with any Book entities.
2009 John P. Shewchuk ISE 3024 Course Notes 8 24
Each book, however, is found in exactly one shelf. - max cardinality of Shelf = 1 - min cardinality of Shelf = 1 every Book entity can be associated with between 1 and 1 Shelf entity. every Book entity associated with exactly one Shelf entity.
8 25
Participation Constraints specify whether or not entities must participate in associated relationship types. e.g., Customer Purchases Book - participation of Customer is optional (Customer can exist without any books) - participation of Book is optional e.g., Shelf Holds Book - participation of Shelf is optional (Some shelves may not have any books) - participation of Book is mandatory (Every book must be located on some shelf)
2009 John P. Shewchuk ISE 3024 Course Notes 8 26
Note that optional participation when min cardinality of related entity class = 0. 0 e.g., cardinality of Book = (0..60) participation of Shelf optional mandatory participation when min cardinality of related entity class > 0. 0 e.g., cardinality of Shelf = (1..1)
Thus, we can use min cardinality to determine and/or specify whether participation is mandatory or optional.
2009 John P. Shewchuk ISE 3024 Course Notes 8 27
The result of interviews, document collection, etc., are narrative descriptions of how the system (or some part of it) works or what information must be extracted from it. Such descriptions are often incomplete, conflicting, ambiguous, and/or contain irrelevant information. It is the information system designers job to sort through, compile, and analyze the descriptions to identify entity classes, attributes, and relationship types. This is often an iterative process, and can result in tensions and conflicts. So good people skills are critical to this step.
2009 John P. Shewchuk ISE 3024 Course Notes 8 29
Note also that the discovery process often results in information describing how the data management application must behave. While not part of the conceptual schema, this information must still be documented as it will be needed later on in developing the database application.
8 30
Annas Books is a small bookstore which sells books to walk-in customers. The owner wants computer support in locating where (i.e., on what shelf) a given book can be found. determining how many copies of a given title are on hand. tracking customer sales, and keeping track of what books are available from which suppliers, and at what price.
8 32
Customers _________ purchase one or more books _____ at a time: for each purchase, the date must be recorded. The first and last name of each customer is known: it is desirable to also know each customers address (for advertising purposes). The title, author, publisher, year, price, and ISBN # are recorded for each book. Books are located on one of forty shelves. ______ Each shelf can hold up to sixty books. All books of the same type (i.e., title) are to be kept together on the same shelf (one shelf is sufficient for any title). Books are obtained from different suppliers, ________ each of whom has a rating (A, B, or C), is located in a particular state, and can be contacted via one or more phone numbers. Every book is available from at least two different suppliers: a single supplier may supply many different books. Suppliers not able to provide any books should still be kept on record. For each book and possible supplier, we need to know the book price.
2009 John P. Shewchuk ISE 3024 Course Notes 8 33
(a) Entity classes, attributes, and additional attribute information: Entity Class Customer Attribute firstName lastName address Attribute Type and/or Constraints Partial key Partial key Partial key; composite attribute consisting of street, city, state, zip Key
Book
8 34
Attribute Type and/or Constraints Key Multivalued attribute Value from {A, B, C} Key
Shelf
8 35
(b) Relationship types, cardinality ratio constraints, and attributes: Relationship Type and Entity Classes Customer Purchases Book Book AvailableFrom Supplier Shelf Holds Book Cardinality Ratio 1:M M:N 1:M Attributes saleDate price
Note that as (i) Shelf has no other attributes besides key, and (ii) has only a simple relation with Book, we could simply make shelfId an attribute of Book. Best to leave as a separate entity, however: meaning clearer. may want to provide additional shelf information later.
2009 John P. Shewchuk ISE 3024 Course Notes 8 36
AvailableFrom
Book Supplier
Holds
Shelf Book
8 37
The plant manager has charged you with improving productivity on the shop floor.
The discovery process has resulted in the following description of user requirements and system operation.
8 38
JA Industries produces various machined components via the use of manufacturing cells. The company aims to improve productivity on the shop floor. Typical questions arising in support of this effort: Where (i.e., what machine and/or cell) are parts located? What is the status (e.g., busy) of each machine? What processes are required for a given part? Which machines are capable of a given process?
8 39
Each cell at JA Industries has a unique cell number, is of a specific type, and consists of 2-4 machines. Some cells also contain a robot for loading/unloading machines, in which case the single robot handles all machines in the cell. Every robot has a particular number, and is of a specific type and model. Shop workers perform load/unload if there is no robot in a cell. Each machine has a unique name, and is of a specific type. A separate number identifies the machine amongst all machines of that type (e.g., 3rd machine of type T4). Every machine can perform up to 5 different processes, where each process is defined by a unique identifier and a process description. Every process can be performed by at least one machine: some can be done by multiple machines. Not all machines perform a given process equally: the efficiency may vary from one machine to another.
2009 John P. Shewchuk ISE 3024 Course Notes 8 40
Each part produced in the facility has a unique serial number (SN) and is of a given type. For each part type, a unique process plan exists. The process plan specifies the sequence of operations (between 1 and 4) for that part type, where each operation is defined by machine, process, setup time, and run time. Also associated with each process plan is a list of the planners responsible for the plan. Some processes and machines may not be required for any operations. At any given time during production, every part in the system is located at a machine (i.e., in process or waiting to be processed). A given machine may not have any parts, however. Additionally, at any time, each machine is either busy, idle, or down.
8 41
(a) Entity classes, attributes, and additional attribute information: Attribute Type and/or Constraints Key Key
Machine
Key Partial secondary key Partial secondary key Values from {busy, idle, down}
8 42
ProcessPlan
Operation
8 43
(b) Relationship types, cardinality ratio constraints, and attributes: Relationship Type and Entity Classes Cell Has Machine Cell Contains Robot Robot Serves Machine Machine Has Part Process DoneAt Machine Process DoneVia Operation Machine Performs Operation ProcessPlan Has Operation ProcessPlan For Part Cardinality Ratio 1:M 1:1 1:M 1:M M:N 1:M 1:M 1:M 1:M efficiency
Attributes
8 44
Participation Constraint mandatory mandatory optional mandatory mandatory optional optional mandatory
Min/Max Cardinality (1..1) (2..4) (1..1) (0..1) (0..1) (2..4) (1..1) (0..M)
8 45
Contains
Cell Robot
Serves
Robot Machine
Has
Machine Part
Participation Constraint mandatory mandatory optional mandatory optional mandatory mandatory mandatory optional mandatory
Min/Max Cardinality (1..5) (1..M) (1..1) (0..M) (1..1) (0..M) (1..1) (1..4) (1..1) (0..M)
DoneVia
Process Operation
Performs
Machine Operation
Has
ProcessPlan Operation
For
ProcessPlan Part
8 46