safety of datalog queries over infinite databases
A query is safe with respect to a set of constraints if for every database that satisfies the constraints the query is guaranteed to yield a finite set of answers. We study here the safety problem for Datalog programs with respect to finiteness constraints . We show that safety can be viewed as a combination of two properties: weak safety , which guarantees the finiteness of intermediate answers, and termination , which guarantees the finiteness of the evaluation. We prove that while weak safety is decidable, termination is not. We then consider monadic programs, i.e., programs in which all intensional predicates are monadic, and show that safety is decidable in polynomial time for monadic programs. While we do not settle the safety problem, we show that a closely related problem, the decision problem for safety with respect to functional dependencies , is undecidable even for monadic programs.
datalog queries queries database constraint yield program combinational terminals evaluation polynomial timing query