Relationship Entity Model. An entity-relationship diagram or model (sometimes called ER (“Entity relationship”) or “DER” (Entity Relationship Diagram), is the most widely used model for conceptual database design. It was introduced by Peter Chen in 1976 .
[ hide ]
- 1 Features
- 2 Fundamental concepts
- 1 Entities
- 2 Attributes
- 3 Relationships
- 3 Identification of the extensions of the Entity Relationship Model
- 1 Weak entities
- 2 Specialization
- 3 Generalization
- 3.1 Covering property
- 4 Aggregations
- 5 Membership class of an interrelation or function in the interrelation
- 6 Interrelations of degree greater than 2
- 4 Sources
The entity-relationship model is made up of a set of concepts that allow describing reality through a set of graphic and linguistic representations.
Originally, the entity-relationship model only included the concepts of entity, relationship, and attribute. Later, other concepts were added, such as compound attributes and generalization hierarchies, in what has been called the extended entity-relationship model.
Any type of object or concept about which information is collected: thing, person, abstract concept or event (for example: cars, houses, employees, clients, companies, trades, product designs, concerts, excursions, etc.). Entities are graphically represented by rectangles, and their names appear inside. An entity name can only appear once in the conceptual schema.
There are two types of entities: strong and weak.
It is a characteristic of interest or a fact about an entity or about a relationship. Attributes represent the basic properties of entities and relationships. All information is carried by extensive attributes.
Attributes can be simple or compound:
Simple attribute abre.jpg
A simple attribute is an attribute that has a single component, which cannot be divided into smaller parts that have their own meaning.
A compound attribute is an attribute with multiple components, each with a meaning of its own. A group of attributes is represented by a compound attribute, when they have an affinity in terms of their meaning, or in terms of their use.
A monovalued attribute has a single value for a particular entity; for example: age is a monovalued attribute of a person.
A multi-valued attribute can have a set of values for the same entity; for example: the color of a car or the university degree for a person.
159x64px Identifier attribute.jpg
There are identifying (underlined) and descriptive (not underlined) attributes. Identifying attributes uniquely distinguish an instance of a set of entities or relationships, while descriptive attributes – as the name implies – describe the occurrence of a certain entity or relationship.
It is a correspondence or association between two or more entities. Each relationship has a name that describes its function. Relationships are graphically represented by diamonds and their names appear on the inside.
Entities that are involved in a certain relationship are called participating entities. The number of participants in a relationship is what is called the degree of the relationship. Therefore, a relationship in which two entities participate is a binary relationship; if there are three participating entities, the relationship is ternary, etc.
A recursive relationship is a relationship where the same entity participates more than once in the relationship with different roles. The name of these roles is important in determining the role of each stake.
The participation of an entity in a relationship is mandatory (total) if the existence of each of its occurrences requires the existence of at least one occurrence of the other participating entity. If not, participation is optional (partial). The rules that define the cardinality of relationships are business rules.
Identification of the extensions of the Entity Relationship Model
The concept of a weak entity is not treated clearly enough by different authors; In general, there is a consensus in considering it as an entity that depends on the existence of another, either because its internal attributes are not sufficient to identify it or because they are not sufficient within the application domain. The primary key of a set of weak entities is formed by the primary key of the set of strong entities, on whose existence the set of weak entities depends, and the discriminant of the set of weak entities.
The entity set that identifies a weak entity set is called “Owner” of the weak entity set.
An entity set can include subgroups of entities that differ in some way from the other entities in the set. For example, a subset of entities in an entity set may have attributes that are not shared by all other entities. The process of appointing subgroups within a set of entities is specialization. An entity set can be specialized by more than one distinctive feature.
In the ER model it is possible to establish generalization hierarchies between the entity sets. An entity set (E) is a generalization of a group of entity sets E1, E2, …, itself, each element of the entity sets (E1, E2, …, En) is also an element of the entity set AND.
The graphic representation in the DER is made as shown in the figure. The arrow goes to the generalized entity set. In the opposite sense it is spoken of specialization.
- Total or partial coverage: the coverage of a generalization is total (t) if each element of the generic entity set is transformed into at least one element of the lowest level or specific entity sets; is partial (p) if there is any element of the generic entity set that is not transformed to some element of the specific entity sets.
- Exclusive or overlapping coverage: the coverage of a generalization is exclusive (e) if each element of the generic entity set is transformed to at most one element of the specific entity sets; it is overlapping (s) if any element of the generic entity set exists which is transformed to elements of two or more different entity sets.
The following examples illustrate the ways in which the various covers of generalization are combined.
- The coverage of the generalization: Person of the sets of entities Male and Female is total and exclusive (t, e).
- Generalization coverage: Person from the Male and Employee entity sets is partial and overlapping (p, s).
- The coverage of the generalization: Vehicle of the sets of entities Bicycle and Auto is partial and exclusive (p, e).
- Generalization coverage: Athlete from the Footballer and Tennis entity sets in a school that requires each student to participate in at least one of these sports is total and overlapping (t, s).
A limitation of the basic ER model is that it does not facilitate expressing interrelationships. An interrelation and the sets of entities it relates to can be handled as a set of entities at a higher level of abstraction, making it possible to associate with other entity sets. This mechanism is known as the “Aggregation Structure or Aggregation of Entity Sets”, and allows the representation of the Part_Of relationship. The aggregation is represented in the DER as a rectangle encompassing the interrelation that makes it up.
Membership class of an interrelation or function in the interrelation
This extension allows you to specify whether the occurrence of an occurrence of an entity type in an interrelation is mandatory or optional. It is mandatory if in the interrelation at least one occurrence of the entity type has to occur in the interrelation, otherwise it is optional. Note that optionality can be represented by specifying the minimum cardinality as zero.
Example: Here we introduce the semantics that an employee may or may not work on one or more projects, that is, there will be entities of the type of entity used that do not participate in the relationship. Note that the mandatory or optional interrelation can also be expressed through the minimum and maximum cardinalities.
Interrelations of degree greater than 2
Ternary interrelation: Interrelationships can involve more than two entities. Those that involve three are not unusual. As an example, consider the database in the figure below, which is to store information about companies, the products they produce and the countries to which they export those products.
The set of countries to which a product is exported varies from product to product and also from company to company. The SALES relationship is ternary, that is, it involves three entities. The functionality of the SALES ternary interrelation is represented in the figure as “many to many to many” (NMP). This reflects the following facts about the relationship:
For a given pair (company, product) there are usually many countries to which that product is sold. For a given pair (country, product) there are several companies that export that product to that country. For a given pair (company, country) there will be many products exported by that company to that country.