36
Conceptual Data Conceptual Data Modeling Modeling

Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Embed Size (px)

Citation preview

Page 1: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Conceptual Data Conceptual Data ModelingModeling

Page 2: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 3: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is a Conceptual What Is a Conceptual Data Model?Data Model?

A detailed model that shows the A detailed model that shows the overall structure of organizational overall structure of organizational datadata

It is independent of any database It is independent of any database management system or other management system or other implementation considerations.implementation considerations.

Represented by UML class Represented by UML class diagramsdiagrams

Page 4: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Use cases are key inputs to conceptual data modeling.

Page 5: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 6: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 7: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Conceptual Data Model Conceptual Data Model ElementsElements

ClassesClasses AttributesAttributes IdentifiersIdentifiers Associations, aggregations, Associations, aggregations,

compositionscompositions GeneralizationsGeneralizations Time dimensionsTime dimensions Integrity rulesIntegrity rules Security controlsSecurity controls

Page 8: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Object/Class/InstanceObject/Class/Instance

ClassClass::– A person, place, thing, event, or concept in user A person, place, thing, event, or concept in user environment about which organization wishes to environment about which organization wishes to maintain data.maintain data.– It is a set of objects that share the same It is a set of objects that share the same attributes, operations, relationships, and attributes, operations, relationships, and semantics (abstract).semantics (abstract).

ObjectObject::– A single occurrence of a class;A single occurrence of a class; encapsulates data encapsulates data and behavior.and behavior.(Examples: product, employee, order, line item)(Examples: product, employee, order, line item)

InstanceInstance::– A single object (concrete). A single object (concrete). (i.e. John Smith, student)(i.e. John Smith, student)

Page 9: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Class

Instances

Page 10: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

UML Class symbol has three parts:

1) Name2) List of attributes3) List of operations

Page 11: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Types of AttributesTypes of Attributes

Simple attributesSimple attributes – contain single data item – contain single data item (i.e. name)(i.e. name)

IdentifiersIdentifiers (aka (aka Primary KeyPrimary Key) – contain unique ) – contain unique key value for class key value for class (i.e. studentId in Student class)(i.e. studentId in Student class)

Multivalued attributesMultivalued attributes – contain multiple values – contain multiple values simultaneously simultaneously (i.e. phone number – may have several (i.e. phone number – may have several phone numbers - home, cell, beeper)phone numbers - home, cell, beeper)

Composite attributesComposite attributes – group of related – group of related attributesattributes(i.e. address – contains sub-attributes of street, city, state, zip)(i.e. address – contains sub-attributes of street, city, state, zip)

Page 12: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Stereotypes in Class Stereotypes in Class DiagramsDiagrams

Stereotype – a construct that extends the Stereotype – a construct that extends the UML vocabularyUML vocabulary

Identifier stereotype Identifier stereotype <<PK>><<PK>> for primary for primary key key

Multivalued stereotype Multivalued stereotype <<multivalued>><<multivalued>>

Since there are no standard UML symbols for Since there are no standard UML symbols for primary key or multivalued they are created primary key or multivalued they are created using stereotypesusing stereotypes

Page 13: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Primary key is a unique identifier; no two Student instances will have the same studentId value.

Page 14: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Multivalued attribute can contain multiple values; a student may have several phone numbers

Page 15: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Composite attributes have multiple sections (subattributes).They are treated as separate classes in conceptual data models.

Page 16: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Selecting Primary KeysSelecting Primary Keys

Choose a primary key that will not change its value over the Choose a primary key that will not change its value over the life of each object of the class (i.e. name and address life of each object of the class (i.e. name and address changes so they are not good candidates)changes so they are not good candidates)

Choose a primary key such that, for each object of the Choose a primary key such that, for each object of the class, the attribute is guaranteed to have valid values and class, the attribute is guaranteed to have valid values and not be null. (include controls in data entry and not be null. (include controls in data entry and maintenance routines to eliminate errors)maintenance routines to eliminate errors)

Avoid the use of so-called intelligent keys. For instance, the Avoid the use of so-called intelligent keys. For instance, the 11stst two digits stand for a warehouse location or region. two digits stand for a warehouse location or region. These conditions can change.These conditions can change.

