Abstract:The Counting algorithm is one of the best -known qurey-processing algorithms for SL recursions. It performs well for a kind of recursions which are counting linear. However, since it requires that the binding set of the given query bea singleton, it is very difficult to use it as a subgoal processing strategy. In this paper, a new counting algorithm for generalized queries is presented. The algorithm presented here can handle any multi-value binding sets, so it can be used not only for query evaluating, but also for subgoal processing. The correctness of the algorithm and the efficiency of the transformed rules are also discussed briefly in this paper.