Safety of datalog queries over infinite databases

A query is <italic>safe</italic> 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 <italic>finiteness constraints</italic>. We show that safety can be viewed as a combination of two properties: <italic>weak safety</italic>, which guarantees the finiteness of intermediate answers, and <italic>termination</italic>, which guarantees the finiteness of the evaluation. We prove that while weak safety is decidable, termination is not. We then consider <italic>monadic</italic> 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 <italic>functional dependencies</italic>, is undecidable even for monadic programs.

[1]  R. Ramakrishnan,et al.  A framework for testing safety and effective computability of extended datalog , 1988, SIGMOD '88.

[2]  Haim Gaifman,et al.  Decidable optimization problems for database logic programs , 1988, STOC '88.

[3]  N. S. Barnett,et al.  Private communication , 1969 .

[4]  Lawrence J. Henschen,et al.  On compiling queries in recursive first-order databases , 1984, JACM.

[5]  David Maier,et al.  On the foundations of the universal relation model , 1984, TODS.

[6]  Moshe Y. Vardi Decidability and undecidability results for boundedness of linear recursive queries , 1988, PODS.

[7]  David Harel,et al.  Horn Clauses Queries and Generalizations , 1985, J. Log. Program..

[8]  Jeffrey D. Ullman,et al.  Principles Of Database And Knowledge-Base Systems , 1979 .

[9]  Jeffrey D. Ullman,et al.  Principles of database and knowledge-base systems, Vol. I , 1988 .

[10]  Jeffrey D. Ullman,et al.  Introduction to Automata Theory, Languages and Computation , 1979 .

[11]  Jeffrey D. Ullman,et al.  Implementation of logical query languages for databases , 1985, TODS.

[12]  Jeffrey F. Naughton,et al.  A decidable class of bounded recursions , 1987, PODS '87.

[13]  Yehoshua Sagiv On computing restricted projections of representative instances , 1985, PODS '85.

[14]  Serge Abiteboul,et al.  Data functions, datalog and negation , 1988, SIGMOD '88.

[15]  Abraham Silberschatz,et al.  An axiomatic approach to deciding query safety in deductive databases , 1988, PODS '88.

[16]  J. D. Uiiman,et al.  Principles of Database Systems , 2004, PODS 2004.

[17]  Jack Minker,et al.  Logic and Data Bases , 1978, Springer US.

[18]  M. Rabin Weakly Definable Relations and Special Automata , 1970 .

[19]  Michael Kifer,et al.  On Safety, Domain Independence, and Capturability of Database Queries (Preliminary Report) , 1988, JCDKB.

[20]  Jeffrey D. Uuman Principles of database and knowledge- base systems , 1989 .

[21]  Abraham Silberschatz,et al.  Safety of recursive Horn clauses with infinite relations , 1987, PODS '87.

[22]  Oded Shmueli,et al.  Decidability and expressiveness aspects of logic queries , 1987, XP7.52 Workshop on Database Theory.

[23]  Michael Kifer,et al.  SYGRAF: Implementing Logic Programs in a Database Style , 1988, IEEE Trans. Software Eng..

[24]  Dana S. Scott,et al.  Finite Automata and Their Decision Problems , 1959, IBM J. Res. Dev..

[25]  Jeffrey F. Naughton,et al.  Data independent recursion in deductive databases , 1985, J. Comput. Syst. Sci..