ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 1/6
ORM 2 Graphical Notation
Terry Halpin
Construct | Examples | Description/Notes |
Entity Type | Named soft rectangle, named hard rectangle, or named ellipse. The soft rectangle shape is the default. |
|
Value Type | Named, dashed, soft rectangle (or hard rectangle or ellipse). |
|
Entity type with popular reference mode |
Abbreviation for injective reference relationship to value type, e.g. |
|
Entity type with unit based reference mode |
Abbreviation for reference type, e.g. Optionally, unit type may be displayed. |
|
Entity type with general reference mode |
Abbreviation for reference type, e.g. | |
Independent Object Type |
Instances of the type may exist, without playing any elementary fact roles |
|
External Object Type |
This notation is tentative (yet to be finalized) | |
Predicate (unary, binary, ternary, etc.) |
Ordered set of 1 or more role boxes with at least one predicate reading in mixfix notation. If shown, object placeholders are denoted by “…”. If placeholders are not shown, unaries are in prefix and binaries are in infix notation. |
|
Duplicate type or predicate shape |
If an object type or predicate shape is displayed more than once (on the same page or different pages) it is shadowed. |
|
Unary fact type |
The smokes role may be played by instances of the Person object type |
|
Binary fact type |
By default, predicate readings (binary or longer) are read left-to-right or top-to bottom. An arrow-tip is used to display a different reading direction. Role names may be displayed in square brackets beside their role. Forward and inverse readings for binaries may be shown together, separated by “/”. |
Country or Country or Country
CountryCode or CountryCode or CountryCode
Country
(.code)
Course
(.code)
Company
(.name)
Building
(.nr)
Country CountryCode
has / is of
Height
(cm:)
Price
(EUR:)
Salary
(USD:)
Mass
(kg:)
Height
(cm: Length)
Price
(EUR: Money)
Salary
(USD: Money)
Height cmValue
has / is of
Book
(ISBN)
Website
(URL)
WebLink
(URL)
Book ISBN
has / is of
Country ! CountryCode !
Address^
smokes was born in
… played … for … … in … on … ate …
… speaks … very well
Person StateCode
was born in
Person
smokes
Person
was born in
Country
Car
Person
Person
reports to / manages
[employer]
Person
employs
Company
[manager]
[employee]
made
Product
drives
ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 2/6
Visitor
has
Passport
has
DriverLicence
Person
is a parent of / is a child of
Construct | Examples | Description/Notes |
Ternary fact type |
Role names may be added in square brackets. Arrow-tips are used to reverse the default left-right or top-down reading order. Reading orders other than forward and reverse are shown using named placeholders. |
|
Quaternary fact type |
The above notes for the ternary case apply here also. Fact types of higher arity (number of roles) are also permitted. |
|
Objectification (a.k.a. nesting) |
The enrolment fact type is objectified as an entity type whose instances can play roles. In this example, the objectification type is independent, so we can know about an enrolment before the grade is obtained. |
|
Internal uniqueness constraint (UC) on unaries |
These are equivalent (by default, predicates are assumed to be populated with sets, so no whole fact may be duplicated). |
|
Internal UC on binaries |
The examples show the 4 possible patterns: 1:n (one-to-many); n:1 (many-to-one); m:n (many-to-many); 1:1 (one-to-one) |
|
Internal UC on ternaries. For n-aries (n > 1) each UC must span at least n-1 roles |
The first example has two, 2-role UCs: the top UC forbids ties; the other UC ensures that each team gets only place per competition (a dotted line excludes its role from the UC). The second example has a spanning UC (many-to-many-to-many). |
|
Simple mandatory role constraint |
The constraint is displayed as a large dot at either end of the role connector. The example constraint means that each person was born in some country. |
|
Inclusive-or constraint (disjunctive mandatory role) |
The constraint is displayed as a circled dot connected to the constrained roles (or the junction of adjacent roles hosted by the same object type). The first constraint means that each visitor referenced in the model must have a passport or a driver licence (or both). The second means that each person is a parent of a person or a child of a person (or both). |
[player]
Person Country
Sport
played for …
Person
introduced to …
Food Date
Cat
[Cat] ate [Food] on [Date]
Cat
Food
Date
on …ate …
… in … on .. ate …
Person
City Date
Food
Student
enrolled in
“Enrolment !”
Course
resulted in
Grade
Person
smokes
Person
smokes
Person
was born in
Gender Country
is of
Language Person
speaks is president of
Country
Team
Place
Competition
… got … in …
Person Country
Sport
… played … for …
Person
was born in
Country
Person
was born in
Country
ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 3/6
Construct | Examples | Description/Notes |
Preferred internal UC |
A double bar on a UC indicates it underlies the preferred reference scheme. |
|
External UC (double-bar indicates preferred identifier) |
Here, each state is primarily identified by combining its country and state code. Each combination of country and state name also applies to only one state. |
|
Object Type Value Constraint |
Enumerations | |
Ranges are inclusive of end values by default. Round brackets are used to exclude an end value. Square brackets may be added to explicitly declare inclusion, e.g. the constraint on PositiveScore may also be specified as {(0..100]}. |
||
Multiple combinations are allowed. | ||
Role value constraint |
As for object type value constraints, but connected to the constrained role. Here, an age of a person must be at most 140 years. |
|
Subset constraint |
The arrow points from the subset end to the superset end (e.g. if a person smokes then that person is cancer prone). The role sequences at both ends must be compatible. A connection to the junction of 2 roles constrains that role pair. |
|
Join subset constraint |
The constrained role pair at the superset end is projected from a role path that involves a conceptual join on Language. The constraint declares that if an advisor serves in a country then that advisor must speak a language that is often used in that country. |
|
Exclusion constraint |
These constraints mean that no person is both married and widowed, and no person reviewed and authored the same book. Exclusion may apply between 2 or more compatible role sequences, possibly involving joins. |
Country CountryCode
has / is of
State
has
StateCode
is in
Country
(.code)
has
StateName
Gender
(.code)
Rating
{‘M’, ‘F’} (.nr) {1, 2, 3, 4, 5, 6, 7}
Rating
(.nr)
Grade
(.code)
{1..7} {‘A’..‘F’}
Age
(y:)
{0..}
PassScore
(%)
{50..100}
NegativeInt
{..-1}
PositiveScore
(%)
{(0..100}
NegativeTemperature
(oC:)
{-273.15..0)}
ExtremeTemperature
(oC:) {-100..-20, SQLchar
40..100}
{‘a’..’z’,
‘A’..’Z’,
‘0’..’9′,
‘_’}
Age
(y:)
Person
(.name)
has
{0..}
{0..140}
Person
is cancer prone
smokes
enrolled in
Course
… for … obtained …
Grade
speaks
Language
(.name)
is often used in
Advisor
(.nr)
serves in
Country
(.code)
Person
authored
Book
reviewed
is married
is widowed
ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 4/6
Construct | Examples | Description/Notes |
Exclusive-or constraint Also known as an xor constraint |
An exclusive-or constraint is simply the conjunction of an inclusive-or constraint and an exclusion constraint. The first two examples say that each academic is male or female but not both, and is tenured or contracted till some date but not both. The third example says each spouse is a husband or wife of a spouse but not both. The 1:1 nature of the fact type assumes monogamy. |
|
Equality constraint |
This constraint means that a patient’s systolic BP is recorded if and only if his/her diastolic BP is recorded. An equality constraint may apply between 2 or more compatible role sequences, possibly involving joins. |
|
Derived fact type, and derivation rule |
A fact type is either asserted, derived, or semiderived. A derived fact type is marked with an asterisk “*”. A derivation rule is supplied. A double asterisk “**” indicates derived and stored (eager evaluation). |
|
Semiderived fact type, and derivation rule |
A fact type is semiderived if some of its instances may be derived, and some of its instances may be simply asserted. It is marked by “+” (half an asterisk). “++”indicates semiderived and stored (eager evaluation for derived instances). |
|
Subtyping | All subtypes are proper subtypes. An arrow runs from subtype to supertype. A solid arrow indicates a path to the subtype’s preferred identifier (e.g. here, student employees are primarily identified by their employee number). A dashed arrow indicates the supertype has a different preferred identifier. |
|
Subtyping constraints |
A circled “X” indicates the subtypes are mutually exclusive. A circled dot indicates the supertype equals the union of the subtypes. The combination (xor constraint) indicates the subtypes partition the supertype (exclusive and exhaustive). |
Academic
is contracted till
is male
is female
is tenured
Date
Spouse
is a husband of / is a wife of
Patient
has systolicBloodPressure
has diasystolicPerson speaks
Language
speaks*
NrLanguages
*For each Person,
nrLanguages = count(languageSpoken).
[languageSpoken]
Person
is a grandparent of +
+
Person1 is a grandparent of Person2
if
Person1 is a parent of some Person3
who is a parent of Person2.
is a parent of
Student
(.nr)
Person
(.nr)
Student
Employee
Employee
(.nr)
Lecturer
Animal
Dog Cat
Person
Male
Person
Female
Person
TeamMember
Player Coach
ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 5/6
ObjectType
is a direct subtype of
Construct | Examples | Description/Notes |
Subtype derivation status |
A subtype may be • asserted, • derived (denoted by “*”), • or semiderived (denoted by “+”). If the subtype is asserted, it has no mark appended and has no derivation rule. If the subtype derived or semiderived, a derivation rule is supplied. |
|
Internal frequency constraint |
This constrains the number of times an occurring instance of a role or role sequence may appear in each population. Here: each jury has exactly 12 members; each panel that includes an expert includes at least 4 and at most 7 experts; each expert reviews at most 5 papers; each paper that is reviewed is reviewed by at least 2 experts; and each department and year that has staff numbers recorded in the quaternary appears there twice (once for each gender). |
|
External frequency constraint |
The example constraint has the following meaning. In this context, each combination of student and course relates to at most two enrolments (i.e. a student may enroll at most twice in the same course) |
|
Ring constraints |
E.g. | A ring predicate R is locally reflexive if and only if, for all x and y, xRy implies xRx. E.g. “knows” is locally but not globally reflexive. Reflexive, symmetric and transitive properties may also be enforced using semiderivation rather than by constraining asserted fact types. The example constrains the subtyping relationship in ORM to be acyclic (no cycles can be formed by a chain of subtyping connections) and strongly intransitive (no object type A can be both a direct subtype of another type B and an indirect subtype of B, where indirect subtyping means there is a chain of two or more subtyping relationships that lead from A to B). Ring constraints may be combined only if they are compatible, and one is not implied by the other. ORM tools ensure that only legal combinations are allowed. |
Person
MalePerson
Person
MalePerson* *Each MalePerson is a Person
who is of Gender ‘M’.
is of
Gender
(.code) {‘M’, ‘F’}
Person
+
Each derived Grandparent is a Person
who is a parent of some Person
who is a parent of some Person.
is a parent of
Grandparent+
Department
Gender
Quantity
Year
… in … had staff of … in …
2
Person
is a member of
Jury
12
Expert
is on / includes
Panel
reviews / is reviewed by
Paper
4..7
£5 ≥2
Enrollment
is by
Student
is in
Course
£2
Ring Constraints
Irreflexive
Asymmetric
Antisymmetric
Intransitive
Strongly Intransitive
Acyclic
Asymmetric + Intransitive
Acyclic + Intransitive
Acyclic + Strongly Intransitive
Symmetric + Irreflexive
etc.
A
Reflexive (locally)
Symmetric
Transitive
ORM 2 Graphical Notation.docx © 2010 T. Halpin Last updated: 2020 April 7 Page 6/6
Uniqueness
Mandatory
Subset, Equality, Exclusion
Frequency f
Irreflexive Acyclic
Antisymmetric Symmetric
Intransitive Acyclic-Intrans
Asymmetric Asym-Intrans
Strongly Intransitive etc.
Person
is a parent of
£2
Construct | Examples | Description/Notes |
Value comparison constraints |
The example constraint verbalizes as: For each Project, existing enddate >= startdate. |
|
Object cardinality constraint |
The example constraints ensure there is exactly one president and at most 100 senators (at any given time), |
|
Role cardinality constraint |
The example constraint ensures that at most one politician is the president (at any given time). |
|
Deontic constraints |
e.g. | Unlike alethic constraints, deontic constraint shapes are colored blue rather than violet. Most include “o” for “obligatory”. Deontic ring constraints use dashed lines. In the parenthood example, the alethic frequency constraint ensures that each person has at most two parents, the alethic ring constraint ensures that parenthood is acyclic, and the deontic ring constraint makes it obligatory for parenthood to be strongly intransitive. |
Textual constraints |
First-order constraints with no graphic notation may be expressed textually in the FORML 2 language. These examples use footnoting to capture a restricted uniqueness constraint and a restricted mandatory role constraint. |
|
Objectification display options: link fact types, and compact display. |
Internally, link fact types connect objectified associations to their component object types. By default, display of link fact types is suppressed. If displayed, dashed lines are used. Objectification object types may also be displayed without their defining components, using an object type shape containing a small predicate shape, as shown. |
Project
started on
Date
ended on
≥
[enddate]
[startdate]
> £ < ≥ e.g.
# £ 100
President
# = 1
Senator
Politician
is the president
# £ 1
Rank
(.code)
CompanyCar
(.regNr)
Employee
(.nr)
has
uses1, 2
{‘Exec’,
‘NonExec’}
1 Each Employee who has Rank ‘NonExec’ uses at most one CompanyCar.
2 Each Employee who has Rank ‘Exec’ uses some CompanyCar.
Student
enrolled in
“Enrolment !”
Course
was by is in