You are on page 1of 18

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Data Modeling

From Conceptual Model to DBMS

All material (c) Sparx Systems http://www.sparxsystems.com

Sparx Systems !"##

Page:#

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

$a%le of &ontents
INTRODUCTION....................................................................................................................................3 MODELIN ! FROM CONCE"T TO STRUCTURE.........................................................................3 'EVE'S () A*S$+A&$,(- ,- DA$A M(DE',-. ................................................................................................/ 1.Conceptual Model..........................................................................................................................5 2.Lo ical Model................................................................................................................................! ".#$ysical Model..............................................................................................................................% 0(+1,-. 0,$2 DD' S&+,P$S....................................................................................................................3 A4$(MA$,-. '(.,&A' $( P25S,&A' 6M(DE' $+A-S)(+MA$,(-S7................................................................#" +E'A$,-. DA$A*ASE S&2EMAS $( $2E M(DE'...........................................................................................## RE#ERSE EN INEERIN ! $E#OL#IN % & STRUCTURE........................................................'3 &elatin to &e'erse()n ineered Code............................................................................................1" A*stractin to Lo ical Le'el...........................................................................................................1" Comparin +e, and -ld Structures...............................................................................................1. CONCLUSION.......................................................................................................................................'( D*MS DA$A $5PES:...............................................................................................................................#8 D,A.+AM +EP+ESE-$A$,(-S.....................................................................................................................#8 DA$A D,&$,(-A+5..................................................................................................................................#9 LOSS&R)............................................................................................................................................'*

Sparx Systems !"##

Page:!

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Introduction
Enterprise Architect supports comprehensi:e functionality for modeling data%ase structures. $his paper co:ers the core features for data modeling o:er the full lifecycle of an application. ,nitially; we discuss the %asic modeling process < that is outlining a conceptual model and then wor=ing through the steps to form a concrete data%ase schema. 0e will then loo= at re> engineering or ?e:ol:ing@ an existing data%ase schema for software :ersion updates or porting to a new D*MS. Data%ase modeling can %e performed using different notations. $he notations Enterprise Architect supports includeA a 4M' Profile for DD'; Entity +elationship Diagrams 6E+D7; ,DE)#B and C,nformation EngineeringD. )or the purpose of this document we will focus on the 4M' profile for DD'; %ut include examples using the E+D notation. -ote: )or a clearer o:er:iew on how to use the 4M' Profile for DD' modeling in Enterprise Architect; see the Data%ase Modeling in 4M' paper.

Modeling! From Concept to Structure


Levels of Abstraction in Data modeling
De:elopment of systems typically in:ol:es numerous le:els of a%straction. $hese range from formal reEuirements modeling; 4se &ase modeling through to &lass definition etc. Data%ase modeling traditionally includes a well esta%lished three tiered approach: #. Conceptual Le'el < this documents the %asic entities of a proposed system and relationships %etween them !. Lo ical Le'el < this specifies entities and their relationships without implementation details /. #$ysical Le'el < this defines the data%ase structure for a technology specific format 6a D*MS7 $hese define the core stages in the design process of a data%ase. $he models at each of the three le:els of a%straction correspond to Model Dri:en Architecture 6MDA7 concepts. MDAFs &omputation ,ndependent Model 6&,M7; Platform ,ndependent Model 6P,M7 and Platform Specific Model 6PSM7 relate to the &onceptual; 'ogical and Physical models respecti:ely. 2ow you can use MDA transformations with data modeling and DD' generation are co:ered in more detail %elow.

Sparx Systems !"##

Page:/

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Conceptual

Version 1

Version 2

Logical

Physical MDA Transforms

DBMS

DBMS 1

DBMS 2

Figure '! Flo+ t,roug, t,e le-el. o/ modeling a data0a.e.

-ote: 0hen wor=ing with a 4M' modeling tool there are strong parallels to defining the &lass structure and the Data model. $he 4M' concept of &lasses with Attri%utes relates directly to Entities and their Attri%utes at the &onceptual le:el; and to $a%les containing )ields on the Physical le:el.

