Database Reference
In-Depth Information
1. (
PK
)
function for
1
≤
i
≤
n
−
k
,
g
i
=
α(q
i
)
:
α(r
i
)
×
α(r
i
)
→
α(r
) is a con-
stant function
(
where q
i
=
((_ )
1
(
y
)
∧
(_ )
2
(
z
)
∧
((y
1
1
=
z
1
1
)
∧···∧
(y
1
k
=
z
1
k
))
∧
((y
j
1
=
z
l
1
)
∨···∨
(y
j
n
−
k
=
z
l
n
−
k
)))
⇒
(_ )(
0
,
1
)
∈
O(r
i
,r
i
)
),
that
is
,
for every tuple
d
1
,
d
2
∈
α(r
i
)
×
α(r
i
)
=
r
i
can(
I
,D)
×
r
i
can(
I
,D)
,
.
2. (
FK
)
function when n
g
i
(
d
1
,
d
2
)
=
−
k
+
1
≤
i
≤
n
,
g
i
=
α(q
i
)
:
α(r
i,
1
)
×
α(r
i,
2
)
→
α(r
)
(
where q
i
=
((_ )
1
(
x
i
)
∧
(_ )
2
(
t
i
))
⇒
(_ )(
0
,
1
)
∈
O(r
i,
1
,r
i,
2
)
)
is a constant
function
,
that is
,
for every tuple
d
1
,
d
2
∈
α(r
i,
1
)
×
α(r
i,
2
)
=
r
i,
1
can(
I
,D)
×
r
i,
2
can(
I
,D)
,
g
i
(
d
1
,
d
2
)
=
.
Proof
Directly from definitions presented in this section and by Propositions
16
and
17
. From the definition of
f
in
, we obtain that for each relational symbol
r
∈
S
G
(which is a relation both in
r
ret(
I
,D)
⊆
r
can(
I
,D)
, that
is, the
ret(
I
,D)
is a subdatabase of the
can(
I
,D)
, that is, we obtain the monomor-
phism
f
in
:
G
and
G
T
) we obtain that
can(
I
,D)
and hence
f
in
=
T ret(
I
,D)
.
ret(
I
,D)
→
Remark
If we were to interpret the foreign key integrity constraints in
Σ
tgd
as
the standard inter-schema mapping based on tgds, that is, by the mapping operad
M
GG
=
MakeOperads(TgdsToSOtgd(Σ
tgd
:
G
→
G
G
))
then we would obtain the
morphisms in
DB
,
⊥
}∪
id
r
:
S
T
:
f
Σ
tg
G
={
g
1
,...,g
k
,q
α(r)
→
α(r)
|
r
∈
can(
I
,D)
⇒
can(
I
,D),
where each function
g
i
=
α((
_
)
1
(
x
i
))
⇒
(
_
)(
t
i
)
:
α(r
i,
1
)
→
α(r
i,
2
)
,for1
≤
i
≤
k
, is defined by: for every tuple
d
1
,...,d
n
∈
α(r
i,
1
)
=
r
i,
1
ret(
I
,D)
,
g
i
(
d
1
,...,
d
n
=
{
}
=
d
i
1
,...,d
i
h
∈
=
i
1
,...,i
h
)
t
such that
π
K
(
t
)
and for each
i/
K
(ordered
≤
≤
{
}
=
sequence of indexes in
key(r
i,
2
)
) such that 1
i
ar(r
i,
2
)
,
π
i
(
t
)
I
T
(f
r
2
,i
)(v
i
1
,
...,v
i
h
)
.
That is, the endomorphism
f
Σ
tg
G
:
G
→
G
would implement the process defined
previously by the rules in (FR). But we have explained that we avoid representing
the tgd's integrity constraint as an endomorphism (i.e., a morphism with the same
source and target object,
G
in this case) with a nonempty information flux, in order
to avoid the undesirable side-effects produced by their compositions with the real
(desiderated) inter-schema mappings. We avoided it by representing the integrity
constraints by “logic” mappings with target schema
A
, which have the empty in-
formation flux (as can be seen for
f
Σ
G
in this Corollary
15
).
4.2.3.1 Query Rewriting Coalgebra Semantics
The computation of a query
q
over a global schema
G
requires the building of a
canonical database
can(
,D)
, which is generally infinite. In order to overcome this
problem, a
query rewriting algorithm
[
2
] consists of two separate phases:
1. Instead of referring explicitly to the canonical database for query answering, this
algorithm transforms the original lifted query
q
into a new query
exp
I
(q)
over
G
a global schema, called the
expansion of q w.r.t. Σ
tgd
G
, such that the answer to