Database Reference
In-Depth Information
P
i
1
is the sequential composition of
RA
-arrows from
st
(m)
to
st
(k)
(as specified by point 2 of Theorem
11
), and
α
∗
=
where
P
i
n
◦···◦
T
P
(st
(m))
and
α
1
=
T
P
(st
(k))
M
P
i
n
◦···◦
P
i
1
⇒
and hence
(α
∗
=======
α
1
)
T
P
(F
P
(f ))
.
The arrow
F
P
(f )
in
R
P
is an
atomic transaction
, while the bottom arrow
g
:
A
→
A
1
is a morphism in the
DB
category from the instance-database
A
=
Out
DB
(st
(m))
into the updated database
A
1
=
=
Out
DB
(st
(m))
after this atomic
transaction.
This morphism
g
=
g
n
◦···◦
g
1
, where each
g
j
,1
≤
j
≤
n
, is a morphism ob-
tained by Corollary
17
for a given schema mapping
M
i
={
Φ
i
}:
A
→
A
and ob-
tained by Proposition
26
for a given
RA
-algebra arrow
P
i
j
(in Sect.
5.3
).
As a result, we obtain that each atomic transaction produces one morphism in the
DB
category, between the (consistent) database instances (that are the
models
)ofa
schema
A
, before and after such an atomic transaction:
Corollary 21
and a source program P with SQL
statements
,
each atomic transaction of this program P will result in a morphism
in the
DB
category
,
between the models
(
i
.
e
.,
consistent database instances
)
of a
schema
For a given database schema
A
,
before and after such an atomic transaction
.
This morphism is the result of a specific schema mapping from
A
,
thus it is
representable by a categorial semantics of a database mapping system in Sect
.
4.1.2
.
A
into
A
Notice that this corollary is valid not only for all SQL program transactions (the
data manipulation language DML), but also for the DDL functions, as CREATE
TABLE and DROP TABLE, which change the database schemas as well:
1. In the case of a creation of a new table, for a relation
r
∈
A
=
(S
A
,Σ
A
)
,we
my define a new schema
B
=
(S
A
∪{
r
}
,Σ
A
)
with the schema mapping
M
AB
=
, where
Φ
is the SOtgd
r
i
∈
S
A
∀
x
i
(r
i
(
x
i
)
r
i
(
x
i
))
.
{
Φ
}:
A
→
B
⇒
2. In the case of dropping of a table, i.e., of a relation
r
∈
A
=
(S
A
,Σ
A
)
,wemy
B
=
(S
A
\{
}
M
AB
=
define a new schema
r
,Σ
A
\{
r
}
)
with the schema mapping
, where
Φ
is the SOtgd
r
i
∈
S
B
∀
x
i
(r
i
(
x
i
)
⇒
r
i
(
x
i
))
.
Consequently, the whole story of the changes of a given database my be rep-
resented by the schema mappings, and their functorial denotational semantics
based on
DB
category (in Sect.
4.1.2
).
{
Φ
}:
A
→
B
6.3
The Concurrent-Categorial RBD Machine
Most DBMSs are multiple-user (program) systems, that is, they are systems that
allow any number of transactions to access the same database at the same time.
We need the universal machine to provide
M
U
time-sharing features: each con-
temporary execution of programs is divided into a number of time-sharing windows
where resource of machine is exclusively given to an particular application program,
with the constraint that each conversation with the RDB machine
M
R
is completely
closed inside such a time-window (atomic conversations in the time-sharing sce-
nario). Hence each communication data between a universal and an RDB machine