Sparx Systems !"##

Page:G

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

*elow is a summary of the data modeling aspects addressed at the &onceptual; 'ogical and Physical le:els. $he ta%le also indicates which parts of the model can %e deri:ed %y an MDA $ransformation from the 'ogical model to Physical model. Conceptual Entities Entity +elations Attri%utes &lass -ames &lass Attri%utes &lass &onnectors $a%le -ames &olumn -ames &olumn $ypes Primary 1eys )oreign 1eys Stored Procedures Views $riggers H &onstraints
4n>typed

Logical

",3.ical

MDA $ransform

4M' $yped


D*MS $yped

Figure 1! Conceptual2 Logical and ",3.ical modeling

#. &onceptual Model
$he purpose of a &onceptual model is to simply esta%lish the Entities; their Attri%utes and their ?high>le:el@ relationships. 0hen modeling using 4M'; the Domain Model is used to define the initial structural layout 6later to %e used for &lasses7. 0here the &lass design is parallel to the data structure design; it is sensi%le to use the Domain model as a seed for the &onceptual model. At the conceptual le:el there is little detail. $he diagrams consist %asically of Entities and their simple relationships. ,f there are Attri%utes defined; these are loosely typed 6for example > no length settings7; and connectors %etween Entities do not define relationships to specific Attri%utes. )igure / %elow is an example of a simple &onceptual diagram for an (nline *oo=store.
e nti ty Transaction ! ""# 1 e nti ty Account en ti ty Order 1

1 ""# !""#

e nti ty Stock Item 1 1""# ! ""# e nti ty Line Item

1 1 e ntity !""# ShoppingBasket 1

1""#

Figure 3! Conceptual Model Diagram. u.ing UML to model t,e Online Boo4.tore

Sparx Systems !"##

Page:8

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Enterprise Architect supports two different approaches for data models: 4M' &lass diagram 6DD'7 Entity +elationship Diagram 6E+D7 4sing 4M' &lass modeling; the &onceptual model consists of defining the data entities as an Element of type C&lassD. $hese &lasses can later include internal Attri%utes; whereas with E+D %ased modeling Attri%utes are defined as related Elements 6the Attri%utes are external to the Entities7. )igure G shows the (nline *oo=store &onceptual model in E+D notation.

T ran sactio n

! ""#

% r&e r

S toc'$te m

!""#

! ""#

1 ""#

! ""#

A cco un t

! ""#

S ho pp in gB as'et

1 ""#

L in e$tem

Figure (! Conceptual model u.ing ERD to model Online Boo4.tore

!. 'ogical Model
$he 'ogical model includes more detail; specifically Attri%utes; %ut the modeling is still generic as it is not %ound to a specific D*MS. $he process of creating a 'ogical model %ased on a &onceptual model in:ol:es: > Setting t,e &ttri0ute. At the 'ogical le:el; the attri%utes 6which later %ecome $a%le &olumns7; are modeled independently of any D*MS product. $hey are typed using primiti:e 4M' data types; such as integer; %oolean and string.I7. Setting t,e Relation.,ip. At the 'ogical le:el we do not yet set the Primary 1eys H )oreign 1eys etc. At this le:el it is %est to :erify and adJust the &onnector ?multiplicity@ 6also =nown as ?cardinality@ in data%ase terminology7 details that were set earlier for relationships in the &onceptual model.

>

)igure 8 is a diagram of the 'ogical model deri:ed from the &onceptual model in )igure /.

Sparx Systems !"##

Page:9

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Transaction ( ( &ate )&ate am o untPai & )integer (history ! ""# 1 !""# (account 1 (a ccount !""# ( ( ( ( Order &a te )&ate &e li*ery$n structio ns )string or&er+um ,er )in tege r status )inte ger ( ( ( ( (

StockItem author )string catal og+um ,e r )char costPrice )n um ,e r l istPrice )num ,er title )string 1 !""1 1 1""# ( LineItem -uantity )integer 1 ""# (,as'et !""# ShoppingBasket ( shoppingB as'et+um ,e r )string 1

