ࡱ> VXUY zbjbjWW *H==2W]FFFF8& : 492  ,,,9999999$.;"=9,)j,,,97.FF m 7.7.7.,|F"  9FFFF,97.7.=478nhr9 n $`:؞,<9Entity Relationship Models ( ERMs ) Introduction Introduced by Peter Chen in 1975/6 Used in a number of methodologies : SSADM, Yourdon, OOA/OOD An ERM provides a quick reference to an organisation's data structures - the relationships between the data components of a system Completed ERM can be used stand-alone to design an information system's data structures or in conjunction with a DFD to provide a more comprehensive IS logical design It was intended for designing databases but is also used more widely to document the data requirements of the system under investigation and to diagrammatically represent the relationships between data entities The Entity-Relationship model is the name of a top down approach to system design The data flow diagram is concerned with the question, What does the system do with the data? The data model is concerned with the question, What data does the system need to store and what is the most efficient way of organizing the data Stored data requirements are not ignored by the data flow diagram; its data stores model the stored data. However, when designing data stores, the system developer is not attempting to find an efficient way of organizing the data, merely identifying the stored items Data modelling uses two separate techniques to achieve a satisfactory set of entities, entity-relationships (E-R) modelling and normalization The identification of the data objects or entities in the system, their structure and relationships between entities. The construction of a model of the stored data requirements of the system which is independent of specific processing requirements The construction of a robust data model i.e. Minimal model of the data required to be stored in the system. The construction of a logical model of data i.e. a model that is not concerned with how the data storage will be, or is currently physically implemented. Data modelling aims to identify the system entities, i.e. items which the system needs to store data (e.g. customers, orders products etc.) The data model also shows the relationships between entities. Customer places an order The data model concentrates on the properties of the data itself, independent of the processing requirements of the system. The data model aims to collect all the data that needs to be stored for the system to operate and to organize that data into a sound structure Its is important that little redundant data is stored. As far as possible one item of data should be stored in one place and only one place only. If the same data is stored more than once this can lead to discrepancies between data that has been updated in place but not in another Data modelling is not concerned with how the data is physically stored in the current system or in the computer-based system being developed. The data model aims to develop an efficient model of the data, independently of how it is implemented A relationship is a link between two entities. For example a customer places an order Why are diagrams so incredibly helpful in system design? Communication with the user/non-technical people `A diagram says 1000 words' More degrees of freedom than text Easy to learn Easy to be informal Why might diagramming techniques be harmful? Easy to be too informal Entities Definitions An entity is something of significance to the system about which information is held - M. Goodland An identifiable object about which one can collect data - P.M.D Gray Entities have occurrences identity They are like tables or relations Example: Patient, Drug, Ward, Doctor Attributes An attribute is an item of data held about an entity It is the smallest discrete component of the system information that is meaningful Sometimes called properties, (logical) data items, data elements or fields in record processing Like the attributes of a table in the relational model Examples Patient: name, DOB, Gender Ward: Capacity, Name Drug: supplier, cost Key This is simply a (chosen) `candidate key' in the Relational Model The key can be used to identify occurrences of entities Examples Patient: id, name-address, NI no. Ward: id, name Drug: id, name-supplier, EU-code Relationships Relationships are between entities, not attributes These define the access routes (navigation) through the system Note: A relationship is also an entity in the relation model this might be a table foreign keys Degree of a Relationship many-to-many: Drug-to-Patient one-to-many: GP-to-Patient one-to-one: Person-to-Phone_number Also relationship may be: optional (there exists at least one pair of unrelated entities) mandatory (there does not exist a pair of unrelated entities) Example: mandatory: Patient-to-GP optional: Person-to-Phone_no. The degree and optional/mandatory nature are used to annotate the graph The degree is written at each end of the relationship line either numerically or using a crow's foot to indicate the 'many' end Definitions Entity `An entity is something of significance to the system about which information is to be held' Attribute `An attribute is the smallest discrete component of the system information that is meaningful' Relationship `A relationship is an association between two entities that is important to the system.' Symbols Entities Rectangles/ellipses Relationships 1-to-1 ( mandatory ) 1-to-many conditional Development Technique Identify the entities ; Determine the attributes of each entity ; Select the primary key for each entity ; Establish the relationship between the entities ; Draw the model ; & Test the relationships and the keys Simple Example STUDENTs attend COURSEs that consist of many SUBJECTs A single SUBJECT ( i.e. English ) can be studied on many different COURSEs Each STUDENT may only attend one COURSE To build the E-R model we look at the system and identify data objects about which the system needs to store data. For each entity, list its attributes. Investigate and record relationships. We need to be able to link entities so that all significant real-life relationships are captured Check the entity descriptions against the data dictionary descriptions of data stores, inputs and outputs, data flows, etc. Make sure that process on the data flow diagram has available to it all the data it needs; I.e we make sure we have captured all the data the system needs to function. (Alex Fleming, 2001 Page  PAGE 13 Entity 1 Entity 2 Places Order Customer PATIENT DOCTOR WIFE HUSBAND MANAGER k3 L ~mv@E IMVW6ÿýhmHjUhnH hnH  jhnH B* CJ8OJQJhnH jUhmHnH jUmH60J(60J(jB* CJ8OJQJUmHB* CJ0OJQJhmH nH 6B* CJ8OJQJhmH nH B* CJ8OJQJhmH nH 5$1T=8g a i 3 L W q & F$1T=8g a i 3 L W qeyvnkc`]W C(      6  A  Z  $  ,  &  U  P  j      e'CesD3& & F'CesD3&AVko#DS|vpjda^X     a  m       C     y J X z  !&AVko#DS'@dIVpWS'@dIVpWcj0=ĔЂ|yspmjg   '   u P      (Wcj0=4^ & F4^5B!"+,56=>DENOWX_`efnowxyzſ &    G  Hp :  M           15B !" & F & F"+,56=>DENOWX_`efnowxyz$$6<=>CDEMNOVWX^_`defmnovwzB* CJhnH B* CJhmH nH B* CJ hnH B* CJ hmH nH (&P . A!"#$%* [8@8Normal$nxx6mH D@!"D Heading 1$$@& >*CJ KH>@12> Heading 2@&5CJJ@J Heading 3$7@&6B*CJhnH <A@<Default Paragraph Font,@,Header  9r ""TOC 9@ 8 @8FooterP p#CJ88H2$dd@& 56hnH F2F Blockquotehhdd6CJhnH LRLDefinition Term6CJhnH LBLDefinition Listh6CJhnH (Oa( Definition6@@H1$dd@&56CJ0KH$hnH <<H3$dd@&56CJhnH <<H4$dd@&56CJhnH <<H5$dd@&56CJhnH <<H6$dd@&56CJhnH ::Address CJhnH OCITE6$O$CODE CJOJQJ0O0Keyboard5CJOJQJtt Preformatted4  # ~= z9!v%6CJOJQJhnH XXz-Bottom of Form !$$d<CJOJQJhmH nH RR z-Top of Form "$&d<CJOJQJhmH nH $O1$SampleOJQJ$OQ$Variable6,Oa, HTML Markup<B*"Oq"Comment<$X@$Emphasis6(U@( Hyperlink>*B* #-6>DMVzXYihgsrnmw #-6>DMVY zH-/146z#&W"z!"Sz '*4! }~d2$PXєwޒ~?2$e.Հ{-/ص2$7#,E-Hjo2$-Z?v?wuà2$dT=gv2$;%sML>?2$8;0eH>]2$y&7u|Q"׸}2$9RX]t2$ bB k]2$q;yo$:2$ywhO.H]#b2$Td9}&wDb52$/VmY? 2$΀,J8G!0Bݬ}b2$9fFFx4P2$_8 \FեmF2${6OxfH]2$\W)Z}J=m2$sعEx;!2$1ޭ~ ؝O2$nr/j4&(2$N 3.2$may]--J 2$07@hbl|G[)2$ +Ь1tM2$V.E 3ֹfq2$5\]8 u.(K}=2$hW0#9- 62$r ҟW2$TF93U32$"t݀[2$~Jl{_U6kC2$p]gHgD2$n)yiZ2$bp!qT2$zn#|( 2$elvO?_9w2$uN2$JdvnW^]OK[Tn2$"`RHa'2$zI21K&ݨ;2$XYl^?{֣ 0e0e     A@ A  8c8c     ?1 d0u0@Ty2 NP'p<'pA)BCD|E||@'}N(  H X #   H2 Y #   NB Z S D NB [ S D NB \ S D NB ] S D NB ^ S D TB _ c $D T    `# Z p   a  p  b T̙ 3f3f??p   c T̙ 3f3f??  B d ZD3f3f?? B e ZD3f3f??@ B f ZD3f3f??@ @  g N̙ 3f3f?? 0T   h N̙ 3f3f?? T   i N̙ 3f3f??   j Z̙ 3f3f?? k Z̙ 3f3f??B l  `D3f3f?? m T ̙ 3f3f??   n T̙ 3f3f??  o Z̙ 3f3f??  p Z̙ 3f3f?? B q  `D3f3f??  r T̙ 3f3f??  s T̙ 3f3f?? B t  `D3f3f?? B u  `D3f3f?? v Z̙ 3f3f?? w T ̙ 3f3f??  B x  `D3f3f??B y  `D3f3f??B z@  `D3f3f??B {  `D3f3f?? B |@  `D3f3f??B }  `D3f3f??B S  ? @ABCD  IJKLVz`(tn@htlx ptkpK8tjKx tm tum]tsmMtrm Mtq ]]tpto( tt]t{`S`tz`S!Sty!S!t}`mPt|pm`twXM`-tvx@tx@!tYJb#"`Xb"`]b`\Dz`_RpR`^RR`[hzDz`Z^`KTnwv  ; C !"{ln ''@Edd IMVW !"6x{ Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc Alex FlemingCC:\WINDOWS\TEMP\AutoRecovery save of entity-relationship-models.asd Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc Alex FlemingCC:\WINDOWS\TEMP\AutoRecovery save of entity-relationship-models.asd Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc Alex FlemingCC:\WINDOWS\TEMP\AutoRecovery save of entity-relationship-models.asd Alex FlemingCC:\WINDOWS\TEMP\AutoRecovery save of entity-relationship-models.asd Alex Fleming<C:\WebPages\afleming\lectures\entity-relationship-models.doc62cbc hhOJQJo(*..p.@ .......p.@ .....zo()cbV8 VPV| VV @h OJQJo(V@CJ*OJQJo(l @$$VDzP@G:Times New Roman5Symbol3& :Arial?5 :Courier New;Wingdings"qhL\uaf + "0d@l <C:\Program Files\Microsoft Office\Templates\LectureNotes.dotEntity Relationship Models Alex Fleming Alex Fleming RhubarB26 Oh+'0 , H T ` lxEntity Relationship Modelsnti Alex FlemingonslexLectureNotes.dotip  Alex Flemingdot3exMicrosoft Word 8.0 @ @@^@ *؞ ՜.+,D՜.+,H hp|   y+ @j Entity Relationship Models Title 6> _PID_GUIDAN{E3A17720-9EEB-11D4-9351-B221B5B7A173}  !"#$&'()*+,-./0123456789:;<=>?@ABCDFGHIJKLNOPQRSTWRoot Entry F@Z8@߻:؞Y1Table%:>WordDocument*HSummaryInformation(EDocumentSummaryInformation8MCompObjjObjectPool@߻:؞@߻:؞  FMicrosoft Word Document MSWordDocWord.Document.89q