Sie sind auf Seite 1von 6

ORM 2 Graphical Notation

Terry Halpin

Construct Examples Description/Notes


Named soft rectangle, named hard rectangle,
Entity Type Country or Country or Country or named ellipse.
The soft rectangle shape is the default.
Named, dashed, soft rectangle
Value Type CountryCode or CountryCode or CountryCode (or hard rectangle or ellipse).

Entity type Abbreviation for injective reference


Country Course Company Building
with popular (.code) (.code) (.name) (.nr)
relationship to value type, e.g.
reference
mode Country CountryCode
has / is of

Entity type Abbreviation for reference type, e.g.


Height Mass Salary Price
with unit- (cm:) (kg:) (USD:) (EUR:)
based Height cmValue
has / is of
reference Height Salary Price
(cm: Length) (USD: Money) (EUR: Money)
mode Optionally, unit type may be displayed.
Entity type Abbreviation for reference type, e.g.
Book Website WebLink
with general (ISBN) (URL) (URL)
reference Book ISBN
has / is of
mode
Independent Instances of the type may exist, without
Country ! CountryCode !
Object Type playing any elementary fact roles

External This notation is tentative (yet to be finalized)


Address^
Object Type

Ordered set of 1 or more role boxes with at


Predicate smokes was born in … speaks … very well least one predicate reading in mixfix notation.
(unary, binary, If shown, object placeholders are denoted by
ternary, etc.) … played … for ... … in … on … ate ... “…”. If placeholders are not shown, unaries
are in prefix and binaries are in infix notation.
Duplicate type If an object type or predicate shape is
or predicate Person StateCode displayed more than once (on the same page
was born in
shape or different pages) it is shadowed.
Unary fact The smokes role may be played by instances
type Person of the Person object type
smokes

By default, predicate readings (binary or


Binary fact Person Country longer) are read left-to-right or top-to-
was born in
type Car bottom.
[employee]
Person Company An arrow-tip is used to display a different
employs reading direction.
[employer] drives
Person
made Role names may be displayed in square
brackets beside their role.
[manager] Person
Product
Forward and inverse readings for binaries
reports to / manages may be shown together, separated by “/”.

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 1/6
Construct Examples Description/Notes

Sport Person
Role names may be added in square
Ternary fact
brackets.
type [player]
Person Country Arrow-tips are used to reverse the default
… played … for ... … introduced … to ... left-right or top-down reading order.
Reading orders other than forward and
Food Cat
reverse are shown using named
Date Cat Food Date placeholders.
… ate … on ...
[Cat] ate [Food] on [Date]

Quaternary The above notes for the ternary case apply