Account ( ( ( ( ,i ll in gA&&re ss )stri ng &el i*eryA&&ress )stri ng em ailA&&ress )strin g nam e )string 1

Figure 5! Logical model o/ t,e Online Boo4.tore u.ing UML

)igure 9 shows an eEui:alent model of the Account and $ransaction elements using an Entity +elationship Diagrams 6E+D7. $he Entities do not contain attri%utes; rather the ?ta%le> columns@ are represented as ellipses connected to the Entity. $he Entity relationships are represented as diamond>shape connectors.
nam e

, il li ng A & & re ss

A cco u n t 1 e m a il A& & re ss ! ""#

T ra n sa ctio n

& e l i*e ryA& & re ss & a te o r& e r+u m , e r

cl o se &

Figure 6! Logical diagram u.ing ERD 7/or account 8 tran.action9

/. Physical Model
Modeling on the Physical le:el in:ol:es adding Cplatform specificD detail to the model. $hat is; detail specific to the D*MS where the data%ase is to %e deployed. )or more detail on manually setting the definition of the Physical data%ase model using DD' diagramming see the paper on Data%ase Modeling in 4M'. Sparx Systems !"## Page:K

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

$o set up the Physical model you can create a copy of the 'ogical Model and start the process of adding the Physical definitions to this model. $he =ey aspects of this are: . )or each ?&lass@: o $he Stereotype must %e set to ?$a%le@. o $he Data%ase setting must %e set to a specific D*MS. )or more information see: 0or=ing with $a%les. o 4pdate the Attri%utes to reflect &olumns ?$yped@ to the specific D*MS )ield types. )or more information see: &reate &olumns. . Add more detail to the &onnectors 6relationships7; to define the Primary 1ey 6H )oreign 1ey7 lin=ing. )or more information see: Data%ase 1ey. -ote: All of the a%o:e Physical le:el additions and alterations can %e automated using an MDA transformation from a 'ogical model. See ?Automating 'ogical to Physical 6MDA transforms7@ %elow.

)igure K shows the Physical model deri:ed from the a%o:e 'ogical model for a specific D*MS. ,t uses the 4M' Profile for DD' modeling to represent MySL' specific details:
Transaction col u m n & a te )DAT 5 a m o un tPa i& )$+T 56 5 / #P4 tra n sa ctio n$D )$+T 5 6 5/ 84 a cco u n t )$+T 5 65/ P4 ( P4 7T ra n sa ctio n1$+T 565 /3 84 ( 84 7a ccou nt1$+T 5 65/3 (84 7a cco u n t ! ""# Order col u m n &a te )DAT 5 &e li*ery$n stru ctio n s )V A/C0A /12! 3 (P47 T ra nsa ctio n or& e r+u m , e r )$+T 5 6 5/ 1tran sa cti o n $D 9 tra n sa cti on $D3 sta tu s )% r& e rStatu s 84 acco u n t )$+T 5 6 5/ 84 1 ! ""# #P4 or& e r$D )$+T 5 65 / (84 7% r& er7 T ra nsa cti on 84 tra nsa ctio n$D )$+T 5 6 5/ P 4 ( P4 7% r& e r1$+T 56 5/3 84 ( 84 7 a ccou nt1$+T 5 65/3 ( 84 7 %r& er7T ra n sa cti o n 1$+T 56 5/3 (847 a cco u n t StockItem col u m n au th or )V A/C0A /12 ! 3 ca ta l og +u m ,e r )C0A /11! 3 co stPri ce )n um , er li stP rice )n u m , e r ti tl e )V A/C0A /12 ! 3 #P 4 stoc'$te m $D )$+T 56 5 / P4 ( P47 Sto c'$te m 1$+T 56 5/3 (P 47S to c'$te m 1