Consider substituting single-attribute surrogate keys for Consider substituting single-attribute surrogate keys for large composite keys.large composite keys.

Page 17: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is A What Is A Relationship?Relationship?

A semantic connection between objects of A semantic connection between objects of one or more classesone or more classes

In UML, represented as a line connecting two In UML, represented as a line connecting two or more class boxes (or connecting one class or more class boxes (or connecting one class to itself)to itself)

Labeled with verb phrasesLabeled with verb phrases

A relationship is generally described by its A relationship is generally described by its name, degree, and multiplicity (minimum name, degree, and multiplicity (minimum and maximum cardinality)and maximum cardinality)

Page 18: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

This is a binary relationship, which indicates that an employee works in a department.

Page 19: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Roles identify the purpose of each class in the relationship.

Page 20: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is Relationship What Is Relationship Degree?Degree?

The number of classes that The number of classes that participate in a relationshipparticipate in a relationship

Main degrees:Main degrees:– Unary – a relationship between Unary – a relationship between

objects of the same class objects of the same class (also called (also called recursive)recursive)

– Binary – a relationship between Binary – a relationship between objects of two different classes objects of two different classes (most (most common)common)

– Ternary – a relationship between Ternary – a relationship between objects of three different classesobjects of three different classes

Page 21: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 22: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Quantity is the amount of a particular Part shippedfrom a particular Vendor to a particular Warehouse

Page 23: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is Relationship What Is Relationship Multiplicity?Multiplicity?

The range of the number of objects in The range of the number of objects in Class A that can or must be Class A that can or must be associated with each object of Class associated with each object of Class B.B.

A multiplicity is made up of:A multiplicity is made up of:– A minimum cardinality – the minimum A minimum cardinality – the minimum

number of Class A objects possiblenumber of Class A objects possible– A maximum cardinality – the maximum A maximum cardinality – the maximum

number of Class A objects possiblenumber of Class A objects possible

Page 24: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Relationship Relationship MultiplicityMultiplicity

Relationships can be:Relationships can be:

– One – to – oneOne – to – one

– One – to – manyOne – to – many

– Many – to – manyMany – to – many

Page 25: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Multiplicity notation is: min..max

Store stocks more than 1 videotape of a movie

1 instructor teaches 0-6 sections

Page 26: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Roles make it clearer to see which should be on the one side and which should be on the many side of the relationship.

0-1 supervisor manages0 to many subordinates

Page 27: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is an Associative What Is an Associative Class?Class?

A special purpose class that represents A special purpose class that represents an association (relationship) between an association (relationship) between classes and contains attributes and/or classes and contains attributes and/or relationships in its own rightrelationships in its own right

A many-to-many association that is A many-to-many association that is modeled as a separate classmodeled as a separate class

Represented as a class connected to Represented as a class connected to an association with a dotted linean association with a dotted line

Page 28: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

A Certificate represents a relationship between an employee and a course, and has an attribute pertaining to that relationship (dateCompleted)

Page 29: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Sometimes associative classes have their own relationships with other classes.

Page 30: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Types of AssociationsTypes of Associations

AssociationAssociation – no object is subordinate – no object is subordinate to any other.to any other.

AggregationAggregation – one class represents – one class represents the whole, and the other represents the the whole, and the other represents the part, but it is a loose coupling.part, but it is a loose coupling.

CompositionComposition – an aggregation with a – an aggregation with a tight coupling. The whole and the part tight coupling. The whole and the part cannot exist without each other.cannot exist without each other.

Page 31: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

The whole The part

Course registration needs at least 1 course and vice versa

Page 32: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

What Is Generalization?What Is Generalization?

A superclassA superclass – subclass– subclass relationshiprelationship in in which one class forms a broader category which one class forms a broader category in which the other class is a sub-categoryin which the other class is a sub-category

InheritanceInheritance – A subclass will inherit all – A subclass will inherit all the attributes and operations of its the attributes and operations of its superclass; an instance of the subclass superclass; an instance of the subclass contains all the same information (plus contains all the same information (plus more) as an instance of the superclass.more) as an instance of the superclass.

Page 33: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 34: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model
Page 35: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Multiple inheritance is complicated and not supported by all object-oriented programming languages.

Page 36: Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model

Any Questions?Any Questions?