E-R Schema

From WebRatio WebML Wiki

Jump to: navigation, search


The Data Model describes the conceptual data organization of the WebRatio applications; it is compatible with the Entity-Relationship model and UML class diagrams. An Entity-Relationship Model (ERM) is an abstract and conceptual representation of data. Entity-relationship modeling is a database modeling method, used to produce a type of conceptual schema or semantic data model of a system, often a relational database, and its requirements in a top-down fashion.

Contents

E-R Schema

In order to create an ER schema you must know three main concepts: entity, attribute and relationship.

Entity

Entity is the central concept of the Entity-Relationship model. An entity represents a description of the common features of set of objects of the real world. Examples of entities are Person, Car, Artist, and Album. An entity has a population, which is the set of objects that are described by the entity. These objects are also called instances of the entity. For example, the population of entity Person is a specific set of persons, and the population of entity Car is a specific set of cars, and so on. As all the concepts of the Entity-Relationship model, entities are specified using a graphic notation. They are denoted by means of rectangles with the entity name at the top. An Entity is identified by its name.

Attribute

An Attribute represents the properties of real world objects that are relevant for the application purposes. Examples of attributes are the name, address, and photo of a person. Attributes are associated with the concept of Entity, with the meaning that all the instances of the entity are characterized by the same set of attributes. In other words, the entity is a descriptor of the common properties of a set of objects, and such properties are expressed as attributes. It is admissible that an entity instance may have a null value for one or more attributes. For each attribute it's necessry to specify the name and the data type, which can be chosen from the availables types.

Relationship

A Relationship represents semantic connections between entities, like the association between an artist and his/her album, or between an artist and his/her reviews.

The meaning of the association is conveyed by the relationship's name, which is established by the designer. For example, the relationship between an artist and the albums he/she has published could be named "Publication". The simplest form of relationship is the binary relationship, which connects two entities. Relationships involving more than two entities, called N-ary relationships, are not allowed by WebML and can be equivalently expressed by means of multiple binary relationships.

Each binary relationship is characterized by two relationship roles, each one expressing the function that one of the participating entities plays in the relationship.

For example, the relationship Publication between an artist and his/her album can be decomposed into two relationship roles, one from artist to album, named Publishes, and one from album to artist, named Published By. Thus, a relationship role can be regarded as a sort of "oriented" association, connecting a source entity with a destination entity.

Relationship roles can be annotated with maximum cardinality constraints, denoting the maximum number of objects of the destination entity to which any object of the source entity can be related. The possible values are one and many. Based on their maximum cardinality constraints, relationships are called

  • "one-to-one", if both relationships roles have maximum cardinality 1,
  • "one-to-many", if one relationship role has maximum cardinality 1 and the other role has maximum cardinality N,
  • "many-to-many", if both relationships roles have maximum cardinality N.

The following image shows the relationship Publication, which is defined between entity Album and entity Artist. An album is associated with exactly one artist, and each artist may be associated with several albums. The relationship is "one-to-many", because it associates one artist to multiple albums.

IS-A Hierarchy

The Entity-Relationship model permits the designer to organize entities into a hierarchy, where they share some common features. The basic generalization hierarchy (also called IS-A hierarchy) has one super-entity and one or more sub-entities. A generalization hierarchy is not limited to two levels, but a sub-entity may in turn be specialized into one or more sub-entities, yielding an arbitrary-depth hierarchy. There are different types of hiearchy

  • total
  • partial
  • exclusive
  • overlapping


E-R Schema Normalization

E-R includes some concept that are not minimal but which can be specified through the usage of the three main concepts of the ER Schema. These concepts are:

  • Multi value attributes.

Attributes of an object that can take a set of values represented by an entity and a relationship

  • Composed attributes.

Attributes with an internal structure (i.e, an address can include different fields), represented by using an entity and a relationship

  • N-ary relationships.

Represented by a central entity and two reports

  • Relationships with attributes.

Relationships involving N entities



Related articles:
Category Difficulty Refers
Choosing the primary key ID Generator Data Model Intermediate WebRatio
E-R Schema Technical Reference Beginner Entity
Relation
Getting started with the Data Model Unit Web Model Advanced Data Model Unit
Query Unit
Getting started with the Query Unit Web Model Advanced Query Unit
Data Model Unit
How to implement a custom database Metadata provider Data Model Advanced WebRatio
… further results












Did you find this article useful? Please rate it!

Rating: 5.0/5 (1 vote cast)

Personal tools