Bag equivalence of tree patterns

Sara Cohen*, Yaacov Y. Weiss

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review


When a query is evaluated under bag semantics, each answer is returned asmany times as it has derivations. Bag semantics has long been recognized as important, especially when aggregation functions will be applied to query results. This article is the first to focus on bag semantics for tree pattern queries. In particular, the problem of bag equivalence of a large class of tree pattern queries (which can be used to model XPath) is explored. The queries can contain unions, branching, label wildcards, the vertical child and descendant axes, the horizontal following and following-sibling axes, as well as positional (i.e., first and last) axes. Equivalence characterizations are provided, and their complexity is analyzed. As the descendant axis involves a recursive relationship, this article is also the first to address bag equivalence over recursive queries, in any setting.

Original languageAmerican English
Article number24
JournalACM Transactions on Database Systems
Issue number4
StatePublished - Dec 2011


  • Bag semantics
  • Query equivalence
  • Tree patterns
  • XPath


Dive into the research topics of 'Bag equivalence of tree patterns'. Together they form a unique fingerprint.

Cite this