Skip to main content
Log in

Functional queries in Datalog

  • Regular Papers
  • Published:
New Generation Computing Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Abiteboul, S., Hull, R. and Vianu, V.,Foundations of Databases, Addison-Wesley, 1994.

  2. Abiteboul, S., Simon, E. and Vianu, V., “Non-deterministic Languages to Express Deterministic Transformations,” inProc. of ACM PODS Symp., pp. 218–229, 1990.

  3. Abiteboul, S. and Vianu, V., “Datalog Extensions for Databases Queries and Updates,”Journal of Computer and System Science, 43, pp. 62–124, 1991.

    Article  MathSciNet  Google Scholar 

  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.

    Chapter  Google Scholar 

  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.

    Article  MathSciNet  Google Scholar 

  6. Basta, S., “A System Prototype for the Evaluation of Functional Datalog Queries,”Degree thesis (in Italian), 1997.

  7. Chandra, A. and Harel, D., “Computable Queries for Relational Databases,”Journal of Computer and System Sciences, 21, pp. 156–178, 1980.

    Article  MathSciNet  Google Scholar 

  8. Chandra, A. and Harel, D., “Structure and Complexity of Relational Queries,”Journal of Computer and System Sciences, 25, pp. 99–128, 1982.

    Article  Google Scholar 

  9. Dix, J., “Classifying Semantics of Logic Programs,” inInt. Workshop, on Logic Programming and Non-Monotonic Reasoning, pp. 166–180, 1991.

  10. Fagin, R., “Generalized First-Order Spectra and Polynomial-Time Recognizable Sets,” inSIAM-AMS Proc., 7, pp. 43–73, 1974.

  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.

  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. 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.

    Chapter  Google Scholar 

  14. Greco, S., Saccà, D. and Zaniolo C., “DATALOG Queries with Stratified Negation and Choice: fromP toD p ,” inProc. of the Fifth Int. Conf. on Database Theory, 1995.

  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.

  16. Greco, S., “Non-determinism and Weak Constraints in Datalog,”New Generation Computing (preliminary version in AGP Conf., 1996)16, 4, 1998.

    Article  Google Scholar 

  17. Greco, S., “Dynamic Programming in Datalog with Aggregates,”IEEE Transactions on Knowledge and Data Engineering, pp. 265–283, 1999.

    Article  Google Scholar 

  18. Gurevich, Y., “Logic and the Challenge of Computer Science,” inTrends in Theoretical Computer Science, Computer Science Press, 1988.

  19. Immerman, N., “Languages Which Capture Complexity Classes,”SIAM Journal on Computing, 16, pp. 760–778, 1987.

    Article  MathSciNet  Google Scholar 

  20. Johnson, D. S., “A Catalog of Complexity Classes,”Handbook of Theoretical Computer Science, 1, North-Holland, 1990.

  21. Kanellakis, P. C., “Elements of Relational Database Theory,”Handbook of Theoretical Computer Science, 2, North-Holland, 1991.

  22. Kolaitis, P., “The Expressive Power of Stratified Logic Programs,”Information an Computation, 90, pp. 50–66, 1990.

    Article  MathSciNet  Google Scholar 

  23. Kolaitis, P. G. and Papadimitriou, C. H., “Why not Negation by Fixpoint?,”Journal of Computer and System Sciences, 43, pp. 125–144, 1991.

    Article  MathSciNet  Google Scholar 

  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.

    Chapter  Google Scholar 

  25. Lloyd, J. W.,Foundations of Logic Programming, Springer Verlag, Berlin, 1987.

    Book  Google Scholar 

  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.

  27. Marek, W. and Truszcynski, M., “Autoepistemic Logic,”Journal of the ACM, 38, pp. 588–619, 1991.

    Article  MathSciNet  Google Scholar 

  28. Papadimitriou, C. H.,Computational Complexity, Addison Wesley, 1994.

  29. Papadimitriou, C. H. and Yannakakis, M., “Tie-Breaking Semantics and Structural Totality,”JCSS, 54, 1, pp. 48–60, 1997.

    MathSciNet  MATH  Google Scholar 

  30. Przymusinski, T. C., “Well-founded Semantics Coincides with Three-valued Stable Semantics,”Foundamenta Informaticae, 13, pp. 445–463, 1990.

    MathSciNet  MATH  Google Scholar 

  31. Ross, K. A., “Structural Totality and Constraint Stratification,” inPODS, pp. 184–195.

  32. Ross, K. A., “A Syntactic Stratification Condition Using Constraints,” inSLP, 76–90, 1994.

  33. Ross, K. A., “Modular Stratification and Magic Sets for Datalog Programs with Negation,”JACM, 41, 6, pp. 1216–1266, 1994.

    Article  MathSciNet  Google Scholar 

  34. Saccà, D., “The Expressive Powers of Stable Models for Bound and Unbound DATALOG Queries,”Journal of Computer and System Science, 1997.

  35. Saccà, D. and Zaniolo, C., “Stable Models and Non-Determinism in Logic Programs with Negation,” inProc. ACM PODS Symp., pp. 205–218, 1990.

  36. Saccà, D. and Zaniolo, C., “Deterministic and Non-deterministic Stable Models,” Journal of Logic and Computation, 1997.

  37. Schlipf, J. S., “The Expressive Powers of the Logic Programming Semantics,” inProc. of ACM PODS Symp., pp. 196–204, 1990.

  38. Ullman, J. D., “Principles of Database and Knowledge Base Systems,”1–2, Computer Science Press, 1989.

  39. Vardi, M. Y., “The Complexity of Relational Query Languages,” inProc. of ACM Symp. on Theory of Computing, pp. 137–146, 1982.

  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.

    MathSciNet  MATH  Google Scholar 

  41. Vielle, L., “Recursive Query Processing: The Power of Logic,”Theoretical Computer Science, 69, pp. 1–53, 1989.

    Article  MathSciNet  Google Scholar 

  42. You, J., and Yuan, L. Y., “On the Equivalence of Semantics for Normal Logic Programs,”Journal of Logic Programming, pp. 211–222, 1995.

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Stefano Basta.

Additional information

Stefano Basta, Ph.D.: He received his Ph.D. in “Ingegneria dei Sistemi e Informatica” from University of Calabria, Italy in 2000. Since December 2000, he is Researcher for Institute of Systems Analysis and Information Technology of National Research Council (ISI-CNR). His research interests include logic programming, deductive databases, knowledge representation, information integration, data mining and data warehousing.

Sergio Flesca, Ph.D.: He received his Ph.D. in computer science engineering at the university of Calabria, Italy. Currently he is a researcher in the Engineering Faculty at the University of Calabria. He was a visiting researcher at the Computer Science Department of Vienna University of Technology. His research interests include deductive and active database, semistructured data, XML query languages and XML wrapper induction.

Sergio Greco, Ph.D.: He received his laurea degree in electrical engineering from University of Calabria, Italy. Currently, he is a full professor at the faculty of Enginering at the University of Calabria. Prior of this, he was researcher at CRAI, a research consortium in Informatics and assistant professor at the University of Calabria. He was a visiting researcher at the research center of Microelectronics and Computer Center (MCC) of Austin (Texas) and at the Computer Science Department of University of California at Los Angeles. His area of research includes database theory, deductive database, logic programming, and query languages.

About this article

Cite this article

Basta, S., Flesca, S. & Greco, S. Functional queries in Datalog. New Gener Comput 20, 339–371 (2002). https://doi.org/10.1007/BF03037371

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037371

Keywords

Navigation