Database Reference
In-Depth Information
Example 30
Let us consider the set of integers
I
with the set of binary operators
{+
−
∗}
,
,
for addition, substraction, and multiplication, respectively, and the unary
operator
|
_
|
(finding absolute value of integers), so that
Σ
P
={I
,
+
,
−
,
∗
,
|
_
|}
.
Then we can define the set of only unary operators
Σ
={I
,
_
+
n,
_
−
n,
_
.
For instance, let us consider the
derived
unary operator '
(
_
)
+
n
'. Hence, given
any term
t
∗
n
|
for all finite positive integers
n
≥
1
}∪{|
_
|}
2
∈
T
P
X
, that is, a term
(t)
∈
T
P
X
, one can form the term
t
+
n
∈
T
P
X
by
first applying
(
_
)
n)
.
This derivation can be seen from the commutative diagram (b) above: for
((t),n)
+
n
to
t
and then
μ
X
,
t
+
n
=
μ
X
((t)
+
2
2
2
∈
(
T
P
X
×
T
P
X)
, for operation '
+
')
⊆
Σ
P
(
T
P
X)
,wehave
inr
T
P
X
((t),n)
=
2
(t)
+
n
∈
T
P
X
,
Σ
P
μ
X
((t),n)
=
(t,n)
∈
(
T
P
X
×
T
P
X,
for operation '
+
'
)
⊆
Σ
P
(
∈
T
P
X
. Derived operators can
be seen as context and then the operator
μ
X
is formally needed to remove the brack-
ets after plugging terms in the holes of a context.
T
P
X)
, so that
inr
X
(t,n)
=
t
+
n
=
μ
X
((t)
+
n)
Let us show the definition of the power-view operator
T
for a database instance
A
(a set of relational tables), introduced in Sect.
1.4.1
, based on the free algebra of
ground terms with the signature
Σ
P
=
Σ
R
(a particular case of Example
29
) where
Σ
R
is the signature of the “select-project-join+union” relational subalgebra in Def-
inition
31
, such that for a given database schema
A
=
(S
F
,Σ
A
)
its set of relational
symbols is considered as a set of variables,
X
=
S
A
∪{
r
∅
}={
r
1
,...,r
n
,r
∅
}
(or, as
usual,
X
=
A
), with
}
i
=−
X
X
2
}
X
ar(o
k
)
Σ
R
(X)
=
=
×{
i
×{
i
o
k
∈
Σ
R
o
i
∈
Σ
R
,ar(o
i
)
=
1
,i
≥
1
,
0
1
where the unary operators are: the family of projections _
, selections _ WHERE
C
i
operators, and two binary operators are Cartesian product _ TIMES _ and
_ UNION _ operators (Join is a combination of the Cartesian product and selec-
tion). Thus, for a given “assignment”
α
[
S
i
]
α
∗
(
:
X
→
A
⊆
TA
,wehave
A
=
A
)
=
{
⊥}
with the relational tables
R
i
=
=
R
1
,...,R
n
,
α(r
i
),i
1
,...,n
, where
α
is a R-
Σ
egd
Σ
tgd
A
algebra which satisfies all integrity constraints
Σ
A
=
A
∪
of this schema
A
A
for all database-instances (i.e., objects) in
DB
in Theorem
1
, Sect.
3.1.2
) is the image of the mapping
α
, with fixed assignment
α(r
∅
)
. So that
A
=
Im(α)
(with
⊥∈
=⊥
(empty relation
⊥=
with empty tuple
for the empty type (relational
symbol)
r
∅
∈R
A
(in Definition
10
, Sect.
2.4.1
). Consequently, for a schema
and an
α
∗
(
R-algebra
α
which is a model of
)
is an
object in
DB
, the set of views (i.e., relations)
TA
is determined from the
unique epic
(X
Σ
P
)
-homomorphism
α
#
, from the initial
(X
Σ
P
)
-algebra
(
T
P
X,
)
into this
(X
A
, such that the instance-database
A
=
A
)
. This is represented by the following commutative
diagram in
Set
(
X
is the set of rel. symbols in
Σ
P
)
-algebra
(T A,
[
α,h
A
]
A
),