1a ccou nt 9 a cco un t$D3 84 (P 47A ccou nt 1

1sto c'$te m $D 9 sto c'$tem $D3 84 (847 L in e $te m 7 Sto c'$te m

! ""#

(P47 % r&e r

Account co l u m n , il l in gA && re ss )VA/C0A /12! 3 & e l i*e ryA& & re ss )VA /C0A/12 ! 3 e m ai l A&& ress )VA/C0A/12 !3 n a m e )VA /C0A/12 !3 #P4 a cco un t$D )$+T 565 / P 4 ( P4 7 A ccou nt1$+T 56 5/3 1 (P47 Acco un t ShoppingBasket co lu m n sh op pi n g Ba s'e t+u m ,e r )VA/C0A /12! 3 #P 4 sh op pi n g Ba s'e t$D )$+T 5 6 5/ 84 acco un t$D )$+T 5 6 5/ P 4 ( P47 Sh op pi n gBa s'e t1$+T 56 5 /3 ! ""# 84 ( 84 7 Sh o p p i n gB as'e t7A cco u n t1$+T 56 5/3 1or& er$D 9 o r& er$D3 (P 47A ccou nt 1 1a ccou nt 9 a ccou nt$D3 84 1 ""# (84 7 L in e $te m 7 %r& e r

! ""1 LineItem co lu m n -u an tity )$+T 5 6 5/ lin e$tem $D )$+T 5 6 5/ or&e r$D )$+T 565 / sh op pi n g B as'e t$D )$+T 5 6 5/ sto c'$te m $D )$+T 565 /

84

#P 4 #84 #84 84

P 4 ( P47 L i n e $te m 1$+T 5 65 /3 84 ( 84 7 L in e$tem 7 %r& er1$+T 56 5/3 ( 84 7 L in e$tem 7 Sh o p p in gB as'e t1$+T 565 /3 ( 84 7 L in e$tem 7 Sto c'$te m 1$+T 5 6 5/3 1 ""#

1a cco u n t$D 9 acco un t$D3 84 (847 Sho pp in g Ba s'et7 Acco un t

(P4 7 Sh o p p in gB a s'e t 1 84 1sho pp i ng Ba s'et$D 9 sh o pp i ng Bas'et$D3

(847 Li n e $te m 7 Sho pp i ng Ba s'et

Figure :! ",3.ical le-el model .et to a .peci/ic DBMS.

)urther details can %e added to the deri:ed physical model. $hese include setting: > Stored Procedures: see Stored Procedures > Views: see > Views Sparx Systems !"## Page:M

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

>

&onstraints; $riggers: see < ,ndexes; $riggers and &hec= &onstraints. -ote: $hese three features are outside the MDA transform co:ered in the section %elow: Automating 'ogical to Physical 6Model $ransformations7.

Working with DDL Scripts


$he final step is to generate the SL' script that will %e ready to load into the D*MS. )or more details on this see: .enerate DD'.
$hese scripts can also %e imported %ac= into Enterprise Architect and edited with SL' syntax highlighting in the &ode Viewer. $he SL' script can %e generated for the whole pac=age or for single ta%les. ,f a single script for the pac=age 6a complete data%ase7 has %een generated; the script file can %e imported %ac= to the Pac=age. (therwise for single ta%le scripts; you can import these %ac= to each $a%le Element. $o import the script; select either the pac=age or the ta%le>element; then in the Properties :iew < under )ilename > import the generated script 6see the Properties :iew; %ottom right; in the image %elow7. $o Edit or View the script; open the Source &ode editor 6AltNK7; then select the pac=age or ta%le>Element.

Figure ;! Data0a.e model +it, t,e DDL .cript /or t,e ta0le .elected in t,e diagram

Sparx Systems !"##

Page:3

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Automating Logical to Physical (Model ransformations!


Model Dri:en Architecture 6MDA7 transformations can automate the generation of lower le:el models from a higher le:el of a%straction. )or data%ase modeling; MDA transformations ta=e a D*MS independent 'ogical Data Model as input and generate a corresponding Physical model 6D*MS specific7. Enterprise Architect supports the following MDA transformations for data%ase modeling: > UML Cla..e. to DBMS .peci/ic DDL ta0le.. )or more information; see the DD' $ransforms help topic. > ERD Element. to DBMS .peci/ic DDL Ta0le.. )or more information; see the E+D $ransformation help topic. -ote: the Enterprise Architect default D*MS needs to %e set for the 'ogical Model to %e transformed to a specific D*MS. $o set the D*MS default; see help: D*MS Datatypes

$here is also support for a re:erse transform from DD' to E+D. )or more details on this; see %elow: Data Model to E+D $ransformation A point to note is; that where there are ?many>to>many@ relationships in the logical model; the DD' transformation generates a Join>ta%le to accommodate the relationship. +eturning to the (nline *oo=store example 6see )igure 87; we could re>model IStoc=,temI as two separate ta%les; Pu%lication and Author; related using a many>to>many 4M' Association. $his is shown as:

Author . a u th o r+a m e 1 ""# . 1 ""# . . .

Publication ti tl e )Stri n g c a ta l o g +u m , e r )Stri n g c o stP ri c e )$n te g e r l i stPri c e )$n te g e r

