Graph traversal and top-down evaluation of logic queries

  • Chen Yangjun 


In this paper, an optimal method to handle cyclic and acyclic data relations in the linear recursive queries is proposed. High efficiency is achieved by integrating graph traversal mechanisms into a top-down evaluation. In such a way, the subsumption checks and the identification of cyclic data can be done very efficiently. First, based on the subsumption checks, the search space can be reduced drastically by avoiding any redundant expansion operation. In fact, in the case of non-cyclic data, the proposed algorithm requires only linear time for evaluating a linear recursive query. On the other hand, in the case of cyclic data, by using the technique for isolating strongly connected components a lot of answers can be generated directly in terms of the intermediate results and the relevant path information instead of evaluating them by performing algebraic operations. Since the cost of generating an answer is much less than that of evaluating an answer by algebraic operations, the time consumption for cyclic data can be reduced by an order of magnitude or more.


recursive query top-down evaluation RQA/FQI strategy logic query graph traversal 


  1. [1]
    Aly H, Ozsoyoglu Z M. Synchronized counting method. InProc. 5th Int’l Conf. Data Engineering, Los Angeles, 1989.Google Scholar
  2. [2]
    Balbin I, Port G S, Ramamohanarao K, Meenakshi K. Efficient bottom-up computation of queries on stratified databases.J. Logic Programming, Nov. 1991, 295–344.Google Scholar
  3. [3]
    Beeri C, Ramakrishna R. On the power of magic sets.Int’l J. Logic Programming, 1991, 10: 255–299.MATHCrossRefGoogle Scholar
  4. [4]
    Ceri S, Gottlob G, Tanca T. Logic Programming and Databases. Springer-Verlag, Berlin, 1990.Google Scholar
  5. [5]
    Chen Y. A bottom-up query evaluation method for stratified databases. InProceedings of 9th International Conference on Data Engineering, Vienna, Austria, April 1993, pp.568–575.Google Scholar
  6. [6]
    Chen Y, Härder T. An optimal graph traversal algorithm for evaluating linear binary-chain programs. InCIKM’94 — The 3rd International Conference on Information and Knowledge Managemen, Caithersburg, Maryland, USA; ACM, Nov. 1994, pp.34–41.Google Scholar
  7. [7]
    Chen Y, Härder T. On the optimal top-down evaluation of recursive queries. InProc. 5th Int’l DEXA Conf. Database and Expert Systems Applications, Greece, Springer-Verlag, Sept. 1994, pp.47–56.Google Scholar
  8. [8]
    Chen Y. Processing of recursive rules in knowledge-based systems—Algorithms for handling recursive rules and negative information and performance measurements.Ph.D. thesis, Computer Science Department, University of Kaiserslautern, Germany, Feb. 1995.Google Scholar
  9. [9]
    Chen Y. Magic sets revisited.Journal of Computer Science and Technology, July 1997, 12(4): 346–365.MATHCrossRefMathSciNetGoogle Scholar
  10. [10]
    Chen Y. Magic sets and stratified databases.Int’l Journal of Intelligent Systems, March 1997, 12(3): 203–231.MATHCrossRefGoogle Scholar
  11. [11]
    Chen Y. OLDT-based evaluation method for handling recursive queries in deductive databases. accepted byScience Sinica, 1997.Google Scholar
  12. [12]
    Chen Y. Counting and topological order.Journal of Computer Science and Technology, 1997, 12(6): 497–509.MATHMathSciNetCrossRefGoogle Scholar
  13. [13]
    Han J. Chain-based evaluation—A bridge linking recursive and nonrecursive query evaluation. InProc. 2nd Int’l Workshop on Research Issues on Data Engineering: Transaction and Query Processing, Los Alamitos, CA, February 1992, pp.132–139.Google Scholar
  14. [14]
    Ioannidis Y, Wong E. Towards an algebraic theory of recursion.Journal of the Association for Computing Machinery, April 1991, 38(2): 329–381.MATHMathSciNetGoogle Scholar
  15. [15]
    Marchetti-Spaccamela A, Pelaggi A, Sacca D. Comparison of methods for logic-query implementation.J. Logic Programming, 1991, 10: 333–360.MATHCrossRefMathSciNetGoogle Scholar
  16. [16]
    Nejdl W. Recursive strategies for answering recursive queries—The RQA/FQI strategy. InProc. 13th VLDB Conf., Brighton 1987, pp.43–50.Google Scholar
  17. [17]
    Wu C, Henschen L J. Answering linear recursive queries in cyclic databases. InProc. 1988 Int’l Conf. Fifth Generation Computer Systems, Tokyo, 1988.Google Scholar
  18. [18]
    Vieille L. Recursive axioms in deductive databases: The query-subquery approach. InProc. First Int’l Conf. Expert Database System, L. Kerschberg (ed.), Charleston, 1986.Google Scholar
  19. [19]
    Vieille L. A databae complete proof procedure based on SLD resolution. InProc. 4th Int’l Conf. Logic Programming ICLP’87, Melbourne, Australia, May 1987.Google Scholar
  20. [20]
    Vieille L. From QSQ to QoSaQ: Global optimization of recursive queries. InProc. 2th Int’l Conf. Expert Database System, L. Kerschberg (ed.), Charleston, 1988.Google Scholar
  21. [21]
    Tarjan R: Depth-first search and linear graph algorithms.SIAM J. Comput., June 1972, 1(2): 146–140.MATHCrossRefMathSciNetGoogle Scholar
  22. [22]
    Lloyd J W. Foundation of Logic Programming. Springer-Verlag, Berlin, 1987.Google Scholar

Copyright information

© Science Press, Beijing China and Allerton Press Inc. 1998

Authors and Affiliations

  • Chen Yangjun 
    • 1
  1. 1.Technical Institute of ChangshaChangshaP.R. China

Personalised recommendations