Entity–relationship model: Difference between revisions

Content deleted Content added
Common symbols: : insert missing space
No edit summary
Line 1:
The '''entity-relationship model''' or '''entity-relationship diagram (ERD)''' is a [[data model]] or [[diagram]] for high-level descriptions of [[conceptual schema|conceptual data models]], and it provides a graphical notation for representing such data models in the form of '''entity-relationship diagrams'''. Such models are typically used in the first stage of information-system design; they are used, for example, to describe information needs and/or the type of information that is to be stored in the database during the [[requirements analysis]]. The [[data modelling]] technique, however, can be used to describe any [[Ontology (computer science)|ontology]] (i.e. an overview and classifications of used terms and their relationships) for a certain [[universe of discourse]] (i.e. area of interest). In the case of the design of an information system that is based on a database, the conceptual data model is, at a later stage (usually called logical design), mapped to a logical data model, such as the [[relational model]]; this in turn is mapped to a physical model during physical design. Note that sometimes, both of these phases are referred to as "physical design".
 
There are a number of conventions for entity-relationship diagrams (ERDs). The classical notation is described in the remainder of this article, and mainly relates to conceptual modelling. There are a range of notations more typically employed in logical and physical database design, including ''[[information engineering]]'', ''[[IDEF|IDEF1x]]'' (ICAM DEFinition Language) and ''[[dimensional database|dimensional modelling]]''.
 
==Common symbols==
[[Image:erd-entity-relationship-example1.png|frame|Two related entities]]
[[Image:erd-entity-with-attribute.png|frame|An entity with an attribute]]
[[Image:erd-relationship-with-attribute.png|frame|A relationship with an attribute]]
[[Image:Erd-id-as-primary-key.png|frame|[[Primary key]]]]
[[Image:ER_Diagram_MMORPG.png|thumb|A sample ER diagram]]
An [[entity]] represents a discrete object. Entities can be thought of (roughly) as [[noun]]s. Examples: a computer, an employee, a song, a mathematical theorem. A [[relationship]] captures how two or more entities are related to one another. Relationships can be thought of (again, roughly) as [[verb]]s. Examples: an ''owns'' relation between a company and a computer, a ''supervises'' relation between an employee and a department, a ''performs'' relation between an artist and a song, a ''proved'' relation between a mathematician and a theorem. Entities are drawn as rectangles, relationships as diamonds.
 
Entities and relationships can both have attributes. Examples: an employee entity might have a [[social security number]] attribute (in the US); the ''proved'' relation may have a ''date'' attribute. Attributes are drawn as ovals connected to their owning entity sets by a line.
 
Every entity (unless it is a [[weak entity]]) must have a minimal set of uniquely identifying attributes. This set is called the entity's [[primary key]].
 
Entity-relationship diagrams don't show single entities or single instances of relations. Rather, they show entity sets and relationship sets (displayed as rectangles and diamonds respectively). Example: a particular song is an entity. The collection of all songs in a database is an entity set. The ''proved'' relationship between [[Andrew Wiles]] and [[Fermat's last theorem]] is a single relationship. The set of all such mathematician-theorem relationships in a database is a relationship set.
 
Lines are drawn between entity sets and the relationship sets they are involved in. If all entities in an entity set must participate in a relation in the relationship set, a thick line is drawn. This is called a [[participation constraint (ER modelling)|participation constraint]]. If each entity of the entity set can participate in at most one relationship in the relationship set, an arrow is drawn from the entity set to the relationship set. This is called a [[key constraint]]. To indicate that each entity in the entity set is involved in exactly one relationship, a thick arrow is drawn.
 