Figure *! $Stoc4item% rede/ined in t,e logical model a. &ut,or and "u0lication +it, a man3<to<man3 relation.,ip.

Applying the MDA DD' transformation to this logical model returns:

Sparx Systems !"##

Page:#"

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Author col u m n a utho r+am e #P4 a utho r$D )$+T 56 5 / P 4 ( P 47 A u tho r1$+T 5 6 5/3 (P 47 Auth or

Publication co lu m n ti tl e )VA /C0A /12 ! 3 cata lo g+u m , e r )VA /C0A /12! 3 costPrice )$+T 5 6 5/ l i stP ri ce )$+T 56 5 / #P 4 p u , l icati o n $D )$+T 5 6 5/ P4 ( P 4 7 Pu, li ca ti on 1$+T 5 6 5/3 (P4 7 Pu , l i catio n

1a utho r$D 9 au th o r$D3 84 (A u tho r 1 ""# oinAuthorToPublication

1p u, li ca ti on $D 9 p u, l ica ti on $D3 84

(Pu, l ica ti on co l um n 1 ""# 84 p u , li catio n $D )$+T 56 5 / 84 a u th o r$D )$+T 5 65 / 84 ( P u, l ica ti on 1$+T 56 5 /3 ( A uth or1$+T 5 65 /3

Figure '=! MD& Tran./ormation o/ a man3<to<man3 logical relation.

"elating Database Schemas to the Model


0hen modeling on different le:els of a%straction; there is often a need for tracea%ility %etween the eEui:alent entities across each le:el of a%straction 6&onceptual; 'ogical and Physical7; as well as; tracea%ility %etween $a%le )ields and their associated application logic 6&lass Attri%utes7 and 4ser ,nterface diagrams. $here are a num%er of methods that can %e used for this process: #. 0hen relating elements across le:els of a%straction Enterprise Architect@s +elationship Matrix can %e used to create or :iew lin=s %etween entities; on their different le:els. $he $racea%ility View can also %e used to :iew relationships %etween entities/elements from a hierarchical perspecti:e. !. $a%le>fields can %e directly related to &lass Attri%utes using &onnect to Element )eature. *elow is a simple example of this type of mapping in a diagram.

Sparx Systems !"##

Page:##

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

!" Model##Account n am e )string , i ll i ng A&& re ss )string e m a il A& & ress )stri n g clo se& ), oo l & el i *e ryA& &re ss )strin g ( ( ( ( ( ( l oa& Acco u ntDeta i l s1stri n g3 )*oi & m ar'Acco un tCl ose& 13 )*oi& cre ate +e :Accoun t13 )*o i& su ,m it+e :A cco u ntDetai ls13 )*o i& retri e*eA cco un tDetai l s13 )*oi& *a li &a te ;ser1stri n g< stri ng 3

Ph$sical Model##Account co lum n n am e )VA/C0A/12! 3 , i ll i ng A&& ress )VA/C0A/12! 3 e m a il A&&ress )VA/C0A/12! 3 clo se& )B$T & el i *e ryA&& re ss )VA/C0A /12 !3 #P4 a cco un t$D )$+T 565/ #84 h i sto ry )$+T 565/ P 4 ( P47Accou nt1$+T 5 65/3 u n i -u e ( ;=7 Acco un t7 accou nt$D1$+T 565/3 ( ;=7 Acco un t7 cl ose &1B$T 3 84 ( 847h isto ry1$+T 565/3

p ro pe rty ( %r&er13 )%r& er ( , as'e t13 )Sh op pin gB as'e t ( n am e13 )strin g ( , i ll i ng A&& re ss13 )strin g ( e m a il A& & ress13 )stri n g ( clo se& 13 ),o ol ( & el i *e ryA& &re ss13 )stri ng

Figure ''! Directl3 lin4ing Cla.. &ttri0ute. to Ta0le Field.

/. Some data%ase systems relate explicit Screen entry )ields direct to $a%le )ields 6.e.g. MS Access; Power*uilder etc.7. $o model these relationships a Screen Model can %e lin=ed using the &onnect to Element )eature connections as shown %elow.
StockItem

