Database Reference
In-Depth Information
troduced in Sects.
1.4.2
and
2.1
) are interpreted (instantiated) by the R-algebras in
the denotational instance-level
DB
category. Thus,
DB
morphisms cover all SPJRU-
algebra terms.
Now we will show that
DB
morphisms are able to support
all Σ
RE
algebra terms
(from Definition
31
, the SPJRU (
Σ
R
) is a strict subalgebra of the
Σ
RE
algebra) and
hence the operations as _ MINUS _ and all update relational database operations.
As we will see, in the
operational semantics
of the database mapping, we will use
the update database operations as well. Consequently, the fact that such operations
can be expressed in the
DB
category by the particular morphisms between instance
databases is an important “full relational-algebra closure” property of the denota-
tional database
DB
category.
:
→
Proposition 24
There is an evaluation functor Eval
RA
DB
which evaluates
the terms in
RA
,
as follows
:
1.
For each object t
RA
∈
Ob
RA
=
T
RA
X we define
:
Eval(t
RA
)
{
t
RA
#
,
⊥}
.
2.
Foreachatomicarrowo
i
:
t
RA
→
o
i
(t
RA
)
,
let r
1
and r be the relational sym-
bols of the relational table R
1
=
#
,
respectively
,
with
two auxiliary relational symbols r
q
1
and r
q
2
of the same type as r
.
Hence
,
we
define the database schemas
t
RA
#
and R
=
o
i
(t
RA
)
) and an R-algebra
α such that α(r
1
)
=
R
1
and α(r)
=
R
,
with the operations q
A,
1
∈
O(r
1
,r
q
1
)
,
v
1
∈
O(r
q
1
,r)
,
q
A,
2
∈
O(r
1
,r
q
2
) and v
2
∈
O(r
q
2
,r)
.
Then we define the component of Eval for the arrows
,
in the following two
cases
:
2.1.
If o
i
is a unary operation _
REDUCE
S
2
TO
S
1
where
S
1
=
nr
r
1
(i),... , nr
r
1
(i
A
=
(
{
r
1
}
,
∅
) and
B
=
(
{
r
1
}
,
∅
k)
and
S
2
=
nr
r
1
(j),..., nr
r
1
(j
k)
+
+
≥
≥
+
+
≤
for i
1,
k
0,
j>i
k and j
k
ar(r
1
)
,
then
α(v
1
)
α(q
A,
2
),q
⊥
:
α
∗
(
α
∗
(
·
·
A
→
B
Eval(o
i
)
α(q
A,
1
),α(v
2
)
)
),
=
t
RA
[
S
1
]
#
=
t
RA
[
S
2
]
#
,
where α(v
1
)
:
so that α(r
q
1
)
and α(r
q
2
)
α(r
q
1
)
→
R and α(v
2
)
:
α(r
q
2
)
→
R are
two
injective
functions
,
R
=
α(r
q
1
)
∪
α(r
q
2
)
,
α(q
A,
1
)
=
π
i,...,i
+
k
:
R
1
→
α(r
q
1
) and α(q
A,
2
)
=
α(r
q
2
)
.
2.2.
Otherwise
,
when o
i
is another unary operation
,
we define
:
π
j,...,j
+
k
:
R
1
→
α(v
1
)
α(q
A,
1
),q
⊥
:
α
∗
(
α
∗
(
Eval(o
i
)
·
A
)
→
B
),
so that α(r
q
1
)
R is an identity function
,
while
α(q
A,
1
) is defined for the following remaining cases
:
•
=
R and α(v
1
)
=
id
R
:
R
→
o
i
is a unary operation _
RENAME
name
2
AS
name
1
.
Then r
=
r
1
with
α(r
q
1
)
=
R
=
R
1
and the identity function α(q
A,
1
)
=
id
R
:
R
→
R
.
•
o
i
is a unary operation _
[
S
]
with S
=
nr
r
1
(i
1
),...nr
r
1
(i
k
)
.
Then
,
α(q
A,
1
)
=
π
i
1
,...,i
k
:
R
1
→
R
.