Post on 21-Jan-2016
transcript
5-1© Prentice Hall, 2007
Topic 5:Topic 5:Conceptual Data ModelingConceptual Data Modeling
Object-Oriented Systems Analysis and Design
Joey F. George, Dinesh Batra,
Joseph S. Valacich, Jeffrey A. Hoffer
Topic 5 5-2© Prentice Hall, 2007
Chapter ObjectivesChapter Objectives
After studying this chapter you should be able to:– Determine how to develop conceptual
data models from use cases.– Understand UML notations for
conceptual data modeling.– Explain relationship characteristics such
as degree and multiplicity.
Topic 5 5-3© Prentice Hall, 2007
Chapter Objectives Chapter Objectives (Continued)(Continued)
After studying this chapter you should be able to:– Describe data relationships such as
association, aggregation, and generalization.
– Describe different kinds of attributes such as identifier, multivalued, and derived.
Topic 5 5-4© Prentice Hall, 2007
Topic 5 5-5© Prentice Hall, 2007
What Is a Conceptual Data What Is a Conceptual Data Model?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
Topic 5 5-6© Prentice Hall, 2007
Use cases are key inputs to conceptual data modeling.
Topic 5 5-7© Prentice Hall, 2007
Conceptual model sets the stage for more detailed model, and ultimately system design
Topic 5 5-8© Prentice Hall, 2007
Conceptual Data Model ElementsConceptual Data Model ElementsClassesAttributesIdentifiersAssociations, aggregations, compositionsGeneralizationsTime dimensionsIntegrity rulesSecurity controls
Topic 5 5-9© Prentice Hall, 2007
What Is an Object?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)
Topic 5 5-10© Prentice Hall, 2007
Class
Instances
Topic 5 5-11© Prentice Hall, 2007
UML Class symbol has three parts:
1) Name2) List of attributes3) List of operations
Topic 5 5-12© Prentice Hall, 2007
What is an Attribute?What is an Attribute?
A named property of a class that describes a range of values that instances of the attribute may hold
Topic 5 5-13© Prentice Hall, 2007
Types of AttributesTypes of AttributesSimple attributes – contain single data item
Identifiers – connect unique key value
Multivalued attributes – contain multiple values simultaneously
Composite attributes – group of related attributes
Topic 5 5-14© Prentice Hall, 2007
Stereotypes in Class DiagramsStereotypes in Class Diagrams
Stereotype – a construct that extends the UML vocabulary
Identifier stereotype <<PK>> for primary key
Multivalued stereotype <<multivalued>>
Topic 5 5-15© Prentice Hall, 2007
Primary key is a unique identifier; no two Student instances will have the same studentId value.
Topic 5 5-16© Prentice Hall, 2007
Identifiers and KeysIdentifiers and Keys
Identifier – an attribute or combination of attributes that is selected as the unique characteristic for a class
Candidate key – an attribute or combination of attributes that uniquely identifies each object of a class
Primary key – a candidate key that is selected as the unique identifier of the class
Topic 5 5-17© Prentice Hall, 2007
Multivalued attribute can contain multiple values; a student may have several phone numbers
Topic 5 5-18© Prentice Hall, 2007
Composite attributes have multiple sections (subattributes).They are treated as separate classes in conceptual data models.
Topic 5 5-19© Prentice Hall, 2007
What Is a Relationship?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)
Topic 5 5-20© Prentice Hall, 2007
What Is Relationship Degree?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
Topic 5 5-21© Prentice Hall, 2007
This is a binary relationship, which indicates that an employee works in a department.
Topic 5 5-22© Prentice Hall, 2007
Roles identify the purpose of each class in the relationship.
Topic 5 5-23© Prentice Hall, 2007
Unary relationships exist between instances of the same class
Topic 5 5-24© Prentice Hall, 2007
Note: a ternary relationship is not the same as three binary relationships. It is a relationship that links three separate classes simultaneously.
Topic 5 5-25© Prentice Hall, 2007
What Is Relationship Multiplicity?What Is Relationship Multiplicity?
The range of the number of objects in Class A that can or must be associated with each object of Class B.
A multiplicity is made up of:– A minimum cardinality – the minimum number
of Class A objects possible– A maximum cardinality – the maximum
number of Class A objects possible
Topic 5 5-26© Prentice Hall, 2007
Relationship MultiplyRelationship Multiply
Relationships can be:
– One – to – one
– One – to – many
– Many – to – many
Topic 5 5-27© Prentice Hall, 2007
Multiplicity notation is: min..max
This shows that one movie can be stocked as any number of videotapes, or none at all
Topic 5 5-28© Prentice Hall, 2007
Fixed cardinality involves an actual number instead of the generic n
This indicates that the maximum number of sections an instructor can teach is 6
Topic 5 5-29© Prentice Hall, 2007
Roles make it clearer to see which should be on the one side and which should be on the many side of the relationship.
Topic 5 5-30© Prentice Hall, 2007
Topic 5 5-31© Prentice Hall, 2007
What Is an Associative Class?What Is an Associative Class?
A many-to-many association that the data modeler chooses to model as a class
Particularly useful if the association contains attributes of its own
Represented as a class connected to an association with a dotted line
Topic 5 5-32© Prentice Hall, 2007
A Certificate represents a relationship between an employee and a course, and has an attribute pertaining to that relationship
Topic 5 5-33© Prentice Hall, 2007
Sometimes associative classes have their own relationships with other classes.
Topic 5 5-34© Prentice Hall, 2007
Types of AssociationsTypes of Associations• Association – no object is subordinate to any other.
• Aggregation – one class represents the whole, and the other represents the part, but it is a loose coupling.
• Composition – an aggregation with a tight coupling. The whole and the part cannot exist without each other.
Topic 5 5-35© Prentice Hall, 2007
Closed diamond indicates composition(course line item cannot exist without course registration)
Open diamond indicates aggregation(A player is part of a team, but could also exist without being part of a team)
Topic 5 5-36© Prentice Hall, 2007
What Is a Composite Structure What Is a Composite Structure Diagram?Diagram?
A diagram that shows how a whole is made up of its parts, especially in cases where the whole has a large number of interating parts
Useful to reduce clutter in diagrams with many associations
Introduced in UML 2
Topic 5 5-37© Prentice Hall, 2007
Topic 5 5-38© Prentice Hall, 2007
What Is Generalization?What Is Generalization?
A superclass – subclass relationship in which one class forms a broader category in which the other class is a sub-category
Inheritance – A subclass will inherit 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.
Inheritance is an “is-a” relationship
Topic 5 5-39© Prentice Hall, 2007
Topic 5 5-40© Prentice Hall, 2007
Topic 5 5-41© Prentice Hall, 2007
Multiple inheritance is complicated and not supported by all object-oriented programming languages.
Topic 5 5-42© Prentice Hall, 2007
RecapRecap
After studying this chapter we learned to:– Develop data models from use cases.– Use UML notation for conceptual modeling.– Understand relationship multiplicity and
degree.– Work with aggregation, composition, and
generalization.– Work with identifier, multivalued, and derived
attributes.