Sea rchA uthor StockItem col um n A utho r )*a rchar12!3 catalog+um ,er )*a rchar12 !3 costPrice )num ,er li stPri ce )nu m ,er ti tle )*a rcha r12 !3 #P 4 stoc'$tem $D )i nte ge r 84 li ne$te m $D )i nteg er P4 ( P 47Stoc'$tem 1intege r3 84 ( 847Stoc'$tem 7Li ne $tem 1i nte ger3 +e >t

SerachT itl e

8i n&

Auth or

T i tl e

Cata log+um ,er

=uantity

CostPrice

Li stPri ce

Ba c'

+e:

Sa *e

Figure '1! &..ociating ta0le /ield. to .creen control.

Sparx Systems !"##

Page:#!

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Re-er.e Engineering! $E-ol-ing% a Structure


A maJor :ersion change of a system can in:ol:e core structural modifications. $hese could include changes resulting from different data%ase structures; through to a different data storage solution 6another D*MS7. 0hen modeling changes to a data%ase structure; you must :iew the current schema in a model. 0here the model repository has not %een maintained o:er the lifecycle of system changes; you need to re>import the schema %ac= into Enterprise Architect. )or details on the process to +e:erse Engineer a D*MS see ,mport Data%ase Schema. (nce the legacy schema is a:aila%le in the model it can then %e manipulated in a num%er of ways; such as simply con:erting it to another D*MS format; relating it to re:erse>engineered application classes or further a%stracting it to form a Platform ,ndependent model. $he options a:aila%le are:

&on:ert to another D*MS 6Migration7


,n cases where the primary change is from one D*MS to another D*MS; a simple process that Enterprise Architect supports is Data $ype &on:ersion for a Pac=age. $his supports a direct con:ersion from one D*MS to another 6e.g. MS SL' Ser:er to (racle7. Post con:ersion; the structure can %e modified to meet any alterations to the design. $he updated data model can then used to generate the schema as a DD' script and then loaded into the new D*MS to create a new data%ase. See: .enerate DD'.

+elating to +e:erse>Engineered &ode


)or an o:er:iew of the options for relating the re:erse engineered data%ase structure to the re:erse engineered code see: +elating Data schemas to the Model outlined a%o:e.

A%stracting to 'ogical 'e:el


+e:erse Engineering the data%ase schema will create a Physical DD' model. 0here there needs to %e more wor= on the design; and in cases where the code has also %een re:erse engineered; and the &lass structures of the application model are %eing altered; there may %e a need to wor= on a data modeling at a higher le:el of a%straction > the 'ogical model. 0here the original data model used to de:elop the legacy :ersion is still a:aila%le; then the 'ogical data model can %e re>used as a starter and updated. Although an MDA transformation from the Physical data model to the 'ogical data model is not supported; if the code structure is a close reflection of the data schema; then a logical model can %e deri:ed %y re:erse engineering the code and then this &lass diagram can %e used as a foundation for defining the Data%ase logical structure.

