We study the problem of querying data sources that accept only a
limited set of queries, such as sources accessible by Web services which can
implement very large (potentially infinite) families of queries. We revisit a
classical setting in which the application queries are conjunctive queries and
the source accepts families of (possibly parameterized) conjunctive queries
specified as the expansions of a (potentially recursive) Datalog program with
parameters. We say that query Q is expressible by the program P if it is
equivalent to some expansion of P. Q is supported by P if it has an equivalent
rewriting using some finite set of P's expansions. We present the first study
of expressibility and support for sources that satisfy integrity constraints,
which is generally the case in practice. We start by closing a problem left
open by prior work even while ignoring constraints, namely the precise
relationship between expressibility and support: surprisingly, we show them to
be inter-reducible in PTIME in both the absence and the presence of
constraints. This enables us to employ the same algorithm for solving both
problems. We identify practically relevant restrictions on the program
specifying the views that ensure decidability under a mix of key and weakly
acyclic foreign key constraints, and beyond. We show that these restrictions
are as permissive as possible, since their slightest relaxation leads to
undecidability. We present an algorithm that is guaranteed to be sound when
applied to unrestricted input and in addition complete under the restrictions.
As a side-effect of our investigation, we improve the previously best known
upper bound for deciding support in the constraint-free case.
Pre-2018 CSE ID: CS2007-0886