Object role modeling

from Wikipedia, the free encyclopedia
Example of an ORM2 diagram

Object Role Modeling ( ORM, English for modeling the roles of objects ) is used to describe a section of the real world ( Universe of Discourse , UoD ) in the context of data modeling . It describes objects and their roles in relation to one another either in simple sentences or in intuitive diagrams.

On the one hand, it serves the understanding between users and developers in the conceptual phase of application development, whereby only the what, i.e. the technical logic, and not the how, i.e. the technology, is presented. On the other hand, the ORM model serves as the basis for the design of the database in the implementation phase.

example

Simple ORM example

The picture on the right shows a simple relationship: An employee works in a department . This diagram introduces the three basic types of objects:

  • Entities (employee and department) are the actual objects of the UoD. Entities are represented as ellipses.
  • Roles (also known as fact types ) represent the relationship between entities (objects). Roles are shown as adjacent rectangles.
  • Label (“Name of Employee” and “Name of Dep.”) Are the types of objects.

An instance in this example is an assignment of the table. For example: “Franz Otto works in sales.” Here Franz Otto is an instance of the employee and sales an instance of the department.

algorithm

To get from a table with (significant) entries to an ORM diagram, you can go through the following seven steps. It's a somewhat formal route to an ORM diagram, but most of the time (especially for complicated diagrams) it is helpful to think about it one step at a time and not try to convert it all at once.

  1. Convert known information into elementary facts and do a quality check.
  2. Draw the fact type and do a population check.
  3. Test whether entity types should be grouped together and identify all types that can be calculated from the existing ones.
  4. Add uniqueness constraints and test the length of the fact type.
  5. Add mandatory role constraints and test whether something can be logically derived.
  6. Include restrictive values, quantity comparisons, and subtyping.
  7. Add remaining conditions and do a final check.

Algorithm using an example

The following table is given. An ORM diagram is to be created from this.

lecture time college student Matriculation number grade
Databases 15:00
Maier
Müller
Schultze
25538402
25587304
25587305
1.3
2.0
2.3
robotics 15:00
Schmitt
Schmidt
Müller
25534567
25584555
25587304
1.7
2.7
1.0

Conversion of known information into elementary facts

In this step you try to get clear about the types and their context. First one tries to convert the given information into meaningful sentences:

  • "Databases will be held at 3:00 p.m."

In order to be able to more easily infer the diagram, one must think about what an entity type, a label type and an instance of an entity type represent. The above sentence can be rephrased in:

  • "The lecture with the lecture name Databases is held at the time of the type time 3:00 pm."

From this sentence one can read:

  • 'Lecture' and 'Time' are entity types
  • 'Lecture name' and 'time' are label types and
  • 'Databases' and '3:00 p.m.' are instances of lecture and time and are of the lecture name and time type.

Since time in this table really only refers to the lecture, this sentence is correct and complete. It gets a little more complicated when you look at the note.

Two wrong sentences:

  • “Student Müller achieved the grade 2.0.” → The question remains, in which lecture he achieved it
  • “The grade 2.0 was awarded in the Databases lecture.” → The question arises here as to which students this applies to.

Correct sentence:

  • "Student Müller achieved grade 2.0 in the lecture databases."

This is no longer a fact type that only spans two entity types .

Draw the fact types

ORM diagram between lecture and time

From the sentence: “The lecture with the lecture name Databases is held at the time of the type time 3:00 p.m.” you can now create the following diagram. It is allowed to write the label type in brackets under the entity type .

Since this fact type only binds two entity types , it is a binary fact type

ORM chart Ternary Fact Type

From the sentence: "Student Müller achieved grade 2.0 in the lecture databases." you now create an ORM diagram with a ternary fact type, since this fact type binds three entity types .

Web links

credentials