A practical approach to hypothetical database queries

  • Henning Christiansen
  • Troels Andreasen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1472)


Hypothetical queries are queries embedding hypotheses about the database. The embedded hypothesis in a hypothetical query indicates, so to say, a state of the database intended for the rest of the query. Thus the answer to a hypothetical query h > q, with a hypothesis h, is in principle the result of evaluating q against the database revised with h. In case h is inconsistent with the database, query evaluation becomes a special case of counterfactual reasoning. However, the possible worlds semantics usually applied for this notion is not relevant for database applications due to reasons of inefficiency. In this paper we discuss and compare different approaches to hypothetical queries, paying special attention to potentials for efficient evaluation. As a central part of the paper we present and discuss our own approach “counterfactual exceptions”, which have the important property of, as opposed to the other approaches discussed, requiring only minor overhead in query evaluation. This approach is thus realistic for practical implementation and use in environments supporting large databases. The “price” for efficient evaluation is an altered semantics, as compared to the other approaches. However, it can be argued that this semantics is at least as appropriate for database applications as that of the other approaches mentioned.


Logic Program Logic Programming Integrity Constraint Query Evaluation Protected Part 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Andreasen, T., Christiansen, H. Counterfactual exceptions in deductive database queries. Proc. ECAI'96, 12th European Conference on Artificial Intelligence pp. 340–344, 1996.Google Scholar
  2. 2.
    Andreasen, T., Christiansen, H., and Larsen, H.L., eds. Flexible Query-Answering Systems, Kluwer, to appear 1997.Google Scholar
  3. 3.
    Bonner, A.J. Intuitionistic Deductive Databases and the Polynomial Time Hierarchy. Journal of Logic Programming (JLP), 33(1):1–47,1997.zbMATHMathSciNetCrossRefGoogle Scholar
  4. 4.
    Bonner, A.J. Hypothetical Datalog: Complexity and Expressibility. Theoretical Computer Science (TCS), 76:3–51, 1990.zbMATHMathSciNetCrossRefGoogle Scholar
  5. 5.
    Christiansen, H., A complete resolution method for logical meta-programming languages. Lecture Notes in Computer Science 649, pp. 205–219, 1992.Google Scholar
  6. 6.
    Clark, K.L., Negation as failure. Logic and Data Bases, Gallaire, H., and Minker, J. (eds.), Plenum Press, pp. 293–322, 1978.Google Scholar
  7. 7.
    Enderton, H.B., A Mathematical Introduction to Logic. Academic Press, 1972.Google Scholar
  8. 8.
    Gabbay, D.M., Giordano, L., Martelli, A., and Olivetti, N.,. Hypothetical updates, priority and inconsistency in a logic programming language. Lecture Notes in Computer Science (LN in Artificial Intelligence) 928, Springer-Verlag, pp. 203–216, 1995.Google Scholar
  9. 9.
    Gabbay, D.M. and Reyle, U., N-Prolog: An extension of Prolog with hypothetical implications. Journal of Logic Programming 2, pp. 319–355, 1984.MathSciNetCrossRefGoogle Scholar
  10. 10.
    Gärdenfors, P., Knowledge in the Flux: Modeling the Dynamics of Epistemic States, MIT Press, 1988.Google Scholar
  11. 11.
    Giordano, L. and Martelli, A., A modal reconstruction of blocks and modules in logic programming. International Logic Programming Symposium, 1991.Google Scholar
  12. 12.
    Giordano, L., Martelli, A., and Rossi, G., Extending Horn clause logic with implication goals. Theoretical Computer Science, 1991.Google Scholar
  13. 13.
    Ginsberg, L.M., Counterfactuals. Artificial Intelligence 30, pp. 35–79, 1986.zbMATHMathSciNetCrossRefGoogle Scholar
  14. 14.
    Grahne, G., Mendelzon, A., Updates and subjunctive queries. Information and computation 116(2), pp. 241–252, 1995.zbMATHMathSciNetCrossRefGoogle Scholar
  15. 15.
    Kakas, A. C., Kowalski, R., Toni,F., The Role of Abduction in Logic Programming, In: Handbook of Logic in Artificial Intelligence and Logic Programming 5, pages 235–324, D.M. Gabbay, C.J. Hogger and J.A. Robinson eds., Oxford University Press, 1998).Google Scholar
  16. 16.
    Kowalski, R.A., Predicate logic as a programming language. Information Processing 74, pp. 569–574, 1974.zbMATHGoogle Scholar
  17. 17.
    Kowalski, R.A., and Sadri, F., Logic programming with exceptions. Proc. of Eighth International Conference on Logic Programming, MIT Press, pp. 598–613, 1991.Google Scholar
  18. 18.
    Lewis, D, Counterfactuals. Harward University Press, 1973.Google Scholar
  19. 19.
    Lloyd, J.W., Foundations of logic programming, Second, extended edition. Springer-Verlag, 1987.Google Scholar
  20. 20.
    Miller, D., Lexical scoping as universal quantification, Proc. of Sixth International Conference on Logic Programming, MIT Press, pp. 268–283, 1989.Google Scholar
  21. 21.
    Monteiro, L. and Porto, A., Contextual Logic Programming, Proc. of Sixth International Conference on Logic Programming, MIT Press, pp. 284–302, 1989.Google Scholar
  22. 22.
    Nait Abdallah, M. A., Ions and local definitions in logic programming, Lecture Notes in Computer Science 210, pp. 60–72, Springer-Verlag, 1986.zbMATHMathSciNetGoogle Scholar
  23. 23.
    Pereira, L.M., Aparício, J.N., and Alfares, J.J., Counterfactual reasoning based on revising assumptions. Logic Programming, Proceedings of the 1991 Internal Symposium, MIT Press 1991.Google Scholar
  24. 24.
    SICStus Prolog user's manual. Version 3 #6, SICS, Swedish Institute of Computer Science, 1997.Google Scholar
  25. 25.
    Winslett, M., Updating Logical Databases. Cambridge Tracts in Theoretical Computer Science, vol. 9, Cambridge University Press, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Henning Christiansen
    • 1
  • Troels Andreasen
    • 1
  1. 1.Computer Science Dept.Roskilde UniversityRoskildeDenmark

Personalised recommendations