Sparx Systems !"##

Page:#/

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

&omparing -ew and (ld Structures


A function that can %e of great use when re:erse engineering a data%ase schema; then modifying the model; is to compare the new modeled structure against the existing data%ase schema stored on the D*MS. )or more details on this see ?&ompare DD' for a Data%ase@ in .enerate DD' for a Pac=age.

Conclu.ion
$his co:ers some of the =ey features of Enterprise Architect@s support for Data Modeling including modeling from the &onceptual to Physical le:els; )orward and +e:erse Engineering of Data%ase Schemas; and MDA transformation of the 'ogical model 6platform independent7 to Physical D*MS 6platform dependant schema7. 0hen modeling an application and the data%ase in the same en:ironment there is added %enefit of tracea%ility %etween the application modeling and the data modelingA synchroniOation %etween the design of the application; the design of the data model and the final implementation of these; along with; the added %enefits of model reuse when starting new designs. 0hether you need to model and manage complex designs and :isualiOe data structures; or %uild and deploy di:erse data systems; Enterprise Architect pro:ides interconnected modeling; de:elopment and deployment; for %oth the data%ase and the system code.

Sparx Systems !"##

Page:#G

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

&ppendi>!
D#MS data types$
$here may %e cases where you want to create a physical data model for a D*MS product that is not yet supported nati:ely %y Enterprise Architect; or you may need to add datatypes for a more recent :ersion of a supported D*MS. $he Data%ase Datatypes screen allows adding a new Data%ase product; or customiOing the data>types associated with an existing one. $o do this; select from the main menu: Settings P Data%ase Datatypes. See the related help topic for more details.

Diagram "epresentations
Enterprise Architect supports a num%er of notations rele:ant to data modeling. $his document primarily uses &lass diagrams. (ther supported notations include: . . . ,DE)#B E+D ,nformation Engineering

$he following are examples of the ,DE)#B and ,nformation Engineering formats:

