Академический Документы
Профессиональный Документы
Культура Документы
Didier DONSEZ
Universit de Valenciennes
Institut des Sciences et Techniques de Valenciennes
donsez@univ-valenciennes.fr
Motivations
Modle Relationnel
modle de base pour les SGBDs relationnels
>70 % des applications SI
thorie de la normalisation
suppression des redondances
mais il faut dterminer toutes les dpendances fonctionnelles
Concepts de Base
numss
nom
Suivre
adresse
anne
Cours
code
titre
heures
E/A, et BDRel 3
Les Cls
Cours
formation intitul
salle
Cours
heure
formation intitul
salle
heure
E/A, et BDRel 4
Choisir une Cl
Relle
Attribut seul ou composition d attributs
doit toujours tre renseign (NOT NULL)
Artificielle
introduction d un attribut artificiel n appartenant pas au
systme dcrit.
performance en comparaison
compacit du stockage
souvent employ pour les bases dcisionnelles
E/A, et BDRel 5
Many-to-many
N-M
0,n - 0,n
A
One-to-one
1-1
0,1 - 0,1
Many-to-one
N-1
0,n - 0,1
A
B
E/A, et BDRel 6
Associativit Many-to-One
Encadrant
de Stage
Etudiants
Enseignants
E/A, et BDRel 7
Association n-Aire
Plusieurs entits peuvent participer la mme associations
Etudiants
numss
nom
Enseigne
adresse
TDs
codcours
titre
coef
Assistants
numemp
nom
bureau
E/A, et BDRel 8
Modle Entit-Association
Entity-Relationship Model
Etudiants
Suivre
Cours
anne
Etudiants
Suivre
Cours
Anne
anne
E/A, et BDRel 9
Ami
pouse
Personne
Personne
poux
pouse
Joseph
Sanson
Marie
Dalida
1
Pierre
Paul
2
Paul
Jean
E/A, et BDRel 10
Machines
nom
Machines
nom
Domaines
Secondaires
nom
Domaines
Primaires
nom
nom
E/A, et BDRel 11
EAT
Etudiant-EAT
Assistant-EAT
TDs-EAT
Etudiants
Assistants
TDs
numss
nom
adresse
numemp
nom
bureau
codcours
titre
coef
E/A, et BDRel 12
Les Sous-Entits :
l extension aux concepts orients objet
Exemple
Les Cadres sont un type particulier dEmploys
Super
Entit
nom
Employ
numemp
salaire
Sous
Entit
Cadre
objectif
E/A, et BDRel 13
Formalisation Conceptuelle
M.C.D.
M.C.T.
Formalisation Organisationnelle
M.O.T.
M.L.D.
Formalisation Oprationnelle
M.O.P.T. Modle OPrationnel des Traitements
M.P.D.
Modle Physique des Donnes
E/A, et BDRel 14
A
ca, aa
x',y'
rr
cb, bb
Employ
nemp
nom
sal
Service
1,N
1,1
nom
adr
Cardinalits
dans Merise
x=0, y=1
au plus 1 fois
x,y
A
ca, aa
x=0, y=N
x,y
R
rr
x=1, y=1
1 et 1 seul fois
B
cb, bb
x=1, y=N
au moins 1 fois
x=0
y=1
x=0
y=N
x=1
y=1
x=1
y=N
E/A, et BDRel 16
nemp
nom
sal
Relation d hritage
Sous-Classe
Employ
Employ
Super-Classe
Cadre
Ouvrier
prime
Cadre
equipe
Ouvrier
prime
equipe
Association
Didier Donsez, 1998,2000
Projet
nom
budget
Employ
1..*
0..*
nemp
nom
sal
Fonction
Service
1
1..*
nom
adr
Association
fonction
volhoraire
Classe-Association
E/A, et BDRel 17
Interprtation
comme E/A
Employ
Service
1..*
nemp
nom
sal
Equivalence
nom
adr
Cardinalits
EA
Multiplicits
UML
0,1
0..1
1,1
1 ou absence
0,N
1,N
0..* ou *
1..*
N,N
N..N
E/A, et BDRel 18
But
Implantation du modle E/A sur un SGBD rel
Mthode
transformation
des associations n-aires en associations binaires
1 entit = 1 relation
1 association = dpendant de sa cardinalit
E/A, et BDRel 19
N-M
FUHDWHWDEOH$
NDDD
SULPDU\NH\ND
ka
aa
...
...
aa
cc
kb bb
ka
kb
cc
...
...
...
FUHDWHWDEOH5
NDNEFF
SULPDU\NH\NDNE
IRUHLJQNH\NDUHIHUHQFHV$
IRUHLJQNH\NEUHIHUHQFHV%
kb bb
...
...
FUHDWHWDEOH%
NEEE
SULPDU\NH\NE
E/A, et BDRel 20
N-1
ka
aa
...
...
aa
cc
kb bb
ka
kb
cc
...
...
...
ka
aa
kb
cc
...
...
...
...
kb bb
...
...
kb bb
...
FUHDWHWDEOH$
NDNEDDFF
SULPDU\NH\ND
IRUHLJQNH\NEUHIHUHQFHV%
FKHFNFF,618//
25NE,612718//
...
FUHDWHWDEOH%
NEEE
SULPDU\NH\NE
E/A, et BDRel 21
ka
aa
...
...
aa
R
cc
kb bb
ka
kb
cc
...
...
...
kb bb
...
...
1-1
ka
aa
kb
cc
...
...
...
...
ka
aa
...
...
kb bb
...
...
kb bb
ka
cc
...
...
...
...
E/A, et BDRel 22
rle 2
A
aa
aa
...
...
FUHDWHWDEOH$
NDDD
SULPDU\NH\ND
rle1
ka
ka
cc
krole1 krole2 cc
...
...
...
FUHDWHWDEOH5
NUROHNUROHFF
SULPDU\NH\NUROHNUROH
IRUHLJQNH\NUROHUHIHUHQFHV$
IRUHLJQNH\NUROHUHIHUHQFHV$
ka
aa krole2 cc
...
...
...
Rle Symtrique
et One-to-One
...
E/A, et BDRel 23
A
ka
aa
cc
kb bb
ka
aa
kb
cc
...
...
...
...
FUHDWHWDEOH$
NDNE
DDFF
SULPDU\NH\NDNE
GLIIpUHQWGXFDV1WR
IRUHLJQNH\NEUHIHUHQFHV%
kb bb
...
...
FUHDWHWDEOH%
NEEE
SULPDU\NH\NE
E/A, et BDRel 24
Exercices
de transformation E/A vers Relationnel
Exercice 1
transformez les cas de l entit faible avec 3 tables A,
B, R
Exercice 2
transformez le schma suivant
attention l ordre des noms
Machines
nom
Domaines
Secondaires
nom
Domaines
Primaires
nom
E/A, et BDRel 25
Exercices
de transformation E/A vers Relationnel
Exercice 3
transformez le schma suivant
#client
Client
Prfre
nom
Date
date
Produit
#serie
sav
Modle
#mod design
cc
Marque
#mar
nom
E/A, et BDRel 26
Cadre
sal
prime
1Emp nemp
100
200
nom
Cadre nemp
sal
Dupond
Durant
5000
20000
200
prime
10000
&DGUHQHPSHVWXQHFOppWUDQJqUHVXU(PS
2 - Push down
Emp nemp
100
nom
Cadre nemp
sal
Dupond
5000
200
nom
Durant
sal
prime
20000
10000
&,^(PSQHPS`^&DGUHHPS`
E/A, et BDRel 28
Cadre
sal
prime
3 - Push Up
Emp
nemp
nom
100
200
Dupond
Durant
sal
5000
20000
prime
NULL
10000
E/A, et BDRel 30
Inconvnients
Emp typemp
EMP
CAD
Cadre
sal
nemp
nom
100
200
Dupond
Durant
prime
sal
5000
20000
prime
Emp typemp
NULL
10000
EMP
CAD
(PSW\SHPSHVWXQHFOppWUDQJqUH
&,(PSW\SHPS (03SULPH 18//
Emp typemp
EMP
CAD
nemp
nom
100
200
Dupond
Durant
sal
5000
20000
prime
NULL
10000
'RPDLQHW\SHPS&'W\SHHPS,1(03&$'
&,(PSW\SHPS (03SULPH 18//
E/A, et BDRel 33
Entit Abstraite
prime
Ouvrier
equipe
Employ
nemp nom
Emp typemp
OUV
CAD
sal
nemp
nom
100
200
Dupond
Durant
sal
5000
20000
prime
NULL
10000
equipe
Nuit
NULL
'RPDLQHW\SHPS
&'W\SHHPS,1289&$'
L volution de Schma
Inconvnients
Ajout d une sous entit Dirigeant
Employ
nemp
nom
Cadre
sal
prime
Dpartement
Impacts
Dirigeant
sur le schma
sur les contraintes d intgrit
sur les contraintes de domaines
sur les traitements
Transformation E/A
vers l Objet-Relationnel
But
Implantation du modle E/A
sur un SGBD Objet-Relationnel
Fonctionnalits disponibles
pour les Sous-Entits
Hritage de Type et Hritage de Table
Cas gnral :
Association Many-to-Many (i)
A
ka
Many-to-Many
N-M
ka
aa
...
...
FUHDWHW\SHW$DVREMHFW
NDDD
FUHDWHWDEOH$RIW$
SULPDU\NH\ND
aa
cc
kb bb
ra
rb
cc
...
FUHDWHWDEOH5
UD5()W$UE5()W%
FF
SULPDU\NH\UDUE
6&23()25UD,6$
6&23()25UE,6%
kb bb
...
...
FUHDWHW\SHW%DVREMHFW
NEEE
FUHDWHWDEOH%RIW%
SULPDU\NH\NE
E/A, et BDRel 39
Cas gnral :
Association Many-to-Many (ii)
A
ka
Many-to-Many
N-M
aa
ka
aa {rbs}
...
...
kb bb
kb bb {ras}
...
FUHDWHW\SHW%DVREMHFW
FUHDWHW\SHW$DVREMHFW
NDDD
UEVYDUUD\RI5()W%
FUHDWHWDEOH$RIW$
SULPDU\NH\ND
$WWHQWLRQjODPLVH
jMRXUGHVOLVWHVGHUHIV
!ULVTXHGLQFRKpUHQFH
...
FUHDWHRUUHSODFHW\SHW%
DVREMHFW
NEEE
UDVYDUUD\RI5()W$
FUHDWHWDEOH%RIW%
SULPDU\NH\NE
E/A, et BDRel 40
Cas gnral :
Association Many-to-Many (ii)
A
ka
Many-to-Many
N-M
ka
aa
...
...
FUHDWHW\SHW$DVREMHFW
NDDD
FUHDWHWDEOH$RIW$
SULPDU\NH\ND
aa
kb bb
3ULYLOpJLHXQVHQV
GHQDYLJDWLRQ%YHUV$
kb bb {ras}
...
...
FUHDWHW\SHW%DVREMHFW
NEEE
UDVYDUUD\RI5()W$
FUHDWHWDEOH%RIW%
SULPDU\NH\NE
E/A, et BDRel 41
Cas gnral :
Association One-To-One
A
ka
One-To-One
1,1
ka
aa
...
...
R
aa
rb
FUHDWHW\SHW%DVREMHFW
FUHDWHW\SHW$DVREMHFW
NDDDUE5()W%
FUHDWHWDEOH$RIW$
SULPDU\NH\ND
6&23()25UE,6%
B
kb bb
kb bb
...
ra
...
FUHDWHRUUHSODFHW\SHW%DVREMHFW
NEEEUD5()W$
FUHDWHWDEOH%RIW%
SULPDU\NH\NE
6&23()25UD,6$
E/A, et BDRel 42
Bibliographie
Roger Mounyol, "Merise par l'Exemple", Ed Ellispes, 1991, ISBN 2-72989114-5 (T58.5 MON)