Docsity

ER Diagrams and Extended ER Modeling: Notations, UML, and Database Design, Lecture notes of Law

Partial preview of the text

Download ER Diagrams and Extended ER Modeling: Notations, UML, and Database Design and more Lecture notes Law in PDF only on Docsity!

Relational Database Systems 1 Database Systems 1 Silke EcksteinBenjamin Köhncke Institut für InformationssystemeTechnische Universität Braunschweigwww.ifis.cs.tu-bs.de

3 Extended Data Modeling• Alternative ER Notations • Extended ER – Inheritance – Complex Relationships – Complex Relationships • UML

Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

-^ Crow’s foot

notation was initially developed by

3.1 ER – Crow’s Foot NotationGordon Everest – Derivate of 3.1 ERD notation – Main Goal Main Goal • Consolidate graphical representation • Provide a better and faster overview • Allow for easier layouting – Widespread use in many current tools anddocumentations^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

EN 3.

3.1 ER – Crow’s Foot Notation• Entity Types – Entity Types are modeled with a named box – Attribute names are written inside the box separatedby a line^ Key attributes are marked with a leading asterisk • Key attributes are marked with a leading asterisk • Composite attributes are represented with indentation

Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig isbn^ Book EN 3.

firstName author lastName title

Book* isbnauthorfirstNamelastNametitle

3.1 ER – Crow’s Foot Notation

owns Person^

Cat (0, *)^

(1, *) Person^

Cat owns Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

-^ What happens to n-ary relationships orrelationship attributes?EN 3.

*^

supplies Supplier^

Costumer number^ *^ Part

-^ Problem^ –^ N-ary relationship types

are not supported

by

crow’s foot notation, neither are relationshipattributes • Workaround solution

3.1 ER – Crow’s Foot Notation • Workaround solution

-^ Intermediate entities

must be used

-^ N-ary relationships are broken down in a series of

binary

relationship types anchoring on the intermediate entity^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig RA C B

RA Ra

RCB^ R^ Bc

-^ Originally, ER diagrams were intended to be usedon a^ conceptual

level

-^ Model data in an abstract fashion

independent

of

3.1 ER – Crow’s Foot Notationimplementation Crow’s foot notation sacrifices some conceptual • Crow’s foot notation sacrifices some conceptual expressiveness – Model is closer to the

logical^ model (i.e. the way the data is later really stored in a system) – This is^ not

always^ desirable

and may obfuscate the intended semantics of the model^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

3.1An example (cf. last week) Student

Professor

registration registrationnumber^ number^ name

id name department

attends^

teaches instantiates day of day ofweekweek time room^ semester Lectureinstance N^1

N^

1

N 1 Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig title^

credits id^ Lecture Course ofStudy enrolls

prereq. part of curriculum curriculumsemestersemester name N N N N N N

-^ Barker’s notation^ –^ Based on Crow’s Foot Notation^ –^ Developed by Richard Barker for

Oracle’s CASE

3.1 ER – Even more notations…modeling books and tools in1986 – Cardinalities are represented differently – Cardinalities are represented differently • (0, 1)^ : Zero or one • (1, 1)^ : Exactly one • (0, N)^ : Zero or more • (1, N)^ : one or more • Cardinalities position similar to Crow’s Foot notation andopposite to classic ER – Different notation of subtypes^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

3.1 ER – Even more notations…• Black Diamond Notation – Cardinalities are represented differently • Cardinality annotation per relationship, not per relationshipend • 1:

(^11)

-^ 1:1 •^ 1:N •^ N:M – Also, N-ary relationships possible •^ ternary^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

(^1) N NM (^1) N 1

3.2 Extended Data Modeling• However, in the late 70s, popularity of DBsextended into fields with more complicated data formats – Computer-aided design and manufacturing (CAD/CAM) (CAD/CAM) – Geographic information systems (GIS) – Medical information systems – … • Expressiveness of ERD is not sufficient

here Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

-^ Extended entity relationship (

EER) models

provide many additional

features

for

more accurate

conceptual modeling

3.2 Extended Data Modeling – Refinement of relationship types^ Specialization and generalization • Specialization and generalization • Class, subclass, and inheritance – Entity sets with existence dependencies – Extended modeling of domains and constraints • Extended ER contains all features of “classic” ER^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

-^ Solution:

Subclasses

and^ superclasses

-^ A^ subclass

entity type

inherits

all attributes and

constraints from its

superclass

entity type

3.2 Subclasses / Superclasses – Subclasses may add additional attributes, – Subclasses may add additional attributes, constraints or relationship types – In EER, subclass relationship typesare annotated with an open arc,which is opened to the super class(think of set inclusion) – Describes an “is-a” relationship^ Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

id^ Secret Lair name^ staffcapacity^ stylefactor Secret SpaceStation^ orbital massspeed Secret Island Lair^ Climate locationzone

-^ Subclass entity types

represent subsets of the

entity set of the superclass’ entity type^ –^ That is, an entity which is contained in the subclass isalso contained in the superclass^ –^ In particular, no entity can

only^ exist in a subclass set

3.2 Subclasses / Superclasses – In particular, no entity can

only^ exist in a subclass set Relational Database Systems 1 – Wolf-Tilo Balke – Institut für Informationssysteme – TU Braunschweig

Secret Lair e1 e4e2e3 e6e Secret Lair Secret SpaceStation

Secret SpaceStation