![](bg3.png)
Figure 2: Set of entities.
2.2.1 Entities in Class Diagram
Definition 2 (LF of Entities). Let D be a UML class
diagram. A UML notation (E, e) of D, where e is an
instance of an entity E, is represented in Φ
D
by a bi-
nary predicate E. The first term of E is a constant,
called the context of e, and the second term is a con-
stant, called the identifier of e.
The entity predicates are partially ordered by a
kind-of relation, denoted by ≺ (Figure 2).
Example: The LF of the class Pilot is Φ
1
=
package(⊤, Pkg) ∧ class(Pkg, Pkg.Pilot) ∧
attribute(Pkg.Pilot, Pkg.Pilot.licenseDate) ∧
operation(Pkg.Pilot, Pkg.Pilot.fly) ∧ parame-
ter(Pkg.Pilot.fly, Pkg.Pilot.fly.planeID). The pred-
icates class, attribute, operation and parameter
represents some entities. Φ
1
indicates that Pilot, with
the single identifier Pkg.Pilot, is a class, licenseDate
is an attribute, fly is an operation, and planeID is a
parameter of fly. All of these elements are defined
in package Pkg. Remember that each element is
enclosed in a context, then the context of Pilot is Pkg,
the one of both licenseDate and fly is Pilot and the one
of planeID is fly.
First, note that the more general context is repre-
sented by the constant ⊤. Second, note that each ele-
ment is identified by a constant: for visibility reasons,
in our example an identifier is the element’s name pre-
fixed by its full context (but identifiers may be num-
bers as id
1
, id
2
, etc.). Third, Φ
1
will be completed in
Section 2.2.3 with some properties of these entities.
2.2.2 Relations in Class Diagram
There are two kinds of relations between classes: gen-
eralization and association.
Definition 3 (LF of Generalization). Let D be
a UML class diagram with notations (class,C
1
),
(class,C
2
) and (generalization link,g), such as g links
the more general class C
1
and the more specific C
2
.
The notation (generalization link,g) is represented in
Φ
D
by a ternary predicate generalization, where the
first term is the context of g, the second term is the
identifier of C
1
and the third term is the identifier of
C
2
.
Example: Descendants of Person are defined by Φ
2
=
generalization(Pkg, Pkg.Person, Pkg.Pilot) ∧ gener-
alization(Pkg, Pkg.Person, Pkg.Customer) ∧ general-
ization(Pkg, Pkg.Customer, Pkg.FrequentFlyer).
We have always chosen to represent a UML asso-
ciation relation as its most complete form, i.e. by us-
ing an association class. Then, each association from
a class diagram can be expended to an association that
is centralized by an association class.
Definition 4 (LF of Association). Let D be
a UML class diagram with notations (class,C
1
),
(class,C
2
), (association class,A), (role name,r
1
) and
(role name,r
2
) such as: C
1
and C
2
are linked together
through A; r
1
and r
2
are the two ends of A and are
respectively combined with C
1
and C
2
. An element
r
i
is an entity represented in Φ
D
by a binary predi-
cate role. A role r
i
and a class C
i
are combined in
Φ
D
by using a ternary predicate assoEnd, where the
first term is the context of A, the second is the identi-
fier of C
i
and the third is the identifier of r
i
. Then, a
role r
i
and A are linked in Φ
D
by a ternary predicate
association, where the first term is the context of A,
the second is the identifier of A and the third is the
identifier of r
i
.
Example: Association between Pilot and Plane:
Φ
3
= assoClass(Pkg, Pkg.Flight) ∧ role(Pkg,
Pkg.assignedPilot) ∧ role(Pkg, Pkg.assignedPlane)
∧ assoEnd(Pkg, Pkg.Pilot, Pkg.assignedPilot) ∧ as-
soEnd(Pkg, Pkg.Plane, Pkg.assignedPlane) ∧ asso-
ciation(Pkg, Pkg.Flight, Pkg.assignedPilot) ∧ asso-
ciation(Pkg, Pkg.Flight, Pkg.assignedPlane). The
constants Pkg.assignedPilot and Pkg.assignedPlane
identify the two ends of the association, which is cen-
tralized by the association class Flight.
Please first remark that the Definition 4 can be eas-
ily extended for n-ary associations (n≥ 2). Second,
note that Φ
3
will be completed in Section 2.2.3 with
properties.
2.2.3 Properties of Elements
Definition 5 (LF of Properties’ Elements). Let D be
a UML class diagram with a notation (P, (a,v)), where
the value for property P that is applied to the entity
2
or relation a is v. Notation (P, (a,v)) is represented
in Φ
D
by a ternary predicate P, where the first term
is the context of a, the second term is the identifier of
a and the third term is the identifier of the notation
(propVal,v) in the same context.
The property predicates are partially ordered by a
kind-of relation, denoted by ≺, whose greatest predi-
cate is property (Figure 3).
2
except propVal of course
A USEFUL LOGICAL SEMANTICS OF UML FOR QUERYING AND CHECKING UML CLASS DIAGRAM
181