def merge(self, other): """ Merges two PathQueryTest """ new_q = PathQueryTest(0) new_content = {**self.content, **other.content} new_q.top_sort = self.top_sort + other.top_sort ConjunctiveQuery.__init__(new_q, new_content) return new_q
def __init__(self, n, rel_base="E_", var_base="X_"): content = {} self.n = n for i in range(1, n + 1): x = AtomValue(var_base + str(i - 1), True) y = AtomValue(var_base + str(i), True) fd = FunctionalDependencySet() fd.add(FunctionalDependency(frozenset([x]), y)) atom = Atom(rel_base + str(i), [x, y]) content[atom] = (fd, [True, False], False) self.top_sort = [rel_base + str(i) for i in range(1, self.n + 1)] ConjunctiveQuery.__init__(self, content)