Download presentation
Presentation is loading. Please wait.
Published byKimberly Hillary Jones Modified over 9 years ago
1
R McFadyen 7-192.2911 Chapter 7 Conceptual Data Modeling
2
R McFadyen 7-292.2911 Topics topics: –Developing a conceptual data model from use cases –UML notations for conceptual data modeling –UML class diagram bears a resemblance to an Entity Relationship Diagram (see 92.3914 for ERDs)
3
R McFadyen 7-392.2911 Topics UML: –attributes –association, aggregation, and generalization –multiplicities, roles, …
4
R McFadyen 7-492.2911
5
R McFadyen 7-592.2911 What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data; it is independent of any database management system or other implementation considerations. Represented by UML class diagrams Sources: Current knowledge Existing system System documents / reports Interviews Use cases
6
R McFadyen 7-692.2911 Use cases are key inputs to conceptual data modeling.
7
R McFadyen 7-792.2911
8
R McFadyen 7-892.2911
9
R McFadyen 7-992.2911 Conceptual Data Model Elements Classes Attributes Identifiers Associations, aggregations, compositions Generalizations Time dimensions Integrity rules Security controls
10
R McFadyen 7-1092.2911 What Is an Object? An entity that encapsulates data and behavior Examples: product, employee, order, line item Class – a set of objects that share the same attributes, operations, relationships, and semantics (abstract) Instance – a single object (concrete)
11
R McFadyen 7-1192.2911 Instances We use a rectangular shape to represent a class. It may be shown with one, two or three compartments attributes operations Name of class
12
R McFadyen 7-1292.2911
13
R McFadyen 7-1392.2911 Types of Attributes Simple attributes – contain single data item Identifiers – unique key value Multivalued attributes – contain multiple values simultaneously Composite attributes – group of related attributes
14
R McFadyen 7-1492.2911 Stereotypes in Class Diagrams Stereotype – a construct that extends the UML vocabulary Identifier stereotype > for primary key Multivalued stereotype >
15
R McFadyen 7-1592.2911 Primary key is a unique identifier; no two Student instances will have the same studentId value.
16
R McFadyen 7-1692.2911 Multivalued attribute can contain multiple values; a student may have several phone numbers
17
R McFadyen 7-1792.2911 Composite attributes have multiple components. They are treated as separate classes in conceptual data models. The attribute address is defined to be of type Address.
18
R McFadyen 7-1892.2911 What Is a Relationship? A semantic connection between objects of one or more classes In UML, represented as a line connecting two or more class boxes (or connecting one class to itself) In UML, known as an association
19
R McFadyen 7-1992.2911 This is association between two classes, and is known as a binary association: an employee works in a department. Binary associations are the most common type.
20
R McFadyen 7-2092.2911 We use an adornment to indicate how to read the association: “an employee works in a department” works in
21
R McFadyen 7-2192.2911 Roles identify the purpose of each class in the relationship. Rolenames are useful (much) later on when we have software classes with attributes referring to instances of classes Note that neither class has an attribute referring to object(s) of the other class – that would be an implementation detail
22
R McFadyen 7-2292.2911 What Is Relationship Degree? The number of classes that participate in a relationship Main degrees: –Unary – a relationship between objects of the same class –Binary – a relationship between objects of two different classes –Ternary – a relationship between objects of three different classes –!NOTE. Our text differs from other texts in these definitions: Degree is the number of objects that participate – there is no Unary relationship. Instead of unary, the term recursive is used From text
23
R McFadyen 7-2392.2911 A reflexive association reflexive
24
R McFadyen 7-2492.2911 This example is related to a business rule that states a specific quantity of a Part is shipped by a Vendor to a Warehouse. The ternary relationship is expressed as in the following slide:
25
R McFadyen 7-2592.2911 An n-ary association, n>2, is shown with a diamond symbol Part VendorWarehouse ships The diamond is the symbol used for a n-ary association
26
R McFadyen 7-2692.2911 An analyst will likely promote the association to a full class. This changes the model so it now has four classes and three binary associations. Part VendorWarehouse ships Shipment
27
R McFadyen 7-2792.2911 Multiplicity Associations can be: –One – to – one –One – to – many –Many – to – many
28
R McFadyen 7-2892.2911 Multiplicity The range of the number of objects in a class that can or must be associated with each object of another class in an association. ** represents zero or more 0..*same meaning as above 1..*one or more 1..5one, two, three, four, or five 0,1zero or one 1exactly one 3exactly three Ranges use.. Enumeration uses,
29
R McFadyen 7-2992.2911 Multiplicity notation is: min..max
30
R McFadyen 7-3092.2911 Roles, especially for reflexive associations, make it clear how an object participates in the association. Here, one object is the supervisor and the other is the subordinate.
31
R McFadyen 7-3192.2911 A reflexive association What are the multiplicities?
32
R McFadyen 7-3292.2911 Associative Class An associative class is both a class and an association. It contains attributes and/or participates in relationships in its own right Represented as a class connected to an association with a dotted line Typically appears with a many-to-many association – there probably are attributes that describe the association
33
R McFadyen 7-3392.2911 A Certificate represents a relationship between an employee and a course, and has an attribute pertaining to that relationship
34
R McFadyen 7-3492.2911 In a many-to-many association, an object of one class can be associated with an object of the other class at most one time. This is true irrespective of whether we have an associative class or not: EmployeeCourse ** EmployeeCourse ** Certificate completes
35
R McFadyen 7-3592.2911 Suppose an employee can take the same course more than once. We must promote the associative class to a full class: EmployeeCourse ** EmployeeCourse ** Certificate 11 dateCompleted Certificate dateCompleted
36
R McFadyen 7-3692.2911 Reconsider marriedTo. Do we need an associative class? Do we need to promote an associative class to a full class?
37
R McFadyen 7-3792.2911 Sometimes associative classes have their own relationships with other classes.
38
R McFadyen 7-3892.2911 Types of Associations Association – no object is subordinate to any other. Aggregation – one class represents the whole, and the other represents the part, but there is no concept of ownership Composition – one class represents the whole, and the other represents the part; the whole contains or owns the part; the part cannot exist without the whole. Generalization/specialization –an association between a general thing (the superclass or parent class) and a more specific kind of thing (the subclass or child class)
39
R McFadyen 7-3992.2911 Composition Aggregation
40
R McFadyen 7-4092.2911 Generalization a generalization is an association between a general thing (the superclass or parent class) and a more specific kind of thing (the subclass or child class) Inheritance – A subclass inherits all the attributes and operations of its superclass; an instance of the subclass contains all the same information (plus more) as an instance of the superclass An instance of a subclass is also an instance of the superclass
41
R McFadyen 7-4192.2911 Generalization (Ch 26) Multiple subclasses can be grouped to indicate they are related subclasses LibraryMember StaffMemberStudentMember It then becomes meaningful to consider certain constraints: complete, incomplete, disjoint, overlapping
42
R McFadyen 7-4292.2911 Generalization Inheritance of attributes and behaviour: everything a LibraryMember can do, a StaffMember can do everything a LibraryMember can do, a StudentMember can do If a LibraryMember can borrow a book, so can a StaffMember and a StudentMember a StaffMember and a StudentMember have all the attributes the LibraryMember has, and possibly more Specialization: there are some things that a specialized class can do that a LibraryMember cannot LibraryMember StaffMemberStudentMember
43
R McFadyen 7-4392.2911 example: a SavingsAccount is a specialized kind of BankAccount a ChequingAccount is a specialized kind of BankAccount a BankAccount is a specialized kind of Asset RealEstate is … Asset RealEstateBankAccountSecurity SavingsAccountChequingAccount
44
R McFadyen 7-4492.2911 Payment Amount: money Cash Payment Credit PaymentCheque Payment Sale Pays-for 1 1 Every payment, regardless of whether it is cash, credit, or cheque, has an Amount and it is associated with a Sale CreditCardCheque 1 1 1 *
45
R McFadyen 7-4592.2911 Motivation for partitioning a conceptual class into subclasses: subclass has additional attributes of interest subclass has additional associations of interest subclass is operated on, handled, reacted to, or manipulated differently than the superclass or other subclasses the subclass concept represents an animate thing that behaves differently than the superclass or other subclasses
46
R McFadyen 7-4692.2911
47
R McFadyen 7-4792.2911 Using the UML symbol
48
R McFadyen 7-4892.2911
49
R McFadyen 7-4992.2911
50
R McFadyen 7-5092.2911 Multiple inheritance is complicated and not supported by all object- oriented programming languages.
51
R McFadyen 7-5192.2911 This is a difficult model to work with. An employee could be a Secretary paid hourly, but another Secretary may be paid a salary.
52
R McFadyen 7-5292.2911 Consider:
53
R McFadyen 7-5392.2911 Instead of Figure 7.23, a modeler might use: Part BasicPartAggregate 1..* What is this? What does this allow us to build? Are there some common attributes for BasicPart and Aggregate? Are there common operations? Composed of subpart
54
R McFadyen 7-5492.2911 Summary We have covered : –Developing data models from use cases –UML notation for conceptual modeling –Associations and multiplicity –Aggregation, composition, and generalization –Attributes: identifier, composite, multivalued, derived attributes
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.