### Containment of Datalog in a Unions of Conjunctive queries:

Approach: the notion of a containment mapping is generalized to Datalog and to UC2RPQs by expansions of Datalog programs:

can be defined via an infinite sequence of conjunctive queries:

Let trees(Q, Π) be the set of trees for predicate Q

labeled with a Rule at each node, such that the children of a node N always are labeled with rules having as head atoms corresponding to the IDB atoms of the rule of N and leaves are rules labeled with rules having EDB predicates only in their bodies. Note that trees(Q, Π) can be infinite.

Intuition: Πis contained in a union of conjunctive queries

if there is a containment mapping from some to each expansion tree

in trees(Q, Π). … not yet, since the number of variables and hence the

number of node labels is unbounded.