New Generation Computing

, Volume 20, Issue 4, pp 339–371 | Cite as

Functional queries in Datalog

Regular Papers
  • 29 Downloads

Abstract

A ‘functional’ query is a query whose answer is always defined and unique i.e. it is either true or false in all models. It has been shown that the expressive powers of the various types of stable models, when restricted to the class of DATALOG¬ functional queries, do not in practice go beyond those of well-founded semantics, except for the least undefined stable models which, instead, capture the whole boolean hierarchyBH.

In this paper we present a ‘functional’ language which, by means of a disciplined use of negation, achieves the desired level of expressiveness up toBH. Although the semantics of the new language is partial, all atoms in the source program are defined and possibly undefined atoms are introduced in a rewriting phase to increase the expressive power. We show that the language satisfies ‘desirable’ properties better than classical languages with (unstratified) negation and stable model semantics. We present an algorithm for the evaluation of functional queries and we show that exponential time resolution is required for hard problems only. Finally we present the architecture of a prototype of the language which has been developed.

Keywords

Logic Programming Datalog Stable Models Functional Queries Expressive Power Data Complexity 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1).
    Abiteboul, S., Hull, R. and Vianu, V.,Foundations of Databases, Addison-Wesley, 1994.Google Scholar
  2. 2).
    Abiteboul, S., Simon, E. and Vianu, V., “Non-deterministic Languages to Express Deterministic Transformations,” inProc. of ACM PODS Symp., pp. 218–229, 1990.Google Scholar
  3. 3).
    Abiteboul, S. and Vianu, V., “Datalog Extensions for Databases Queries and Updates,”Journal of Computer and System Science, 43, pp. 62–124, 1991.MathSciNetCrossRefGoogle Scholar
  4. 4).
    Apt, K., Blair, H. and Walker, A., “Towards a Theory of Declarative Knowledge,” inFoundations of Deductive Databases and Logic Programming, pp. 89–142, 1988.CrossRefGoogle Scholar
  5. 5).
    Baral, V. and Subrahmanian, V., “Stable and Extension Class Theory for Logic Programs and Default Logic,”Journal of Automated Reasoning, pp. 345–366, 1992.MathSciNetCrossRefGoogle Scholar
  6. 6).
    Basta, S., “A System Prototype for the Evaluation of Functional Datalog Queries,”Degree thesis (in Italian), 1997.Google Scholar
  7. 7).
    Chandra, A. and Harel, D., “Computable Queries for Relational Databases,”Journal of Computer and System Sciences, 21, pp. 156–178, 1980.MathSciNetCrossRefGoogle Scholar
  8. 8).
    Chandra, A. and Harel, D., “Structure and Complexity of Relational Queries,”Journal of Computer and System Sciences, 25, pp. 99–128, 1982.CrossRefGoogle Scholar
  9. 9).
    Dix, J., “Classifying Semantics of Logic Programs,” inInt. Workshop, on Logic Programming and Non-Monotonic Reasoning, pp. 166–180, 1991.Google Scholar
  10. 10).
    Fagin, R., “Generalized First-Order Spectra and Polynomial-Time Recognizable Sets,” inSIAM-AMS Proc., 7, pp. 43–73, 1974.Google Scholar
  11. 11).
    Flum, J., Kubierschky, M. and Ludascher, B., “Total and Partial Well-founded DATALOG Coincide,” inProc. of the Int. Conf. on Database Theory, Springer-Verlag, pp. 113–124, 1997.Google Scholar
  12. 12).
    Gelfond, M. and Lifschitz, V., “The Stable Model Semantics for Logic Programming,” inProc. of 5th Int. Conf. and Symp. on Logic Programming, MIT Press, Cambridge, pp. 1070–1080, 1988.Google Scholar
  13. 13).
    Giannotti, F., Pedreschi, D., Saccà, D. and Zaniolo, C., “Non-determinism in Deductive Databases,” inProc. of 2nd Conf. on Deductive and Object-Oriented Databases, 1991.CrossRefGoogle Scholar
  14. 14).
    Greco, S., Saccà, D. and Zaniolo C., “DATALOG Queries with Stratified Negation and Choice: fromP toDp,” inProc. of the Fifth Int. Conf. on Database Theory, 1995.Google Scholar
  15. 15).
    Greco, S. and Saccà, D., “Possible-is-certain, is Desiderable and Can Be Expressive,”Annals of Mathematics and Artificial Intelligence (preliminary version in ASIAN'97), 1997.Google Scholar
  16. 16).
    Greco, S., “Non-determinism and Weak Constraints in Datalog,”New Generation Computing (preliminary version in AGP Conf., 1996)16, 4, 1998.CrossRefGoogle Scholar
  17. 17).
    Greco, S., “Dynamic Programming in Datalog with Aggregates,”IEEE Transactions on Knowledge and Data Engineering, pp. 265–283, 1999.CrossRefGoogle Scholar
  18. 18).
    Gurevich, Y., “Logic and the Challenge of Computer Science,” inTrends in Theoretical Computer Science, Computer Science Press, 1988.Google Scholar
  19. 19).
    Immerman, N., “Languages Which Capture Complexity Classes,”SIAM Journal on Computing, 16, pp. 760–778, 1987.MathSciNetCrossRefGoogle Scholar
  20. 20).
    Johnson, D. S., “A Catalog of Complexity Classes,”Handbook of Theoretical Computer Science, 1, North-Holland, 1990.Google Scholar
  21. 21).
    Kanellakis, P. C., “Elements of Relational Database Theory,”Handbook of Theoretical Computer Science, 2, North-Holland, 1991.Google Scholar
  22. 22).
    Kolaitis, P., “The Expressive Power of Stratified Logic Programs,”Information an Computation, 90, pp. 50–66, 1990.MathSciNetCrossRefGoogle Scholar
  23. 23).
    Kolaitis, P. G. and Papadimitriou, C. H., “Why not Negation by Fixpoint?,”Journal of Computer and System Sciences, 43, pp. 125–144, 1991.MathSciNetCrossRefGoogle Scholar
  24. 24).
    Krishnamurthy, R. and Naqvi, S. A., “Non-deterministic Choice in Datalog,” inProc. of 3rd Int. Conf. on Data and Knowledge Bases, pp. 416–424, 1988.CrossRefGoogle Scholar
  25. 25).
    Lloyd, J. W.,Foundations of Logic Programming, Springer Verlag, Berlin, 1987.CrossRefGoogle Scholar
  26. 26).
    Makinson, D., “General Pattern in Nonmonotonic Reasoning,”Handbook of Logic in Artificial Intelligence and Logic Programming, (D. M. Gabbay, C. J. Hogger and J. A. Robinson eds.),2, Oxford University Press, 1993.Google Scholar
  27. 27).
    Marek, W. and Truszcynski, M., “Autoepistemic Logic,”Journal of the ACM, 38, pp. 588–619, 1991.MathSciNetCrossRefGoogle Scholar
  28. 28).
    Papadimitriou, C. H.,Computational Complexity, Addison Wesley, 1994.Google Scholar
  29. 29).
    Papadimitriou, C. H. and Yannakakis, M., “Tie-Breaking Semantics and Structural Totality,”JCSS, 54, 1, pp. 48–60, 1997.MathSciNetMATHGoogle Scholar
  30. 30).
    Przymusinski, T. C., “Well-founded Semantics Coincides with Three-valued Stable Semantics,”Foundamenta Informaticae, 13, pp. 445–463, 1990.MathSciNetMATHGoogle Scholar
  31. 31).
    Ross, K. A., “Structural Totality and Constraint Stratification,” inPODS, pp. 184–195.Google Scholar
  32. 32).
    Ross, K. A., “A Syntactic Stratification Condition Using Constraints,” inSLP, 76–90, 1994.Google Scholar
  33. 33).
    Ross, K. A., “Modular Stratification and Magic Sets for Datalog Programs with Negation,”JACM, 41, 6, pp. 1216–1266, 1994.MathSciNetCrossRefGoogle Scholar
  34. 34).
    Saccà, D., “The Expressive Powers of Stable Models for Bound and Unbound DATALOG Queries,”Journal of Computer and System Science, 1997.Google Scholar
  35. 35).
    Saccà, D. and Zaniolo, C., “Stable Models and Non-Determinism in Logic Programs with Negation,” inProc. ACM PODS Symp., pp. 205–218, 1990.Google Scholar
  36. 36).
    Saccà, D. and Zaniolo, C., “Deterministic and Non-deterministic Stable Models,” Journal of Logic and Computation, 1997.Google Scholar
  37. 37).
    Schlipf, J. S., “The Expressive Powers of the Logic Programming Semantics,” inProc. of ACM PODS Symp., pp. 196–204, 1990.Google Scholar
  38. 38).
    Ullman, J. D., “Principles of Database and Knowledge Base Systems,”1–2, Computer Science Press, 1989.Google Scholar
  39. 39).
    Vardi, M. Y., “The Complexity of Relational Query Languages,” inProc. of ACM Symp. on Theory of Computing, pp. 137–146, 1982.Google Scholar
  40. 40).
    Van Gelder, A., Ross, K. and Schlipf, J. S., “The Well-Founded Semantics for General Logic Programs,”Journal of the ACM, 38, 3, pp. 620–650, 1991.MathSciNetMATHGoogle Scholar
  41. 41).
    Vielle, L., “Recursive Query Processing: The Power of Logic,”Theoretical Computer Science, 69, pp. 1–53, 1989.MathSciNetCrossRefGoogle Scholar
  42. 42).
    You, J., and Yuan, L. Y., “On the Equivalence of Semantics for Normal Logic Programs,”Journal of Logic Programming, pp. 211–222, 1995.MathSciNetCrossRefGoogle Scholar

Copyright information

© Ohmsha, Ltd. and Springer 2002

Authors and Affiliations

  1. 1.ISI-CNRRendeItaly
  2. 2.DEIS-Università della CalabriaRendeItaly

Personalised recommendations