unit 3 conceptual data modeling. key concepts conceptual data modeling process classes and objects...

40
Unit 3 Conceptual Data Modeling

Upload: scot-cooper

Post on 03-Jan-2016

237 views

Category:

Documents


3 download

TRANSCRIPT

Unit 3

Conceptual Data Modeling

Key ConceptsConceptual data

modeling processClasses and objectsAttributesIdentifiers, candidate

keys, and primary keys

Multivalued attributes

Composite attributesRelationships

Unary, binary, and ternary relationships

Cardinality and multiplicity

AssociationsAggregation and

compositionComposite structure

diagramsGeneralization

What Is a Conceptual Data Model?A detailed model that shows the overall

structure of organizational dataIndependent of any database management

system or other implementation considerations.

Represented by UML class diagrams

Use cases are key inputs to conceptual data modeling.

Conceptual model sets the stage for more detailed model, and ultimately system design

Conceptual Data Model ElementsClassesAttributesIdentifiersAssociations, aggregations, compositionsGeneralizationsTime dimensionsIntegrity rulesSecurity controls

What Is an Object?An entity that encapsulates data and

behaviorProductEmployeeOrderLine item

Class – a set of objects that share the same attributes, operations, relationships, and semantics (abstract)

Instance – a single object (concrete)

Class

Instances

What is an Attribute?

A named property of a class that describes a range of values that instances of the attribute may hold

UML Class symbol has three parts:

1) Name2) List of attributes3) List of operations

Types of Attributes

Stereotypes in Class DiagramsStereotype – a construct that extends the

UML vocabularyExamples:

Identifier stereotype <<PK>> for primary key

Multivalued stereotype <<multivalued>>Derived stereotype <<derived>> for values

calculated based on other attributes

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

Identifiers and KeysIdentifier – 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

Choosing a Primary Key

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

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

What Is a Relationship?A semantic connection between objects of

one or more classesIn UML, represented as a line connecting

two or more class boxes (or connecting one class to itself)

Roles identify the purpose of each class in the relationship.

What Is Relationship Degree?The number of classes that participate in a

relationshipMain 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

Unary relationships exist between instances of the same class

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

Note: a ternary relationship is not the same as three binary relationships. It is a relationship that links three separate classes simultaneously.

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 possibleA maximum cardinality – the maximum

number of Class A objects possible

Relationship MultiplicityRelationships can be:

One – to – oneOne – to – manyMany – to – many

Multiplicity notation is: min..max

This shows that one movie can be stocked as any number of videotapes, or none at all

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

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

What Is an Associative Class?A many-to-many association that the data

modeler chooses to model as a classParticularly useful if the association

contains attributes of its ownRepresented as a class connected to an

association with a dotted line

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

Sometimes associative classes have their own relationships with other classes.

Types of AssociationsAssociation

No object is subordinate to any other.Aggregation

One class represents the wholeThe other represents the partIt is a loose coupling

CompositionAn aggregation with a tight coupling. The whole and the part cannot exist without

each other.

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)

What Is a Composite Structure 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 interrelated parts

Useful to reduce clutter in diagrams with many associations

Introduced in UML 2

Generalization and Inheritance

Generalization InheritanceA superclass –

subclass relationship in which one class forms a broader category in which the other class is a sub-category

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.

Inheritance is an “is-a” relationship

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