Transaction ( ( &a te )& a te am o untPa i & )integ er Order (histo ry (acco un t ( ( ( ( &ate )&a te &el i*ery$n stru ction s )strin g or& er+um ,e r )intege r statu s )inte g e r ( ( ( ( (

StockItem a utho r )strin g ca tal og+u m ,e r )ch a r co stPrice )n um ,e r l istPrice )n u m , er title )strin g

P LineItem

Account ( ( ( ( , ill ing A& &re ss )stri ng & el i*eryA& & re ss )strin g e m ail A&& ress )stri ng n am e )stri ng (a cco un t (

- u an tity )intege r

(,a s'e t (

ShoppingBasket sh op p in gBa s'et+um ,e r )strin g

Figure '3! IDEF'? repre.entation o/ t,e Online Boo4.tore data model

Sparx Systems !"##

Page:#8

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

Transaction ( ( &a te )& a te am o untPa i & )integ er Order (histo ry (acco un t ( ( ( ( &ate )&a te &el i*ery$n stru ction s )strin g or& er+um ,e r )intege r statu s )inte g e r ( ( ( ( (

StockItem a utho r )strin g ca tal og+u m ,e r )ch a r co stPrice )n um ,e r l istPrice )n u m , er title )strin g

Account ( ( ( ( , ill ing A& &re ss )stri ng & el i*eryA& & re ss )strin g e m ail A&& ress )stri ng n am e )stri ng (a cco un t (

LineItem - u an tity )intege r

(,a s'e t (

ShoppingBasket sh op p in gBa s'et+um ,e r )strin g

Figure '(! In/ormation Engineering repre.entation o/ t,e Online Boo4.tore data model

$o change the format of the diagram %etween 4M' Profile for DD'; ,DE)#B and ,nformation Engineering; select from the main menu: Diagram P Properties Q &onnectors; then using the dropdown: &onnector -otation < select the appropriate format.

Data Dictionary
A simple method to create a data dictionary is to use the Enterprise Architect Model Search facility to create a ?Data Dictionary@ Euery. $his returns results that can %e sorted %y many different fields 6e.g. %y $a%le name; )ield $ype; Primary 1ey; )oreign =ey etc.7. Enterprise Architect supports storing its model repositories using a num%er of different D*MS. As the search Euery format differs %etween each D*MS; only the simple default .eap SL' script is shown %elow. -ote this is simple to re>arrange to suite the SL' specific to the D*MS of your repository. $o create the Model Search Euery: 1. 4se &trlN) to open the Model Search :iew 2. $hen select: (ptions P Manage Searches 3. Select the -ew Search icon 4. (n the &reate -ew Search Luery dialog: o o $ype in a -ame 6CData Dictionary EAPD7 Select: SL' Editor

$he SL' search string to use is: Sparx Systems !"## Page:#9

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

SE'E&$ tRattri%ute.eaRguid AS &'ASS.4,D; FAttri%uteF AS &'ASS$5PE; tRo%Ject.-ame as $a%leR-ame; tRattri%ute.-ame; iif6tRattri%ute.,s(rdered; IP1I; II7 as Primary1ey; iif6tRattri%ute.,s&ollection; I)1I; II7 as )oreign1ey ; tRattri%ute.$ype; tRattri%ute.'ength; tRattri%ute.Precision; tRattri%ute.Scale; iif6tRattri%ute.,sStatic; I4niEueI; II7 as is4niEue; iif6tRattri%ute.AllowDuplicates; I-ot-ullI;II7 as -ot-ull )+(M tRattri%ute; tRo%Ject 02E+E tRattri%ute.o%JectR,d S tRo%Ject.(%JectR,D and tRo%Ject.Stereotype S I$a%leI $his will support cross>referencing to the $a%le )ields in the ProJect *rowser using the &ontext menu options in the result set generated 6see %elow7:

Sparx Systems !"##

Page:#K

Series: Data Modeling From Conceptual Model to DBMS

Enterprise Architect
Visual Modeling Platform
http://www.sparxsystems.com

lo..ar3
Attri%ute &onceptual 'e:el &onceptual Model Data%ase Schema D*MS DD' Entity E+D ,DE)#B ,nformation Engineering 'ogical 'e:el 'ogical Model MDA Physical 'e:el Physical Model P,M PSM 4M' A feature within an Entity that descri%es where a range of :alues can stored. $he initial design le:el used to esta%lish the Entities and simple relationships. Models defined at the &onceptual 'e:el. $he structure of a data%ase descri%ed in a formal language supported %y the data%ase management system 6D*MS7. Data%ase Management System; is a software system that manages data%ases on a ser:er. A Data Definition 'anguage is a language used for defining data structures. A uniEuely identifia%le o%Ject a%stracted from the complexities of some domain < fundamental element used in E+D. Entity>+elationship Diagrams: a classical data modeling notation; primarily used for conceptual modeling. C,ntegration Definition for ,nformation ModelingD is a data modeling language associated with the ,DE) group of modeling languages. C,nformation EngineeringD is a data%ase modeling notation for Entity> +elationship Modeling. $his le:el of a%straction is a simple description of data%ase structure; and what relationships exist among those data entities. Data Models defined at the logical 'e:el. Model Dri:en Architecture 6MDA7 is a software design approach for the de:elopment of software systems. See (M. > MDA $he le:el where the data%ase schema modeling has sufficient detail to facilitate implementation on a specific D*MS. Models defined at the Physical 'e:el. Platform ,ndependent Model < used in MDA transformations. Platform Specific Model <generated %y MDA transformations. 4nified Modeling 'anguage: an o%Ject modeling and specification language used in application design. See (M.>4M'.

Sparx Systems !"##

Page:#M

You might also like