[[Associative entity]] is used to solve the problem of two entities with a many-to-many relationship [http://infocom.cqu.edu.au/Courses/spr2000/95169/Extra_Examples/ERD.htm].
 
[http://www.utexas.edu/courses/mis325/faq/faq034.htm Unary Relationships] - a unary relationship is a relationship between the rows of a single table.
 
==Less common symbols==
 
A weak entity is an entity that can't be uniquely identified by its own attributes alone, and therefore must use as its primary key both its own attributes and the primary key of an entity it is related to. A weak entity set is indicated by a bold rectangle (the entity) connected by a bold arrow to a bold diamond (the relationship). Double lines can be used instead of bold ones.
 
Attributes in an ER model may be further described as multi-valued, composite, or derived. A multi-valued attribute, illustrated with a double-line ellipse, may have more than one value for at least one instance of its entity. For example, a piece of software (entity=application) may have the multivalued attribute "platform" because at least one instance of that entity runs on more than one operating system. A composite attribute may itself contain two or more attributes and is indicated as having at least contributing attributes of its own. For example, addresses usually are composite attributes, composed of attributes such as street address, city, and so forth. Derived attributes are attributes whose value is entirely dependent on another attribute and are indicated by dashed ellipses. For example, if we have an employee database with an employee entity along with an age attribute, the age attribute would be derived from a birth date attribute.
 
Sometimes two entities are more specific subtypes of a more general type of entity. For example, programmers and marketers might both be types of employees at a software company. To indicate this, a triangle with "ISA" on the inside is drawn. The [[superclass (computer science)|superclass]] is connected to the point on top and the two (or more) [[subclass (computer science)|subclass]]es are connected to the base.
 
Finally, through [[aggregation]] a relation and all its participating entity sets can be treated as a single entity set for the purpose of taking part in another relation. This is indicated by drawing a dotted rectangle around all aggregated entities and relationships.
 
==Classification==
Entity relationship models can be classified in BERMs (Binary Entity Relation Model) and GERMs (General Entity Relationship Model) according to if only binary relationships are allowed. A binary relationship is a relationship between two entities. Thus, in a GERM, relationships between three or more entities are also ''allowed.''
 
==See also==
* [[Entity]]
* [[Relational model]]
* [[Unified Modeling Language]] (UML)
* [[Data structure diagram]]
* [[Dia]] - an open source program to draw ER diagrams
* [[ConceptDraw]] - crossplatform software for creating ER Diagrams
 
==References==
* {{cite journal
| last = Chen
| first = Peter P.
| authorlink = Peter P. Chen
| title = The Entity-Relationship Model - Toward a Unified View of Data
| journal = ACM Transactions on Database Systems
| volume = 1
| issue = 1
| pages = 9-36
| year = 1976
| url = http://www.cobase.cs.ucla.edu/pub/dblp/html/db/journals/tods/tods1.html
}}
This paper is one of the most cited papers in the computer field. It was selected as one of the most influential papers in computer science in a recent survey of over 1,000 computer science professors. The citation is listed, for example, in [[DBLP]]: http://dblp.uni-trier.de/ [http://dblp.uni-trier.de/]
 
==External links==
 
* [http://www.csse.monash.edu.au/courseware/cse2132/gwin30495.exe Gershwin] - An entity-relationship modelling tool developed by [[Monash University]]
* [http://www.conceptdraw.com/en/products/cd5/main.php ConceptDraw] - tool for generating ER diagrams by existing database
* [http://www.silverrun.com/modelsphere.html Grandite's SILVERRUN ModelSphere] - integrated modeling software
* Peter Chen home page at Louisiana State University http://bit.csc.lsu.edu/~chen/chen.html
** [http://bit.csc.lsu.edu/~chen/pdf/Chen_Pioneers.pdf Origins of ER model pioneering]
** [http://bit.csc.lsu.edu/~chen/pdf/ER_C.pdf more deepened analysis of Chinese language]
** [http://bit.csc.lsu.edu/~chen/pdf/erd.pdf The Entity-Relationship Model--Toward a Unified View of Data]
* [https://idbms.navo.navy.mil/DataModel/IDEF1X.html IDEF1X]
* [http://www.excelsoftware.com/dmsql.html Data Modeling & SQL]
 
[[Category:Data modeling]]
[[Category:Diagrams]]
 
[[de:Entity-Relationship-Modell]]
[[es:Diagrama entidad-relación]]
[[fr:Modèle entité-relation]]
[[pl:Entity Relationship Diagram]]
[[zh:实体联系模型]]