Worst-case complexity analysis of methods for logic query implementation