Evaluating Datalog via Tree Automata and Cycluits

  • Antoine Amarilli
  • Pierre Bourhis
  • Mikaël MonetEmail author
  • Pierre Senellart
Part of the following topical collections:
  1. Special Issue on Database Theory (ICDT 2017)


We investigate parameterizations of both database instances and queries that make query evaluation fixed-parameter tractable in combined complexity. We show that clique-frontier-guarded Datalog with stratified negation (CFG-Datalog) enjoys bilinear-time evaluation on structures of bounded treewidth for programs of bounded rule size. Such programs capture in particular conjunctive queries with simplicial decompositions of bounded width, guarded negation fragment queries of bounded CQ-rank, or two-way regular path queries. Our result is shown by translating to alternating two-way automata, whose semantics is defined via cyclic provenance circuits (cycluits) that can be tractably evaluated.


Database theory Datalog Automata Provenance Circuits 



This work was partly funded by the Télécom ParisTech Research Chair on Big Data and Market Insights.


  1. 1.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of databases. Addison-Wesley, Reading (1995)zbMATHGoogle Scholar
  2. 2.
    Alon, N., Yuster, R., Zwick, U.: Finding and counting given length cycles. Algorithmica 17(3) (1997)Google Scholar
  3. 3.
    Amarilli, A.: Leveraging the structure of uncertain data. Ph.D. thesis, Télécom ParisTech (2016)Google Scholar
  4. 4.
    Amarilli, A., Bourhis, P., Monet, M., Senellart, P.: Combined Tractability of Query Evaluation via Tree Automata and Cycluits. In: ICDT (2017)Google Scholar
  5. 5.
    Amarilli, A., Bourhis, P., Monet, M., Senellart, P.: Combined tractability of query evaluation via tree automata and cycluits (extended version). arXiv:1612.04203. Extended version of [4] (2017)
  6. 6.
    Amarilli, A., Bourhis, P., Senellart, P.: Provenance Circuits for Trees and Treelike Instances. In: ICALP (2015)Google Scholar
  7. 7.
    Amarilli, A., Monet, M., Senellart, P.: Conjunctive Queries on Probabilistic Graphs: Combined Complexity. In: PODS (2017)Google Scholar
  8. 8.
    Bȧrȧny, V., ten Cate, B., Otto, M.: Queries with guarded negation. PVLDB 5(11) (2012)Google Scholar
  9. 9.
    Bȧrȧny, V., Ten Cate, B., Segoufin, L.: Guarded negation. J ACM 62(3) (2015)Google Scholar
  10. 10.
    Barceló, P.: Querying graph databases. In: PODS (2013)Google Scholar
  11. 11.
    Barceló, P., Romero, M., Vardi, M.Y.: Does query evaluation tractability help query containment?. In: PODS (2014)Google Scholar
  12. 12.
    Benedikt, M., Bourhis, P., Gottlob, G., Senellart, P.: Monadic datalog and limited access containment. Unpublished (2016)Google Scholar
  13. 13.
    Benedikt, M., Bourhis, P., Senellart, P.: Monadic datalog containment. In: ICALP (2012)Google Scholar
  14. 14.
    Benedikt, M., Bourhis, P., Vanden Boom, M.: A step up in expressiveness of decidable fixpoint logics. In: LICS (2016)Google Scholar
  15. 15.
    Benedikt, M., ten Cate, B., Vanden Boom, M.: Effective interpolation and preservation in guarded logics. In: LICS (2014)Google Scholar
  16. 16.
    Benedikt, M., Gottlob, G.: The impact of virtual views on containment. PVLDB 3(1-2) (2010)Google Scholar
  17. 17.
    Berry, A., Pogorelcnik, R., Simonet, G.: An introduction to clique minimal separator decomposition. Algorithms 3(2) (2010)Google Scholar
  18. 18.
    Berwanger, D., Grȧdel, E.: Games and model checking for guarded logics. In: LPAR (2001)Google Scholar
  19. 19.
    Birget, J. C.: State-complexity of finite-state devices, state compressibility and incompressibility. Mathematical Systems Theory 26(3) (1993)Google Scholar
  20. 20.
    Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput 25(6) (1996)Google Scholar
  21. 21.
    Bodlaender, H. L., Koster, A.M.C.A.: Treewidth computations I. Upper bounds. Inf. Comput 208(3) (2010)Google Scholar
  22. 22.
    Cachat, T.: Two-way tree automata solving pushdown games. In: Automata Logics, and Infinite Games, Chap. 17. Springer (2002)Google Scholar
  23. 23.
    Calvanese, D., De Giacomo, G., Lenzeniri, M., Vardi, M.Y.: Containment of conjunctive regular path queries with inverse. In: KR (2000)Google Scholar
  24. 24.
    Chandra, A. K., Vardi, M. Y.: The implication problem for functional and inclusion dependencies is undecidable. SIAM Journal on Computing 14(3) (1985)Google Scholar
  25. 25.
    Comon, H., Dauchet, M., Gilleron, R., Löding, C., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree automata: Techniques and applications (2007)Google Scholar
  26. 26.
    Cosmadakis, S., Gaifman, H., Kanellakis, P., Vardi, M.: Decidable Optimization Problems for Database Logic Programs. In: STOC (1988)Google Scholar
  27. 27.
    Courcelle, B.: The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Inf. Comput 85(1) (1990)Google Scholar
  28. 28.
    Deutch, D., Milo, T., Roy, S., Tannen, V.: Circuits for Datalog Provenance. In: ICDT (2014)Google Scholar
  29. 29.
    Diestel, R.: Simplicial decompositions of graphs: A survey of applications. Discrete Math 75(1) (1989)Google Scholar
  30. 30.
    Fagin, R.: Degrees of acyclicity for hypergraphs and relational database schemes. J ACM 30(3) (1983)Google Scholar
  31. 31.
    Flum, J., Frick, M., Grohe, M.: Query evaluation via tree-decompositions j.ACM 49(6) (2002)Google Scholar
  32. 32.
    Flum, J., Grohe, M.: Parameterized complexity theory. Springer, Berlin (2006)zbMATHGoogle Scholar
  33. 33.
    Gavril, F.: The intersection graphs of subtrees in trees are exactly the chordal graphs. J Combinatorial Theory 16(1) (1974)Google Scholar
  34. 34.
    Gottlob, G., Grȧdel, E., Veith, H.: Datalog LITE: A deductive query language with linear time model checking. ACM Trans. Comput. Log 3(1) (2002)Google Scholar
  35. 35.
    Gottlob, G., Greco, G., Scarcello, F.: Treewidth and hypertree width. In: Tractability: Practical Approaches to Hard Problems, Chap. 1. Cambridge University Press (2014)Google Scholar
  36. 36.
    Gottlob, G., Leone, N., Scarcello, F.: Hypertree decompositions and tractable queries. JCSS 64(3) (2002)Google Scholar
  37. 37.
    Gottlob, G., Leone, N., Scarcello, F.: Robbers, marshals, and guards: game theoretic and logical characterizations of hypertree width. JCSS 66(4) (2003)Google Scholar
  38. 38.
    Gottlob, G., Pichler, R., Wei, F.: Monadic Datalog over finite structures of bounded treewidth. TOCL 12(1) (2010)Google Scholar
  39. 39.
    Grȧdel, E.: Guarded fixed point logics and the monadic theory of countable trees. Theor. Comput. Sci. 288(1) (2002)Google Scholar
  40. 40.
    Green, T. J., Karvounarakis, G., Tannen, V.: Provenance semirings. In: PODS (2007)Google Scholar
  41. 41.
    Grohe, M., Marx, D.: Constraint solving via fractional edge covers. TALG 11(1) (2014)Google Scholar
  42. 42.
    Imielinski, T., Lipski Jr., W.: Incomplete information in relational databases. J ACM 31(4) (1984)Google Scholar
  43. 43.
    Leimer, H.G.: Optimal decomposition by clique separators. Discrete Math 113(1-3) (1993)Google Scholar
  44. 44.
    Leinders, D., Marx, M., Tyszkiewicz, J., Den Bussche, J.V.: The semijoin algebra and the guarded fragment. Journal of Logic Language and Information 14(3) (2005)Google Scholar
  45. 45.
    Malik, S.: Analysis of cyclic combinational circuits. In: ICCAD (1993)Google Scholar
  46. 46.
    Maniu, S., Cheng, R., Senellart, P.: An indexing framework for queries on probabilistic graphs. ACM Transactions on Database Systems 42(2) (2017)Google Scholar
  47. 47.
    Mendelzon, A. O., Wood, P.T.: Finding regular simple paths in graph databases. In: VLDB (1989)Google Scholar
  48. 48.
    Meyer, A. R.: Weak Monadic Second Order Theory of Succesor is Not Elementary-Recursive. In: Logic Colloquium (1975)Google Scholar
  49. 49.
    Mitchell, J. C.: The implication problem for functional and inclusion dependencies. Information and Control 56(3) (1983)Google Scholar
  50. 50.
    Monet, M.: Probabilistic evaluation of expressive queries on bounded-treewidth instances. In: SIGMOD/PODS Phd Symposium (2016)Google Scholar
  51. 51.
    Riedel, M. D., Bruck, J., title=Cyclic Boolean circuits. Discrete Applied Mathematics 160(13-14) (2012)Google Scholar
  52. 52.
    Robertson, N., Seymour, P. D.: Graph minors. III. Planar tree-width. J. Comb. theory, Ser B 36(1) (1984)Google Scholar
  53. 53.
    Robertson, N., Seymour, P. D.: Graph minors. II. Algorithmic aspects of tree-width. J Algorithms 7(3) (1986)Google Scholar
  54. 54.
    Tarjan, R.E.: Depth-first search and linear graph algorithms. SIAM Journal on Computing (1972)Google Scholar
  55. 55.
    Tarjan, R.E.: Decomposition by clique separators. Discrete Math 55(2) (1985)Google Scholar
  56. 56.
    Tarjan, R. E., Yannakakis, M.: Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM Journal on Computing 13(3) (1984)Google Scholar
  57. 57.
    Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pac. J. Math. 5 (1955)Google Scholar
  58. 58.
    Thompson, K.: Programming Techniques: Regular Expression Search Algorithm. Communications of the ACM (1968)Google Scholar
  59. 59.
    Vardi, M.Y.: The complexity of relational query languages. In: STOC (1982)Google Scholar
  60. 60.
    Vardi, M.Y.: On the complexity of bounded-variable queries. In: PODS (1995)Google Scholar
  61. 61.
    Yannakakis, M.: Algorithms for acyclic database schemes. In: VLDB (1981)Google Scholar

Copyright information

© Springer Science+Business Media, LLC, part of Springer Nature 2019

Authors and Affiliations

  1. 1.LTCI, Télécom ParisTechUniversité Paris-SaclayParisFrance
  2. 2.CRIStAL, CNRSUniversité de LilleLilleFrance
  3. 3.InriaParisFrance
  4. 4.DI ENS, ENS, CNRSPSL UniversityParisFrance

Personalised recommendations