as follows:
Definition 1 (Selection Predicates) Selection predi-
cates correspond to the σ-operator of the rel. alge-
bra. Let σ
scond
(r(R
name
)) be such a selection with
the conjunctive select condition scond. Each con-
junct of the select condition has to have either the
form s = A γ k or might be a attribute selec-
tion s = A γ B with γ ∈ {≤, <, =, 6=, >, ≥},
A, B ∈ R
name
, and k ∈ dom(A). This selection
σ
scond
(r(R
name
)) corresponds to a set of selection
predicates of the form {[name.s
1
], . . . , [name.s
n
]}
with n ∈ N and n = |scond|. Here, for all s
i
with
1 ≤ i ≤ n also s
i
∈ scond holds.
Example 1 (Selection Predicates) Let’s assume the
relation Movies(MID
, name, FSK, genre,
actors, info). A query could ask for all action
movies with an FSK
1
greater than 16 years: (1) rel.
algebra: σ
FSK>16∧genre=
′
action
′
(r(R
movies
)); (2)
calculus: {a, b, c, d, e, f|movies(a, b, c, d, e, f ) ∧
c > 16 ∧ d =
′
action
′
}; (3) selection predi-
cates: {[movies.FSK > 16], [movies.genre =
′
action
′
]}
Definition 2 (Join Predicates) Join predicates cor-
respond to the ⋊⋉
θ
-operator of the rel. algebra. Let
r(R
name
1
) ⋊⋉
jcond
r(R
name
2
) be such a θ-join with the
conjunctive join condition jcond. Each conjunct of
the join condition has to have the form j = A θ B
with θ ∈ {≤, <, =, 6=, >, ≥}, A ∈ R
name
1
, and
B ∈ R
name
2
. This join corresponds to a join pred-
icate of the form [name
1
, name
2
, (j
′
1
, . . . , j
′
n
)] with
n ∈ N, and 1 ≤ n ≤ |jcond|. We claim a lexico-
graphical order of the relation names within a join
predicate. Furthermore, we claim that in each con-
junct j
′
i
with i ∈ N, and 1 ≤ i ≤ n the relation
name is prefixed to each attribute. A conjunct in rel.
algebra j
i
= A θ B with θ ∈ {≤, <, =, 6=, >, ≥},
A ∈ R
name
1
, and B ∈ R
name
2
is represented as
j
′
i
= name
1
.A θ name
2
.B.
Example 2 (Join Predicates) Let us assume
the relation from Example 1 and the relation
shown
in(date, time, SID, MID). An
example query that joins both relations could
use the movie identifier MID: (1) rel. algebra:
r(R
movies
) ⋊⋉
MID=MID
r(R
shown
in
) (2) calculus
2
:
{a, b, c, d, e, f, g, h, i, j|movies(a, b, c, d, e, f) ∧
shown
in(g, h, i, j) ∧ a = j} (3) join predi-
cate: [movies, shown
in, (movies.MID =
shown
in.MID)]
In order to support self joins we allow the re-
naming of tables similar to the TABLE
NAME-AS-
1
The FSK in Germany specifies the minimal age re-
quired for watching a movie.
2
{a, b, c, d, e, f, g, h, i, a|movies(a, b, c, d, e, f ) ∧
shown
in(g, h, i, a)} would also be correct. We here
used a “θ -join compatible notation”
ALIAS-construct of SQL. Such an alias is written as
name@alias and replaces the name in all affected
predicates.
Definition 3 (Projection Predicates) Projection
predicates correspond to the π-operator of the
rel. algebra. A projection π
X
(r(R
name
)) with
X ⊆ R
name
is written as a projection predicate
[name(x
1
, . . . , x
n
)] with n ∈ N, 1 ≤ n ≤ |X|,
and {x
1
, . . . , x
n
} = X. Projections that base
on join results like π
X
1
,X
2
,...,X
i
(r(R
name
1
) ⋊⋉
θ
1
r(R
name
2
) ⋊⋉
θ
2
· · · ⋊⋉
θ
i−1
r(R
name
i
)) with
i, j ∈ N, 1 ≤ j ≤ i, and X
j
⊆ R
name
j
,
1 ≤ n
j
≤ |X
j
|, {x
j
1
, . . . , x
j
n
j
} = X
j
are writ-
ten as projection predicate [name
1
(x
1
1
, . . . , x
1
n
1
),
name
2
(x
2
1
, . . . , x
2
n
2
), . . . , name
i
(x
i
1
, . . . , x
i
n
i
)].
In calculus queries all exist quantified attributes that
do not have any selecting affect are marked by “
”.
We handle attributes that are not specified in a projec-
tion predicate in a similar way.
Example 3 (Projection Predicates) Let us assume
the relation from Example 1. An example query
might ask for FSK, genre, and name: (1) rel.
algebra: π
name,genre,FSK
(r(R
movies
)) (2) calculus:
{x, y, z|movies( , x, z, , , y)} (3) projection pred-
icate: [movies(FSK, genre, name)]
Another example query might be based on
the join result of Example 2 and ask for
name, date, and time: (1) rel. algebra:
π
name,date,time
(r(R
movies
) ⋊⋉
MID=MID
r(R
shown
in
))
(2) calculus: {b, g, h|movies(a, b, c, d, e, f ) ∧
shown
in(g, h, i, j) ∧ a = j} (3) join predi-
cate: [movies, shown
in, (movies.MID =
shown
in.MID)] (4) projection predicate:
[movies(name), shown
in(date, time)]
With these definitions a predicate sequence query can
be defined. Therefore, P P is the set of all projection
predicates, V P is the set of all join predicates
3
, and
SP is the union of all selection predicate sets.
Definition 4 (Predicate Sequence Query) With
V ⊆ V P , pp ∈ P P ∪ {ε}, S ⊆ SP ,
and V ∪ {pp} ∪ S 6= ∅ a conjunctive
query Q =
V
v p∈V
vp ∧
V
sp∈S
sp ∧ pp is
represented as a predicate sequence query
Q
′
= hvp
1
. . . vp
n
sp
1
. . . sp
o
ppi with
∀i, k ∈ N, 1 ≤ i < k ≤ n; vp
i
, vp
k
∈ V ∪ {ε} ⇒
vp
i
⊳ vp
k
, and ∀i, k ∈ N, 1 ≤ i < k ≤ o; sp
i
, sp
k
∈
S ∪ {ε} ⇒ sp
i
⊳ sp
k
. At this, ⊳ means lexicographi-
cally smaller.
Predicates appear with regard to the following rules:
(1) All join predicates have to be linked us-
ing relation names and it is not allowed to
3
In order to be consistent with our previous works we
use V P instead of JP here.
ON CONTEXT AWARE PREDICATE SEQUENCE QUERIES
109