Query automata
Frank Neven, Thomas Schwentick · 1999
It is common to model structured document databases by context-free and extended context-free grammars.A crucial difference is that the derivation trees of the former are ranked, while those of the latter are not.A main task in document transformation and information retrieval is locating subtrees satisfying some pattern.Therefore, unary queries, i.e., queries that map a tree to a set of its nodes, play an important role in the context of structured document databases.We want to understand how the natural and well-studied computation model of tree automata can be used to express such queries.We define a query automaton (QA) as a deterministic two-way finite automaton over trees that has the ability to select nodes depending on the state and the label at those nodes.We study QAs over ranked as well as over unranked trees.More precisely, we characterize the expressiveness of the different formalisms by linking them to monadic second-order logic, and we establish the complexity of their non-emptiness and equivalence problem.