在XML数据库中,小枝模式查询是XML查询处理的核心操作.近几年,研究人员已提出许多种算法,如Holistic Twig和TJFast算法等.然而它们都是基于归并的,会有很高的计算代价.已提出的Twig2Stack和TwigList算法虽然可以克服这一点,但算法非常复杂.针对这一问题,尤其是考虑了通常查询表达式中只有少数几个结点是最终的输出结点这一特点,提出了TiwgNM算法及其扩展算法TiwgNME算法.算法不需要归并,且只用了少数栈来实现.实验结果表明,这些算法优于以前算法,尤其是对查询中只有祖先-后裔关系的表达式更有效.
In an XML database, finding all occurrences of a twig pattern is a core operation for XML query processing. In the past few years, many algorithms, such as Holistic Twig and TJFast, were proposed in the literatures. However, these algorithms are based on merging, with high computational cost. Recently Twig2Stack algorithm and TwigList algorithm are proposed to resolve this problem, but they are very complex. Aim at this problem, this paper considers the characteristic that most path expressions have only a few output nodes, and proposes two new algorithms without merging, named TwigNM and TwigNME, which use only a few stacks. Finally, the experimental results show that these algorithms are superior to the previous algorithms, especially for only ancestor-descendant relationship in XPath.