Database Reference
In-Depth Information
it is easy to verify in
DB
that
Tg
=
g
◦
η
OP
B
g
η
OP
B
◦
, from
Tg
g
φ
g
f
=
η
O
B
◦
η
O
C
◦
η
O
B
◦
=
◦
g
◦
f
=
φ(g)
◦
φ(f)
φθ
−
1
θ(g)
◦
φθ
−
1
θ(f)
=
K
1
θθ
−
1
(g
T
)
◦
K
1
θθ
−
1
(f
T
)
=
K
1
(g
T
)
K
1
(f
T
).
=
◦
Thus, each arrow
f
T
:
A
−→
B
in
DB
T
is “internalized” in
DB
by its represen-
K
1
(f
T
)
φθ
−
1
(f
T
)
η
O
B
◦
θ
−
1
(f
T
)
B
, where
θ
−
1
(f
T
)
tation
f
=
=
:
A
−→
:
A
−→
TB
is a program equivalent to the database mapping
f
:
A
−→
B
, i.e.,
θ
−
1
(f
T
)
f
.
The functor
K
is faithful. In fact, for any two arrows
f
T
,h
T
:
≈
A
−→
B
in
DB
T
,
K
1
(f
T
)
K
1
(h
T
)
implies
f
T
=
h
T
. Indeed, from
K
1
(f
T
)
K
1
(h
T
)
=
=
we obtain
φθ
−
1
(f
T
)
φθ
−
1
(h
T
)
, and if we apply a bijection
φθ
−
1
, we obtain
=
φθ
−
1
φθ
−
1
(f
T
)
φθ
−
1
φθ
−
1
(h
T
)
, i.e.,
θθ
−
1
(f
T
)
θθ
−
1
(h
T
)
, or equivalently,
=
=
h
T
(the compositions
θθ
−
1
and
φφ
−
1
are the identity functions).
Let us show that
K
is an isomorphism: from the adjunction
(F
T
,G
T
,η
T
,ε
T
)
f
T
=
:
DB
T
, where
F
T
is identity,
F
T
θφ
−
1
, we obtain that
F
T
◦
DB
−→
K
=
I
DB
T
and
K
◦
F
T
=
I
DB
. Thus, the functor
K
is an isomorphism of
DB
and Kleisli category
DB
T
.
Notice that from Theorem
12
in Sect.
8.1.1
,
DB
T
(Υ,A)
TA
Υ
A
Υ
=
=
TA
and
DB
T
(Υ,f
T
)
Tθ
−
1
(f
T
)
Tθ
−
1
(f
T
)
.
id
Υ
⊗
=
Thus,
K
0
(A)
DB
T
(Υ,A)
, and for
f
T
:
B
,
K
1
(f
T
)
=
A
TA
=
A
→
=
is
−
1
φθ
−
1
(f
T
)
=
η
OP
◦
θ
−
1
(f
T
)
:
A
→
B
, and from the fact that
Tg
≈
cod(g)
◦
g
=
η
OP
cod(g)
◦
g
for any arrow
g
in
DB
, we obtain
K
1
(f
T
)
≈
DB
T
(Υ,f
T
)
. Consequently,
we obtain the natural isomorphism
ϕ
:
DB
T
(Υ,
_
)
K
.
:
I
DB
−→
Remark
It is easy to verify that a natural isomorphism
η
T
of the monad
:
−→
(T,η,μ)
is equal to the natural transformation
η
K
G
T
(by considering that
DB
is defined by
G
T
=
T
0
G
T
:
DB
T
−→
and for any
f
T
:
−→
A
B
in
DB
T
,
G
T
(f
T
)
Tθ
−
1
(f
T
)
TB
).
Hence, the functor
F
T
has two different adjunctions: the universal adjunction
(F
T
,G
T
,η
T
,μ
T
)
which defines the same monad
(T,η,μ)
, and this particular (for
the
DB
category only) isomorphism's adjunction
(F
T
,K,η
I
,μ
I
)
which defines the
trivial identity monad.
μ
B
◦
:
TA
−→
We are now ready to define the semantics of queries in
DB
category and the
categorial definition of
query equivalence
. This is important in the context of the
Database integration/exchange and for the theory of
query-rewriting
[
8
].
When we define a mapping (i.e., an arrow or morphism)
f
B
between
two simple databases
A
and
B
, we define implicitly the information flux
f
, i.e.,
the set of views of
A
transferred by this mapping into
B
. Thus, in the context of
the query-rewriting, we consider only the queries (i.e., view-maps) whose resulting
:
A
−→