and operations. A software toot ... a software tool that he LPS .... opera. t i on and. I is the name of a constraint of M. The. DtiA f~\us t i nc L ude. a n enforcement.
A
TOOL FOR MODULARDATABASE DESIGN Luiz Tucherman* Antonio L. Furtado** Marco A. Casanova***
*Latin American Systems Research Institute/IBM Brazil l *Pontificia Universidade CatGlica do Rio de Janeiro ***Brasilia Scientific Center /IBM Brazil
updated only by the operations defined in M, which corresponds to the usual not ion of encapsu la t ion LLZI . Hence, if the operations of each module M preserve consistency with respect to the i ntegr i ty constraints of M, the method introduces an effective way to guarantee logical consistency of the database. Yet, quer i es rema i n unrestra i ned in our method, just like in the trad i t iona 1 database design strategies.
ABSTRACT 6 database design method, based on the described. concept of modu Le, is first incorporates both a method The enforc i ng for integrity strategy tactic and a for constra i nts large sets of database organ i z i ng integrity constraints and structures, A software toot that operations. the deve lopn~ent and ma i ntenance helps of database schemas designed according then the method is specified. to prototype expert 5 y 5 t em Finally, a partial implementation of offering a the tool is described. 1.
Modular database design not a new is idea, but all references known to us lDMW,EKW,LMWW,SFNC,SNF,Wel tend to exp lore the principles, theoret i cd 1 and otherwise, of the method. We are, by contrast, interested in immediate applications of the idea.
INTRODUCTION
We discuss that he spec i fy following
this paper a software tool the database administrator maintain database schemas and a modular discipline. in
The des i gn of a database schema in our method consists of the success i ve addition of new modules to a (possibly empty) ker ne 1 database schema. But we also recognize that designing a database s c h em a is intrinsically an interactive process. The database designer frequently has to go back and alter the definition of a schema, either because the application evol.ves, or because his the application changes. percept ion of This understanding of the method led us to divide the development of the tool into two phases.
LPS
tool incorporates knowledge about a The database design method, first described prov ides structured that in LTCFI, the more trad i t i ona 1 descriptions of ex terna 1 concept ua 1 and of not ions Kelat ion schemes, i ntegr i ty schemas. and operat ions are grouped constraints into n\odules lPa,LZI and introduced in a that order LY fash ion structured, of the enhances the understandab i 1 i ty The method also dictates that database. the relations of a module M must be
In the
implementation phase, the incorporate a diet iondry to store mo d u I.a r description of provide database schemas and should facilities to an to add new mod II 1es ex i st i ng schema. A first prototype with in the these wr i t ten character ist its, extension of micro-PROLOG LHSI, is aties incorporates I* fully orerat iona 1. severd I. des i gn rules and offers a very capable of user-fr i end ly i nterfac:e administrator guiding database the stages of the through the var i ous definition of a module. toot
Pormieeion to copy without fee all or part of thie maGal ia granted provided that the copier are not made or dietributed for dinet cornmenU advantage, the VLDB copyxi& notice aad the title of the pubiication and ite date appear, and notice t given that copy. ing ie by permieeim of the Very Large Data But Endowment. To copy otberyiae, or to repnbliah, requires l fee and/or epecial permieeion from the Endowment. Proceedings of VLDB
85, Stockholm
436
initial should the
I n the second stage of development, the toot shou Ld account for database redes i gn. it should help the is, That DBA add, delete or modify the definition of objects of a modular database schema. The redes i gn is somewhat more process camp Lex, since it must necessar i Ly map d syntact i cd I. Ly correct schema satisfying all design requ i rements into another schema with property. As a the same consequence, the process must adequately cope with the prob Lem of the propagation of changes. the present time, the At set and stage is fully specified and the prototype is extended to cover be i ng database redesign.
of the Cartesian product of interpretat ions of Al,. . . ,An. OP is a set of operations over retat ion schemes in RS.
3.
A prifni defined
where s c h e ~IIe
prototype.
colistra
2.
MODULAR
L irli
tat
deta i led the technical LTFCI.
ions,
left to the paper
DATAEASE
quest
ion.
pi-ograslrn
notat
xn
and is
A ondulr where f .
2.
RS is that
is 5 0 01e
i ii Language.
i ng fCX4 ,...I 11a m e d
ion
operation Xl ,...t
negrdiipo
An
i n i t i on
a
set
XII):
f
body
s.
d
triple
of
relat
a procedure appi-opii ate
We will use s to indicate with parameters
M =
ion
schemes in RS have
interpretat
R LA< I..., Anl, indicating a x i. c! 0 ion of R must
the an
mod u Le statement
module M schemes constra ints operat i on5 enforcements endmod u L e
(1)
CN’
may of
they a set
be
without
(since
is
the these
relation integl-
i ty
comptetety omitted from
fixed by KS, CR’) and EN is r1ausr.s of the form 0 is the name of an the name of a is
enfnrrewrnt '0 eufnxes 1' where
opera t i on constraint
M=(RS,GN,OP) the form:
RS; CN’ ; OF’; EN;
CN
is
a x i 0 fr 5 i nts are
of
I
and of
M.
a
The DtiA f~\us t i nc L ude an enforcement c L a use whenever the ‘0 !2UfQLSeS 1’ definition of operation 0 takes into account constra i nt I. That is, whenever change to s 0 fll e definition of I the affects the definition of 0. This type of add i t i ona I. informat ion wilt be i nlportant in Sect ion 4 when we consider problem of redesigning the database the schema. The
rest
ta o d u 1 e
Sect can
ions be
of
the set t i on def i nes in deta i L, whereas and 2.4 indicate how they i tab Ly used database for
this
constructors
2.3 prof
design.
(RS,CN,OP)
two sctleeles 1-I0 same I-eLat ion ndf~le; C;N IS a set of ilitegli ty constl-a over the l-elation schemes in K’S. bl u ” t contain, f 01each retat
sc: h emp SsheKle
t ive by a
DESIGN
A LgldliQn scbewe is a statement of the w h e I- e RLAt ,...,Anl, R is f cl r RI the are the and At ,...,An rela1iQu naflle of the scheme. An inhsr.i.tr aJkrihutes statement of the form is a rnns~raiu~ where n is the Of the 11:G!, name we 1 t-formed constra i nt and is d B ovelrelation the SC: h emes in f or ill u 1 a def
the
A module may be either eL.imj.iiye, if it is defined without reference to any other modules, if it is or derived, defined from previously existing modutes one of the two module constructors, by aubswki.nn and exieosinn.
divided as The is fol tows. paper Section 2 describes the basic concepts the database design method. of Sect ion d i c t i onary to descr i be 3 defines a schemas. Section 4 database mod u 1 a Ispecifies the database design tool, with prob Lem of 01-I the emphas i5 special definition of modules. chang i ng the out 1 i nes the c u r r e 17t Section 5
space Due to were d i SC USC: i 0117; report version of
the
such the ints
CN ion
rf?lat.iQu that the be a subset
Let rnodu
Mi Les.
Cons
i der
first.
il
by
=
(RSi,CNi,OPi),
i=l
the subsutnp t i on if the Intuit ivety, subsumpf ion over ftlodules M faay contain new retat
,...,
n,
be
col-lst~uctc!l-
DEA
defines
. . ,Ml3, schemes, new corlstl-a irlts and ilitegli ty M always inherits all operations, and inteqli iy .sc hemes and i-e I.at i on the M also constraints of Mt,...,Mli. Opel- at i 01-1s of tit,... >MY\, i nher i t s a I. 1 hide some of these M 111 ay except that then new
opera
t i on.5
if
they
Hi,.
ion
viotate
a
new
Moreover, constra i nt . M contains all pertinent enforcement clauses just as in the definition of primitive modu Les. M1 I..., Mn Modu Les then become the inaccessible to users and can no 10 ll g e r participate in the definition of 11ew mod u Les. following 7 he module M by
M subsumes schemes constraints opera t i ons enforcements hidings endmod u le
(2)
module
where 1.
2. 3.
statement ruhsuoeij.nn
over
introduce opera t i ons on v i ews. But, to avoid the so-cd 1 Led view update prob Lem LFCI, the definition of M contains, for each view operation p, an imp Lementat ion in terms of the Opel-at ions of of P Ml ,..r,Mnr Unlike subsumpt ion, modul*s Mf ,...,Mn remain accessible after the definition of M.
defines a new MI,..,Hn:
MI,...,Mn RSOi CNO ; OPO j ENj HI i
4 new module M is defined over Hi ,...I Mn through the form:
with
(3)
: of l-e La t ion schemes is a set RSO re I.at ion name in RSO that no such two in Mi ,‘*a, Mn , and I30 occurs RSO s a me in have the schemes re la t i 011 name j is a set of (named) integrity CNO constraints over HSO,RS1 , . . . ,RS:lj is a set of OF’0 opera t i ons over
where 1. 2.
RSO,KSI,4a*,KSllj
4.
5.
is EN a set of enfnrrewenl clauses the form ‘0 eufmres I’ whel-e 0 of the name of an operation defined is is the name of a M and I in constraint also defined in Mj HI is a poss i b Ly empty set of hiding form of the ‘0 may. rlauseh where 0 is the uiolaie Ii,...,Ik’ name of an Opel-at ion of M i , for some in Li,nl, and I j is the name of a i defined in CNO, for each constra i nt We say that 0 is hidden j in Ll,kl. by M.
More defines 1. 2. 3.
the in statement M=(KS,CN,OY) whel-e
precisely, a module
RS is CN is OF’ is where Opel-at i =I , . .
the the the ioZi . , I1
union union union ’
of of isof
KS0 I..., RSn CNQ I..., CNll OF’O,OF’i ’ ‘-**I opi without h i dden in M,
3.
module
M extends schemes constra ints opera t i 011s using views surrogates endmod u Le
by ex~gn~j.n~~ a statement of
Mi ,..A,
Mn with
RSOj
CNO j OF’0 j VW; SRj
: the triple (RSO,CNO,OFO) defines a module M in the sense of Set t i on 2.i. VW conta ins, for each s c h em e RlAi ,...I Akl in KSO, a view the f 0 r ra defiuitinn maeeius of R(xi ,...,xk) : Q, where Q is a wet l-formed formu La with k free var i ab Les, ordered xt I..., over xk, RSI I..‘, RSn. SR conta ins, f0:each opera t i on f(Yi ,.*., y Ill ) : I- in OPO, d SlkkIk:C2QaltE! I which is an Opel-at ion of the form ym) : S over f(Yl I..., RSi,*.*,RSllj
The statement in (3) then defines a new nlodule M=(HSO,CNO,OPO) and coup Les M to Ml I..., nn through the pail(VW,SH). A view definition nlapping HLAI,...,AkJ: Q in VW indicates that Q defines H in ternls of the schemes of relation Ml I..., Mn. Hence, a query over R is trans La ted into a 9 ue r y over the relation schemes of Hi ,...I lln with the help of G!. Likewise, a surrogate f(yi,...,ym). 5 in SR descl- i bes an in inlplementation of f(yi,...,ym): r tel-ms of the Opel-at ions of Mi ,...I Mn . a call to procedul-e f generates an Thus, execution of 5, not l-.
(2)
OF'n'
all for
the definition of the We now turn to Informa 1 Ly, a extension constructor. Mn if rr o d u 1e modu Les Ml ,.L., M extends each retat ion scheme of M is a yiev over the relation schemes of Mi,...,Mn (that is, a l-elation scheme derived from those of Hi ,-.., Mn ) and each constraint of M is a logical consequence of those of Mn , views are tl-ea ted as Mi ,...I when pred i cate symbots. M may also def i ned
A modular database schema consists of a satisfy a ill us t set of mod u Les that se:- i es of design rules, which guarantee that if the database is updated only by the Opel-ations visible to the users, the state of the database will always remain
438
consistent. ronsirfenf their defined 1.
2.
More modular
precisely, daiahaae
arLi.ue condul12ta~is as
the set achemas recursively
of and
As for schemas,
design of modular database process we suggest follows c lose ly formal definition. The DBA adds new gradua 1 LY modules to an initially empty database schema. He must pay attention to two aspects: how to define a new modu Le and hnw to satisfy the design requirements (see Section 2.4 for an example).
follows:
consistent the emp t y set is d database s c h em a modu tar with a 11 empty set of sctivc modules; Let D be a consistent modular schema w i th act i ve modu Les database Let M be a module such that set A. no modu Le in D has the same name as Then is a H. D’ = D U (Ml database schema consistent modu tar iff M satisfies one of the following conditions: if M is a primitive module then a. requ i rement satisfy I M must at the end of (see Figure 2.1 the camp Lete set t i on for this 1 ist of requirements and a brief their meaning). exp Lana t ion of D’ is module set of The active A’ = A U (Ml is a modu Le ob ta i ned by if M b. extend i ng Hi , . . . , Mn then M must requirements 2,3,4,5. satisfy The active module set of D’ is A’ = A U (M) is a module obtained by if kl C. subsum i nq M$ , . . . , Mn then : relation names of the i) the new 1-e la t ion schemes def i ned M must be d i f f er en t f r om in the relation those Of schemes i n M’I , . . . , Mn. M must sat i sfy requirements 2)
To cone L ude this sect ion, we state theorem to the effect that the choice the design requirements suffices guarantee consistency preservation.
Let active r~nreeltual
module set - (M1 ,.--,
of Mn).
D’
Fiqure
modifies
Be~U.reoenf.-l.r a modu with constraints Th i s fundamenta database consistent
QK
of an module
List
of
Requirements
MODULES
each H must Le respect defined
opera t i on def i ned preserve consistency to a I. 1 inteyr in M.
requ i rement 1 preoccupation shou Ld always state LCCFI.
MODULES
Let
M
be
over i=i ,..r,n. new the constraints, definitions respectively,
ref
Lects that be left
in i ty
the the in a
D,
in principle access to all A user has modular database active modu Les of a al 1 relation see.5 schema. Hence, he constra i nts integrity schemes dlld but he can only in all modules, def i ned the active database using update the operations. He also freely query c an any relation scheme.
Rep u i remen
t
correctly
imp
I-
as
DEFINED
BY
EXTENSION
a module defined by extension Hi=(RSi,CNi,OPi), modu Les Let RSO,CNO,OPO,VW and SH be relation schemes, integii ty view operations, surroqa tes, and defined in M.
Beluirgoeniv2r surrogate in SR then of r LFCI.
eXi!i’KlUl
active, of
:
is
database schema with The set C of A. Of D is the subset of all primitive modules defined by modu Les set E of exiernal the set of a 11 modules An opera t i on in D. on
2.1
PRIMITIVE
D be a modular mod u Les set
A consisting of active and all subsump t ion; the D is &lQdUlfZS Of defined by extension P of D is arLi.ue, ‘ZQllLt?EtiWl opera t i iff p is a I1 l~espectivelyyrud 1 external concept
a of to
THEOREM 2. I LTCFI: Let D be a modular database schema. Suppose that D satisfies requirements I through 9. every Then, operat ion of D active preserves consistency w i th respect the to set of all constra i nts defined in modules of D.
6,7,8,9. active The A’ = A U (M,
the the the
and s must the views
if
of s
f(yl,...,ym): f(Yl ,.-., is a faithful
2
:
I-
is the defined
translation
that s in the sense that the same effect as far c:oncerned.
lewents have are
s ym)
guarantees
r
is a i f f (yl , . . . , Ym) : s in SF;, then s can defined va 1 ues of relation the on I.y (II o d i f Y Mn through calls to in Mi ,..-, schemes the operations defined in Mt , . . - ,Mn.
~g~vj.refijgl~~-3r. surrogate
439
guarantees Kequ i rement 3 that each preserves consistency with surrogate 5 to CNi since 5 updates respect the through schemes calls to opera t i 0nsOAf M1 ,i for each i=f , . . . , n.
irement 8 forb ids the DHA to define a new module M by subsuming a modu 1.e M i if there is a third mod u Le M’ that extends Mi . This requirement is necessary since it avoids the undes i rab Le situation where M subsumes Mi and yet M’ offers direct paths to the objects and operations of Mi. In fact, if Requirement 8 is violated, we cannot assure that ca 11s to operations of M’ will not violate constraints of M. Requ
each integrity Besuirewe~AAr for in constraint I CNO, I’ must be a logical consequence of the integrity constra ints of Mi I..., Mn, where I’ is obtained from each rep Lsc i ng I by atomic formula of the for 1 Fctti I..., tk) by QLti/xt tk/xkl, R LA4 I..*, Akl: 4 is‘^^;ke view where I? described in VW, and definition of free variables of Q is List of the k. Xi ,...,X Hequ i rement i ntegr i ty those of interpreted symbo t . constra i nts created by
4 constra Mi,...,Mn Th u:: c a I1 extension.
&suireweu1-51 modules of
must
be
avoids dcf ining view inactive operations, consistency.
opera t i on in with respect i nts in CNO.
mod u le PRODUCT schemes PHODl.P~,NAMEI constra i nts ONE-N: YpYnYn’(PROD(p,n) =)
the aga in of by
method by that stores warehouses warehouses. ju.st that and on
as
h PROD(p,n
)
n=n’)
opera t i ons ADDPKClD(p,n): PHOD(p,n’) h P%(p) h NAME(n) if ‘-In’ then insert (p,n) into PROD; DELPHOD(p) : delete PROD(x,y) where x=p; enforcements ADDPROD enforces ONE-.N; endmodu Le
OF to
&auiremgui-i’r
each operation in OPO can va 1 ues of relation mod i fy the cat 1s to in fli I . . . , Mn through schemes in Hi,. . . ,fln. the operations defined
on
t
We begin by creating a schema with one pi-imitive modu Le, PRODUCT, represents data about products the contains opera t i on.5 allowed products. PRODUCT is defined follows:
BY SUBSUMPTION
each consistency i ty constra
be
D
We wi 11 illustrate 0 ur designing a micro database i nforma t i on about products, and shipments of products to
active
Let M be a module defined by subsumpt ion Mi=(RSi,CNi,OPi), modu Les over Let RSO, 040, OPO, HI be the i=i ,...,n. i ntegr i ty relation schemes, ii e w h i dden operations, and constraints, operations, respectively, defined in M. CN be the union of 040, . . ..CNn and Let OPn’ , the union of OPO,OPi OF’ be ,-.., the set OPi , except for is where OPi ’ operations that were hidden by M, those for i=t ,*..,ll. BeluireweutAL preserves the i ntegr
must
Mn
of
--------------------------------------
D.
DEFINED
Mi ,..., modules
Rezu i rement 9 llot p e I- 01 i does subsumpt ion of externa 1 modu Les, to guarantee that all new operations and those of M, modules defined subsuming M, preserve consistency.
guarantees that the i nts of M fol low from when each view is a defined predicate red 1 Ly I10 new Loca 1 be defined in a module
Mt,...,Mn
Req,u i rement 5 opera t i on5 us i ng which may violate MODULES
Beiuiremd-Pi conceptual
1. y
Requirements guarantee preserves CM.
6 that cons
and each i stency
7 opera with
not must Be~uirewen~Ar D by extension mod u Le defined for some i in 11 ,113.
suffice t i on in respect contain using
The enforcement ADDPROD takes constraint ONE-N.
to OF to
c Lause into
indicates account
that the
modular database schema contains at The PRC)DUCT , module, this po i nt only one is obviously active. We then add which pr ini t ive module, WAREHOUSE, to another warehouses and the operations represent
a Mi,
440
on
warehouses. follows:
We define
WAREHOUSE
The modu tar database schema now has three modu Les, SHIPMENT, WAREHOUSE and PRODUCT, but only SHIPMENT is active. Note that SHIPMENT contains a 11 relation schemes and constra i nts of PRODUCT and WAREHOUSE, plus a newly defined relation scheme and three new constraints. The active opera t i ons (that is, those avai table to users) after the definition of SHIPMENT are: ADDSHIP, CANSHIF’, and CLOSE t DELF’RODI , defined in SHIPMENT, and ADDPKOD and OF’EN, i nher i ted from PRODUCT and WAREHOUSE, respectively. Since the operat ions DELPROD and CLOSE 111 ay violate constraints INC-P and INC-W of SHIF’MENT, respectively, ar e in they h i dden SHIPMENT. Hence, CLOSE and DELF’ROD are no longer visible to users.
as
module WAREHOUSE schemes WAREtiSELWO,LOCI constra i nts ONE..C : VwVcVc’(WAREHSE(w,c) & WAREHSE(w,c’) => C’C’) operat ions OF’EN(w,c): if ‘3c ’ WAREHSE(w,c’) h W+:(w) h LOG(c) then insert (w,c) into WAREHSE; CLOSE(w) : delete WAKEHSE(x,y) where x=w; enforcements OF’EN enforces ONE-C; endmodu Le modular database schema now has two The F’KODUCT and WAREHOUSE. active modules, We cant inue the design by defining a new introduces a that SHIPMENT, 111 o d u I.e , relationship, shipment, between products that a shipment warehouses. Note and and that product p requires (P,W) i ndeed Since the exist. warehouse w operat ions DELF’ROD and CL.OSE may violate we must define SHIPMENT this constraint, F’RODUCT and subsumpt ion over by WAREHOUSE and redef i ne I)EL.F’KOD and CLOSE appropriately:
Finally,
module
bywzxtending
the
constraints
extends SHIPMENT DELVRY LF'G, WC 1;
/*
(none)
mod u le
SHIPMENT:
DELIVERY
schemes
w i th
*/
opera t i on.5 DEL(p,w): delete DELVRY(x,y) where (x=p us i ns views DELVKY(p,w) : 38~ SHIF'(p,w,g) surrogates DEL(p,w): CANSHIP(p,w) endmod u Le
modu Le SHIPMENT subsumes F’RODUCT, W(IREt~OllSE w i th schemes SHIF’LF’I,W%,QTYl constra i nts ONE--G! : VpVwV~~Yu’(SHIP(p,w,~~) h SHIF'(p,w,q')
INC-F':
introduce
DELIVERY
h y=w)
The f ina 1 database schema therefore has two active modules, and SHIF'MENT DE:L.IVERY, and two other modules, PRODUCT and WAREHOUSE. Users have access to three base relation schemes (using traditional terminology), PRODlP+,NAMEI, WAREHSE LW+L.CK 1 , and sHIrtr=,w*,qTYi, and one view, DELVKYlY~,W~I. The active ADDSHIP, CANSHIP, opera t i ons a I- e ADDPROD, DELF’HUDI , OPEN, CLOSEi and DEL. A user has these access to any of operations, but note that a call to DEL the procedure associated with invokes c Lause of DEL in the sllrrQsa~es The procedure assoc iated w i th DELIVERY. DEL in the QeeraiiQur clause of DELIVERY just informs the user the meaning of DEL effect on the relation i ii t er- IRS of its scheme DELVRY.
=> q.=q') Vp(3w3-1 SHIP(p,w,q)
=> 311 F’ROD(p,n)) SHIF'(p,w,q) Vw(3p32 => 3c WAREHSE(w,c:)) opera t i ens ADDSHIP(p,w,q): if 3n F’ROD(p,n) h 3c WAHEHSE(w,c) h h QTY(q) ‘3q ’ StiIP(p,w,~~') then insert (p,w,q.J into SHIF’; CANSHJP(p,w): delete SHIF'(x,y,z) where (x=p h y=w); CL.OSEt (w): if ‘3p3*1 SHIF’(p,w,q) then CLOSE(w) j DELF’RODI (p): SHIF'(p,w,q) then DELPKOD(p); if ‘3w3q e n f 0 r c e rnP n t s ADDSHIF enforces ONE-Q, INC-F', INC-Wj CLOSE:i enforces INC-.W; DELPROD1 enforces INC-F'; hiding DELF’ROD may violate INC-F’; CLOSE may violate INC-W; end mod u 1e INC-W:
3. A DICTIONE4RY DEFINITION this a sect ion in We introduce that describes the obJects diet ionary constraints, and schemes, modules, and re La t i onsh i ps between opera t i ons induced by a mod u I.ar objects these
441
The conceptua 1 schema database schema . the dictionary will be described in of an entity-relationship model. terms of is not essential, we will it Although the dictionary contains that consider entities the and relationships on LY derived from a single modular conceptual It is schema D. a Lso important to observe that the state of the dictionary represent i ng database schema D a is deters i ned by the dec Larat ive fill LY of D (that syntax the modules of introduced in Sect ion 2), and vice-versa.
operat ion(Dame,def,surrogste) each operation 0 defined in a module of D corresponds to an entity of this The attributes are the name and type. the procedure defining 0, as well as the surrogate associated with 0, if 0 belongs to a module defined by ex ten5 i on, otherwise the value of surrfasaie is Dil. RELATIONSHIP
subsumes(module,module) and extends(module,module) the pair (M,N) will be in the set of t-e la t i onsh i ps 01of auubsumes type i ff M and N represent two eaieads modu Les such defined by that M is subsump t ion extension, or by respect ivelY, over N.
use B(Ai I.‘., AN) to indicate an We will named B whose list of entity type An; we wi 11 in turn attributes is Ai,..., K(E1 ,...I Em ) to descr i be a US(I whose n d me is R, relationship type, attributes, over the ent i tY w i thout named El ,A.., Em . Keys will be types whenever necessary. The under 1 i ned of the diet ionary, conceptua 1 schema with the intended together the ent i tY and interpretat ion of relationship types, is described below: ENTITY
is-scheme-def the pair relationships
ined-in(scheme,module) (S,M) wi 11 be in the of iff S is is=srheue=defi.nedrin of a scheme defined in M.
TYFCS
is-pr imi t ive(name), is-sub(name) and is-externaI.(natre) primitive, e i ther each module M, subsumpt ion or defined by defined by the modular conceptua I. extension, of D, c:orresponds to an entity of SC hema 0tis,erimiiiYe, is,auh type The only isz!2x..tf?cnal t respectively. attribute is the module name. module(nane) genera 1 i zat ion of only sets. The mod u 1e nd me .
the three attribute
TYPES
set
of type a name
is-constraint-defined-inIconstraint,ll~odule) (same, when I is constra M. 1
int
defined
is-operat ( s a me , M.)
ion
ion,moduLe) defined in
ion-def when
0
ined-incoperat is operat
in
is-view-over (scheme, scheme) the pair (V,S) wi 11 be in the set of relationships of type i.s=xi~wznye~: i ff V represents a whose view view def i n i t i on mapp i ng i nvo Lves scheme S. i s-constra i nt-over the pair (1,s) relationships
Cconstra i nt, scheme) will be in the set of of type i ff I represents a is=rQMfraiu~=QYer constra i nt whose definition involves scheme S.
previous is the
scheme(name, List,def) scheme R defined in a e a c:h relation D corresponds to an ent i tY module of The attr ibutes are the Of this type. the attribute List of f?, as n a me and well as the view definition mapping of to a module defined by H, if I? belongs value of the otherwise extension, attribute def is nil.
is-operat ion-over(operat ion,scheme) (0,s) wi 11 be in the set o.f the pair type relationships of iff 0 represents an iszQeera~iQll=QYer operation whose definition or whose opera t i on an surrogate (if 0 is def i ned introduced by in a mod u 1e extension) involves scheme S.
constraint(uame,def) each integr i ty constraint I defined in a module of D corresponds to an entity The attributes are the of this type. name and the defining formula of I.
enforces(operat ion,constraint) (O,I) will be in the set of the pair relationships of type enforces iff the operat ion 0 guarantees definition of not will be I constra i nt that violated.
442
may-violate(operation,constraint) the pailCO,11 will be in the set relationships type mar=uic&3le of 0 represents an operation which has that may violate constraint execut ion w 1. ca 11s (Opel-at the pair relationships represents definition a I1 operat introduced Opel-at ion
4.
REDESIGNING
definition transit
of
iff an
on
depends M.
direct
Ly
or
Changing the relationships between modu Les makes sense in only one case which we discuss in the rest of this sect ion. Recall that, by requirement 8, the DHA cannot define a new module M by subsum i nq a module M’ if there is a third module II’ that extends tl’ . Requirement 8 avoids the undes i rab Le situation where tl subsumes H’ and yet M’ offers direct paths to the objects and Opel-at ions of M’ . I 1-l fact, if requirement 8 is violated, we cannot that assure ca 11s to Opel-at ions of M’ wi 11 not violate constraints of M. on the other hand, rezu i rement 8 is too in strong severd 1 situations. For examp le, suppose that we let M subsume M’ as tons as iI does not hide any opera t i on used to define surrogates of the definition of H’ remains M’ . Then, val.id, provided that we consider that M’ now instead extends M, of M’. Since type of chanqe is quite useful, we this introduce a new mod u 1 e collstructor,
ion,operat ion) (O,O’) will be in the set of of iff 0 type rails operation an whose or whose surrogate (if 0 is in a i on def i ned modu Le extension) Cd 1 Ls by 0’.
DATABASE
ivelv
SCHEHAS
set t ion d i scusses i n genera 1 terms This the design tool should help the DBA how Sect ion 4.f l-edes i gn a database schema. addl-esses the prob tern of l-edcs igni ng the i nc 1 ud i nq modular structure of a schema, and delet ion of camp Lete i nsel- t i on the Sect ion 4.2 discusses the modu Les. the redesigning schemes, pl-ob Lem of operations and constraints, relationships of modules.
rf.l:ous
rubsuwetien.
We say Mi ,...I
that a module Mn iff:
1. module M to an ex ist ing new add a To DBA must database sc.hesla D, the mod u I. a lthe schemes , add successively constraints and operations of H, in this diet ional-y. The des i gn the ordel-, to guide the DBA in the then shou Id too 1 that he not does ver i f y i ng process, of the requirements 1 i sted any violate Sect ion 2.3. end of However, at the since we do not assume a genera 1 program detect i ng if a I1 capable of ver i f i ela constraint, or if opera t i on violates two Opel-at ions al-e equ ivs lent (for a set b l-equ i l-ements I , 2, variables), Of A genera 1 theorem enforced. cannot be also be needed to enforce wou Ld prover the DBA has to be Thus, requirement 4. trusted as far as these requirements go. infol-111 the DBA at most, The toot can, these requ i 1-ements must be obeyed. when 3, 5, 7, 8 and 9, l-equ i rements AS for depend on the current state since they diet ionary and 011 syntactic of the principle be cond i t i ens, they c a ii in verified without undue effol-t.
M subsumes in defined requirement
M strongly
Mi ,.a., Ml1 Set t i on 2, 8 is rep laced
su.bsurnes
exact
Beluireoent QLi H does not opera t ion p used to surrogate of any module any i=i folextends Mi, 2.
dictionary is changed extends nodule M’ that cons i dered to extend M, i=i,...,n.
the any
Ly
except by
as
that
hide any define a M’ that , . . . , Il.
so that Mi is now foleach
s t I- 0 I1 g subsump t i on i ndeed a Thus, is database schema in the change of the it introduces a new daub le sense that M and may change the def ini t ion modu Le of severa 1 other modules.
4.2
Eirdesisuius
Rhierb.
wi.1hi.n
Mad.u.J.ez
to help the DBIS insert, de Lete I I1 order definition of objects the III o d i f y 0 I‘ toot must modules, the des i gn within correctness of object ver i fy the def ini t ions and deterrr ine how changes on group of objects propagate to others. a focus ouldiscussion in this section We on the second problem.
deletion of a module N is quite The simp1.e to account for, since it suffices all objects defined in H and to delete del.ete a 11 modules M’ whose recursively
443
We first observe that fixing how changes propagate is must equivalent to determining a policy governing how propagate the updates through entity-relationship the d i agram of diet ionary. The policy we adopted is expressed as a set of detailed rules, in genera 1 it ref Lects a precedence but relation on objects as follows: 1.
2.
3.
attribute, WEIGHT, to the 1-e Lat ion scheme PROD. The design tool then beg ins stage 1 of step I of the redesign process UP in the diet ionary by Looking which schemes be affected by the may change 01-l PROD. Since there are no views defined on PROD, the tool proceeds to stage 2 where i t determ i nes wh i ch constraints ar e affected by the change on PROD. the Us i ng fol Lowing relationships involving PROD (that can be found in the state of the diet ionary descr i b i ng the schema in database ques t ion) :
the highest relation have schemes i fop 1 i es that a precedence, which relation scheme S is: affected by changes 011 a. never objects, if S is defined other module or a in a primitive modu Le defined by subsumpt ion; affected only by changes on the b. relation schemes S is defined if S is defined in a module on, introduced by extension; constra i nts have the second highest precedence, which that a i mp I i es constra i nt I only by is affected changes on: I a. the relation schemes is def i ned on; the constraints of the extended b. is defined in a modules, if I by extension mod u Le introduced (to satisfy requirement 4); Lowest operat i on.5 have the i w p 1 i es that an precedence, which Opel-at i on 0 is affected by changes on a.
b.
C.
and using the propagation rules, the des 9 n tool informs the DHA that he has to check the definition of the constraints ONE-N and INC-P. As s uIIIe that the DBA, when inspect in9 ONE-N, decides to modify its defining formuta to accornodate the new attr ibute WEIGHT of PROD and a Lso to reta in F’+ as a key of PROD. ALSO a s s u me that the DBA dec ides to modify definition of the INC:-mF' just to inc Luds a third argument into the occurrence PROD, of correspond i ng to the new attribute WEIGHT (these a I- e put-e LY syntact ica L that changes have to be introduced anyway).
:
Next, the design toot starts stage 3 of step 1. It first deters i nes how the changes defined on schemes and constraints propagate to the operations. Using the fo L Lowing d ic:t ionary relationships i IIVO Lv i ng F’ROD, ONE-N and
the the
schemes 0 i s def i necl on; constraints that 0 enforces 0tma y violates, 0 1the constra ints of the module where 0 is definedj the operations 0 calls.
It-K-F':
The redesign process is organ i zed in two The design tool begins the first s9t3x-i * step by asking the DBA to supply the set he wants to apply to the of changes schema, and then it takes ovelcurrent and he Lps DBA detect ful LY and the add i t iona L changes that must be spec i fy made to produce a new cons istent schema. This step is itsetf divided into rlaggz Dur i ng the second as exetapLified below. tool applies all the des i gn step, changes to the current schema.
ADDF’KOD
ADDSHIF' j+z:Qpgr&iQuzaygr ADDF'ROD eufoxres ONE-N ADDSHIF DELPROD1 DELF’ROD
EDfQLStZS el)fQLSftS
oar=riQlaie
PROD
FTiOD PROD
INC-F INC-F INC-F
rules, t he and using propaga t ion the that the DRG must des i gn tool detects ADDF'KCI D, check definition of the However-, DEL.PROD, ADDSHIP and DELF’RODI . the in conta i ned the i nforma t i on dictionary is not sufficient to disclose changes t he consequences of all Indeed , .s i nc: e spec i f i ed on constra i nts. ONE-N, of modu Le F’K’ODIJCT constraint, a the design tool must ask was mod i f i ed , if its enforcement now depends the DBA DELF’ROD. A the operat ion a l.so 0 I1 simi Lar remark app L ies to the operations
In
what we adopt the notation fol Lows, that there is a ‘Ei R E2’ to indicate b i n a I- y type R between rel.ationship of entities El and EZ in the current state of the dictionary. i ng to As an exdmp Le, referr in Section s c h e II,a defined that the DHA decides to
izzneecai.i.pu=gye):,
DELF’ROD iz=QeeraliQn=uYer
the database 2.4, suppose new add a
444
constraint when and CLOSEl , Assume that the is cons i dered. DBA decides that CANSHIP and CLOSE1 need not be changed.
suitable for micro-PROLOG. The key idea is to translate the state of the dictionary describing D (see Section 3) into a set of axioms. Each axiom wi LL be a ground atomic formula of the form ‘Ll iah L2’, where iah is a b inary predicate symbo 1 (infix notat ion is used) and Li and L2 are Lists.
CANSHIF
INC-Y
stage 3 by tool proceeds with The recursively usinq the calls relationship possible detect consequences of to The only such on opera t i ons . changes relationship in the dictionary involving DELPROD, ADDSHIP or DELPRODI ADDF’ROD, is:
The genera 1 format represent inq a relationship ((type)(type))
DELF’RODI
rallz
final set the inspected is be DELPRODI ADDSHIF' and prompts the DBA to supply wants to apply to Note that DELF’RODI since DEL.PROD, after the latter.
design tool enters step the Finally, if all resulting DPA asks the and are indeed sat isfactory and, changes creates a new sc:hecaa accord i ng I.Y. so, HELPER
Of modu vers for
((na~t~e)(na~l~e)(version))
FOR DATABASE
all entities, only those designating Les are represented in the present ion An axiom standing of the tool. a modu Le has the fol Lowing format :
(mod)
tab
where subsumpt
((name) (kind) ion,