fact type City Date here also.
Person Food
Fact types of higher arity (number of roles)
… in … on .. ate ... are also permitted.
“Enrolment !” The enrolment fact type is objectified as an
Objectification
entity type whose instances can play roles.
(a.k.a. nesting) Student Course
enrolled in In this example, the objectification type is
Grade
independent, so we can know about an
resulted in enrolment before the grade is obtained.
Internal
Person Person These are equivalent (by default,
uniqueness
smokes smokes predicates are assumed to be populated
constraint (UC)
with sets, so no whole fact may be
on unaries
duplicated).
The examples show the 4 possible
Internal UC on Gender Person Country
is of was born in patterns:
binaries
Language Person Country
1:n (one-to-many); n:1 (many-to-one);
speaks is president of
m:n (many-to-many); 1:1 (one-to-one0

Place The first example has two, 2-role UCs: the


Internal UC on
top UC forbids ties; the other UC ensures
ternaries.
Team Competition that each team gets only place per
… got … in ... competition (a dotted line excludes its role
For n-aries (n >
from the UC).
1) each UC Sport
The second example has a spanning UC
must span at
Person Country (many-to-many-to-many).
least n-1 roles … played … for ...

Simple
Person Country The example constraint means that each
mandatory
was born in person was born in some country.
role constraint
Person Country The mandatory role dot may be placed at
was born in either end of the role connector.
Inclusive-or
has The constraint is displayed as a circled dot
constraint Passport
connected to the constrained roles. The
(disjunctive Visitor example constraint means that each visitor
mandatory
DriverLicence referenced in the model must have a
role)
has passport or a driver licence (or both).
Preferred
Country CountryCode A double bar on a UC indicates it underlies
internal UC
has / is of the preferred reference scheme.

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 2/6
Construct Examples Description/Notes
has
External UC StateCode Here, each state is primarily identified by
(double-bar is in
combining its country and state code. Each
indicates State
Country combination of country and state name also
(.code)
preferred has
applies to only one state.
identifier) StateName

Gender Rating Enumerations


Object Type (.code) {‘M’, ‘F’} (.nr) {1, 2, 3, 4, 5, 6, 7}
Value
Constraint Ranges are inclusive of end values by
Rating Grade Age
NegativeInt
(.nr) (.code) (y:) default. Round brackets are used to exclude
{1..7} {‘A’..‘F’} {0..} {..-1} an end value. Square brackets may be added
to explicitly declare inclusion, e.g. the
PassScore PositiveScore NegativeTemperature
(%) (%) (oC:) constraint on PositiveScore may also be
specified as {(0..100]}.
{50..100} {(0..100} {-273.15..0)}

ExtremeTemperature {‘a’..’z’, Multiple combinations are allowed.


{-100..-20, ‘A’..’Z’,
(oC:) SQLchar
40..100} ‘0’..’9',
‘_’}

has As for object type value constraints, but


Role value Person Age {0..}
(.name) (y:) connected to the constrained role.
constraint
{0..140}

enrolled in
The arrow points from the subset end to the
is cancer prone
Subset superset end.
constraint Course
The role sequences at both ends must be
Person
compatible.
smokes Grade A connection to the junction of 2 roles
… for ... obtained ... constrains that role pair.
speaks is often used in The constrained role pair at the superset
Join subset Language
(.name) end is projected from a role path that
constraint
involves a conceptual join on Language. The
Advisor Country constraint declares that if an advisor serves
(.nr) (.code)
in a country then that advisor must speak a
serves in language that is often used in that country.

is married authored These constraints mean that no person is


Exclusion
both married and widowed, and no person
constraint
Person Book reviewed and authored the same book.
Exclusion may apply between 2 or more
is widowed reviewed compatible role sequences, possibly
involving joins.
is male An exclusive-or constraint is simply the
Exclusive-or is tenured
conjunction of an inclusive-or constraint and
constraint Academic an exclusion constraint.
Date Also known as an xor constraint.
is female is contracted till

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 3/6
Construct Examples Description/Notes
has systolic- This constraint means that a patient’s
Equality
systolic BP is recorded if and only if his/her
constraint
Patient BloodPressure diastolic BP is recorded.
An equality constraint may apply between 2
has diasystolic-
or more compatible role sequences,
possibly involving joins.
[languageSpoken] A fact type is either asserted, derived, or
Derived fact
Language semiderived.
type, and speaks
Person A derived fact type is marked with an
derivation rule
NrLanguages asterisk “*”. A derivation rule is supplied. A
speaks*
double asterisk “**” indicates derived and
*For each Person,
nrLanguages = count(languageSpoken). stored (eager evaluation).

is a parent of A fact type is semiderived if some of its


Semiderived
instances may be derived, and some of its
fact type, +
Person1 is a grandparent of Person2 instances may be simply asserted.
and derivation Person
if +
rule Person1 is a parent of some Person3
It is marked by “ ” (half an asterisk).
++
who is a parent of Person2. “ ”indicates semiderived and stored (eager
+
is a grandparent of evaluation for derived instances).

Person All subtypes are proper subtypes. An arrow


Subtyping (.nr) runs from subtype to supertype. A solid
arrow indicates a path to the subtype’s
Student Employee preferred identifier (e.g. here, student
(.nr) (.nr) employees are primarily identified by their
employee number). A dashed arrow
indicates the supertype has a different
Student
Employee Lecturer preferred identifier.

Animal TeamMember Person A circled “X” indicates the subtypes are


Subtyping
mutually exclusive. A circled dot indicates
constraints
the supertype equals the union of the
Dog Cat Player Coach
Male Female subtypes. The combination (xor constraint)
Person Person
indicates the subtypes partition the
supertype (exclusive and exhaustive).

Gender A subtype may be


Subtype Person Person
is of
(.code) {‘M’, ‘F’} • asserted,
derivation
status • derived (denoted by “*”),
+
MalePerson MalePerson* *Each MalePerson is a Person • or semiderived (denoted by “ ”).
who is of Gender ‘M’.
is a parent of
If the subtype is asserted, it has no mark
appended and has no derivation rule.
Person
If the subtype derived or semiderived, a
+
Each derived Grandparent is a Person derivation rule is supplied.
Grandparent
+ who is a parent of some Person
who is a parent of some Person.

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 4/6
Construct Examples Description/Notes
12 This constrains the number of times an
Internal Person Jury is on / includes occurring instance of a role or role sequence
frequency is a member of
Panel may appear in each population.
constraint
4..7 Here: each jury has exactly 12 members;
Expert ≤5 ≥2 each panel that includes an expert includes
Paper at least 4 and at most 7 experts; each expert
reviews / is reviewed by reviews at most 5 papers; each paper that is
reviewed is reviewed by at least 2 experts;
Year Gender
and each department and year that has staff
2 numbers recorded in the quaternary
Department Quantity
appears there twice (once for each gender).
… in … had staff of … in ...

is by The example constraint has the following


External Student meaning. In this context, each combination
frequency
Enrollment ≤2 of student and course relates to at most two
constraint
enrolments (i.e. a student may enroll at
Course
is in most twice in the same course)

A The ring constraints currently supported are


Ring Irreflexive
shown in the middle column.
constraints
Asymmetric
Mainly for mapping to/from OWL, we are
Intransitive
considering adding support for the following
Antisymmetric additional ring constraints:
Acyclic
Reflexive
Asymmetric + Intransitive

Acyclic + Intransitive Transitive

Symmetric

Symmetric + Irreflexive

Symmetric + Intransitive
= Purely Reflexive

started on The example constraint verbalizes as:


Value- ≤ ≥ [startdate]
> < e.g. For each Project,
comparison
Project ≥ Date existing enddate >= startdate.
constraints
[enddate]
ended on

Object #=1 # ≤ 100 The example constraints ensure there is


cardinality President Senator exactly one president and at most 100
constraint senators (at any given time),
Role is the president The example constraint ensures that at most
Politician
cardinality #≤1
one politician plays the role of president (at
constraint any given time).

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 5/6
Construct Examples Description/Notes

Uniqueness Unlike alethic constraints, deontic


Deontic
constraint shapes are colored
constraints Mandatory
blue rather than violet. Most
Subset, Equality, Exclusion
include “o” for “obligatory”.
Frequency f Deontic ring constraints instead
Irreflexive Acyclic
use dashed lines.

Asymmetric Asym-Intrans In the parenthood example, the


Intransitive Acyclic-Intrans alethic frequency constraint
ensures that each person has at
Antisymmetric Symmetric
most two parents, the alethic ring
Purely Reflexive = etc. constraint ensures that
parenthood is acyclic, and the
e.g.
deontic ring constraint makes it
Person
obligatory for parenthood to be
intransitive.

≤2
is a parent of

has First-order constraints with no


Textual {‘Exec’, Rank Employee CompanyCar
(.code) (.nr) (.regNr) graphic notation may be
constraints ‘NonExec’} uses 1, 2
expressed textually in the FORML
1
Each Employee who has Rank ‘NonExec’ uses at most one CompanyCar. 2 language. These examples use
2
Each Employee who has Rank ‘Exec’ uses some CompanyCar. footnoting to capture a restricted
uniqueness constraint and a
restricted mandatory role
constraint.

ORM 2 Graphical Notation.docx © 2010, T. Halpin Last updated: 2010 Feb 4 Page 6/6

Das könnte Ihnen auch gefallen