Beispiel #1
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])
     x_0_2k = apply_renaming_to_atom_values(x_0, renamings[2 * k])
     head_content += x_0_0
     head_content += x_0_2k
     common = []
     for i in range(1, k):
         _, x, _ = q.decompose_atom(cycle[i])
         common += apply_renaming_to_atom_values(x, renamings[i])
     head_atom = Atom("DCon_" + str(rewriting_index), head_content + common)
     DatalogQuery.__init__(self, head_atom)
     x_0_2k_1 = apply_renaming_to_atom_values(x_0, renamings[2 * k + 1])
     self.add_atom(
         Atom("DCon_" + str(rewriting_index), x_0_0 + x_0_2k_1 + common))
     pk_content = x_0_2k_1
     for i in range(1, k):
         _, x, _ = q.decompose_atom(cycle[i])
         pk_content += apply_renaming_to_atom_values(x, renamings[k + i])
     pk_content += x_0_2k
     self.add_atom(Atom("Pk_" + str(rewriting_index), pk_content))
     for i in range(1, k):
         _, x, _ = q.decompose_atom(cycle[i])
         key1 = apply_renaming_to_atom_values(x, renamings[k + i])
         key2 = apply_renaming_to_atom_values(x, renamings[i])
         self.add_atom(Atom("Neq_" + cycle[i].name, key1 + key2))
Beispiel #2
0
 def __init__(self, atom, q):
     _, x, _ = q.decompose_atom(atom)
     head_atom = Atom("Garbage_" + atom.name, x)
     relevant_atom = Atom("Rlvant_" + atom.name, atom.content)
     DatalogQuery.__init__(self, head_atom)
     self.add_atom(atom)
     self.add_atom(relevant_atom, True)
Beispiel #3
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])
     x_0_1 = apply_renaming_to_atom_values(x_0, renamings[1])
     DatalogQuery.__init__(
         self, Atom("Trans_" + str(rewriting_index), x_0 + x_0_0))
     self.add_atom(Atom("Trans_" + str(rewriting_index), x_0 + x_0_1))
     self.add_atom(Atom("Link_" + str(rewriting_index), x_0_1 + x_0_0))
Beispiel #4
0
 def __init__(self, atom1, atom2, q):
     _, x1, _ = q.decompose_atom(atom1)
     _, x2, _ = q.decompose_atom(atom2)
     head_atom = Atom("Garbage_" + atom1.name, x1)
     DatalogQuery.__init__(self, head_atom)
     for atom in q.get_atoms():
         self.add_atom(atom)
     self.add_atom(Atom("Garbage_" + atom2.name, x2))
Beispiel #5
0
 def __init__(self, cycle, q, rewriting_index, renaming):
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_ren = apply_renaming_to_atom_values(x_0, renaming)
     DatalogQuery.__init__(
         self, Atom("IdentifiedBy_" + str(rewriting_index), x_0 + x_0_ren))
     self.add_atom(Atom("Lower_" + str(rewriting_index), x_0 + x_0_ren),
                   True)
     self.add_atom(Atom("Trans_" + str(rewriting_index), x_0 + x_0_ren))
Beispiel #6
0
 def __init__(self, atom, cycle, q, rewriting_index):
     _, x, y = q.decompose_atom(atom)
     head_atom = Atom("Garbage_" + atom.name, x)
     DatalogQuery.__init__(self, head_atom)
     cycle_content = []
     for other in cycle:
         _, x, y = q.decompose_atom(other)
         cycle_content += x
     self.add_atom(
         Atom("InLongDCycle_" + str(rewriting_index), cycle_content))
Beispiel #7
0
 def __init__(self, atom, q, renaming):
     v, x, _ = q.decompose_atom(atom)
     renamed_x = apply_renaming_to_atom_values(x, renaming)
     head_atom = Atom("Neq_" + atom.name, x + renamed_x)
     renamed_atom = apply_renaming_to_atom(atom, renaming)
     eq_atom = Atom("Eq_" + atom.name, x + renamed_x)
     DatalogQuery.__init__(self, head_atom)
     self.add_atom(atom)
     self.add_atom(renamed_atom)
     self.add_atom(eq_atom, True)
Beispiel #8
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])[0]
     x_0_1 = apply_renaming_to_atom_values(x_0, renamings[1])[0]
     x_0 = x_0[0]
     DatalogQuery.__init__(
         self, Atom("Lower_" + str(rewriting_index), [x_0, x_0_0]))
     self.add_atom(Atom("Trans_" + str(rewriting_index), [x_0, x_0_0]))
     self.add_atom(Atom("Trans_" + str(rewriting_index), [x_0, x_0_1]))
     self.add_atom(CompareAtom(x_0_0, x_0_1, True))
Beispiel #9
0
 def __init__(self, cycle, q, rewriting_index):
     head_content = []
     for atom in cycle:
         _, x, y = q.decompose_atom(atom)
         head_content += x
         head_content += y
     head_atom = Atom("Rel1Emb_" + str(rewriting_index), head_content)
     DatalogQuery.__init__(self, head_atom)
     for atom in cycle:
         self.add_atom(atom)
Beispiel #10
0
 def __init__(self, atom, cycle, q, rewriting_index, renaming):
     _, x, _ = q.decompose_atom(atom)
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_ren = apply_renaming_to_atom_values(x_0, renaming)
     DatalogQuery.__init__(self, Atom("N_" + atom.name, x + x_0_ren))
     t_atom_content = x_0_ren
     for atom in cycle:
         _, x, y = q.decompose_atom(atom)
         t_atom_content += x
         t_atom_content += y
     self.add_atom(Atom("T_" + str(rewriting_index), t_atom_content))
Beispiel #11
0
 def __init__(self, cycle, q, index, rewriting_index, renamings):
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])
     x_0_1 = apply_renaming_to_atom_values(x_0, renamings[1])
     DatalogQuery.__init__(
         self, Atom("Lower_" + str(rewriting_index), x_0 + x_0_0))
     self.add_atom(Atom("Trans_" + str(rewriting_index), x_0 + x_0_0))
     self.add_atom(Atom("Trans_" + str(rewriting_index), x_0 + x_0_1))
     for i in range(0, index - 1):
         self.add_atom(EqualityAtom(x_0_0[i], x_0_1[i]))
     self.add_atom(CompareAtom(x_0_0[index], x_0_1[index], True))
Beispiel #12
0
 def __init__(self, atom, cycle, q, rewriting_index, renamings):
     index = cycle.index(atom)
     k = len(cycle)
     _, x, _ = q.decompose_atom(atom)
     head_atom = Atom("Garbage_" + atom.name,
                      apply_renaming_to_atom_values(x, renamings[index]))
     DatalogQuery.__init__(self, head_atom)
     irr_content = []
     for i in range(k):
         _, x, _ = q.decompose_atom(cycle[i])
         irr_content += apply_renaming_to_atom_values(x, renamings[i])
     self.add_atom(Atom("Irr1Emb_" + str(rewriting_index), irr_content))
Beispiel #13
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     for i in range(k):
         _, x, _ = q.decompose_atom(cycle[i])
         head_content += apply_renaming_to_atom_values(x, renamings[i])
     head_atom = Atom("InLongDCycle_" + str(rewriting_index), head_content)
     DatalogQuery.__init__(self, head_atom)
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_k = apply_renaming_to_atom_values(x_0, renamings[k])
     self.add_atom(Atom("Pk_" + str(rewriting_index), head_content + x_0_k))
     self.add_atom(
         Atom("DCon_" + str(rewriting_index), x_0_k + head_content))
Beispiel #14
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     any_content = []
     for i in range(k):
         _, x, y = q.decompose_atom(cycle[i])
         head_content += apply_renaming_to_atom_values(x, renamings[i])
         any_content += apply_renaming_to_atom_values(x, renamings[i])
         any_content += apply_renaming_to_atom_values(y, renamings[i])
     head_atom = Atom("Irr1Emb_" + str(rewriting_index), head_content)
     DatalogQuery.__init__(self, head_atom)
     self.add_atom(Atom("Any1Emb_" + str(rewriting_index), any_content))
     self.add_atom(Atom("Rel1Emb_" + str(rewriting_index), any_content),
                   True)
Beispiel #15
0
 def __init__(self, atom, cycle, q, rewriting_index, renaming):
     k = len(cycle)
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_ren = apply_renaming_to_atom_values(x_0, renaming)
     DatalogQuery.__init__(
         self, Atom("Link_" + str(rewriting_index), x_0 + x_0_ren))
     for i in range(k):
         _, x, y = q.decompose_atom(cycle[i])
         self.add_atom(Atom("Keep_" + cycle[i].name, x + y))
         x = apply_renaming_to_atom_values(x, renaming)
         y = apply_renaming_to_atom_values(y, renaming)
         self.add_atom(Atom("Keep_" + cycle[i].name, x + y))
     index = cycle.index(atom)
     _, x_i, _ = q.decompose_atom(cycle[index])
     x_i_ren = apply_renaming_to_atom_values(x_i, renaming)
     self.add_atom(Atom("Eq_" + atom.name, x_i + x_i_ren))
Beispiel #16
0
 def __init__(self, cycle, q, rewriting_index, renaming):
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_ren = apply_renaming_to_atom_values(x_0, renaming)
     head_content = []
     body_atoms = []
     head_content += x_0_ren
     for atom in cycle:
         _, x, y = q.decompose_atom(atom)
         head_content += x + y
         body_atoms.append(Atom("Keep_" + atom.name, x + y))
     DatalogQuery.__init__(self,
                           Atom("T_" + str(rewriting_index), head_content))
     for atom in body_atoms:
         self.add_atom(atom)
     self.add_atom(
         Atom("IdentifiedBy_" + str(rewriting_index), x_0 + x_0_ren))
Beispiel #17
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     for i in range(k):
         _, x, y = q.decompose_atom(cycle[i])
         head_content += apply_renaming_to_atom_values(x, renamings[i])
         head_content += apply_renaming_to_atom_values(y, renamings[i])
     head_atom = Atom("Any1Emb_" + str(rewriting_index), head_content)
     DatalogQuery.__init__(self, head_atom)
     for i in range(k):
         for atom in q.get_atoms():
             self.add_atom(apply_renaming_to_atom(atom, renamings[i]))
     for i in range(k):
         _, x, y = q.decompose_atom(cycle[i])
         key1 = apply_renaming_to_atom_values(x, renamings[i])
         key2 = apply_renaming_to_atom_values(x, renamings[(k - 1 + i) % k])
         self.add_atom(Atom("Eq_" + cycle[i].name, key1 + key2))
Beispiel #18
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_2k = apply_renaming_to_atom_values(x_0, renamings[2 * k])
     head_content += x_0_2k * 2
     common = []
     for i in range(1, k):
         _, x, _ = q.decompose_atom(cycle[i])
         common += apply_renaming_to_atom_values(x, renamings[i])
     head_atom = Atom("DCon_" + str(rewriting_index), head_content + common)
     DatalogQuery.__init__(self, head_atom)
     for atom in cycle:
         self.add_atom(apply_renaming_to_atom(atom, renamings[2 * k]))
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])
     x_0_k = apply_renaming_to_atom_values(x_0, renamings[k])
     self.add_atom(
         Atom("Pk_" + str(rewriting_index), x_0_0 + common + x_0_k))
Beispiel #19
0
 def __init__(self, cycle, q, rewriting_index, renamings):
     k = len(cycle)
     head_content = []
     for i in range(k):
         _, x, _ = q.decompose_atom(cycle[i])
         head_content += apply_renaming_to_atom_values(x, renamings[i])
     _, x_0, _ = q.decompose_atom(cycle[0])
     x_0_k = apply_renaming_to_atom_values(x_0, renamings[k])
     head_content += x_0_k
     head_atom = Atom("Pk_" + str(rewriting_index), head_content)
     DatalogQuery.__init__(self, head_atom)
     for i in range(k + 1):
         for atom in q.get_atoms():
             self.add_atom(apply_renaming_to_atom(atom, renamings[i]))
     for i in range(1, k):
         _, x, y = q.decompose_atom(cycle[i])
         key1 = apply_renaming_to_atom_values(x, renamings[i])
         key2 = apply_renaming_to_atom_values(x, renamings[i - 1])
         self.add_atom(Atom("Eq_" + cycle[i].name, key1 + key2))
     x_0_k_1 = apply_renaming_to_atom_values(x_0, renamings[k - 1])
     x_0_0 = apply_renaming_to_atom_values(x_0, renamings[0])
     self.add_atom(Atom("Eq_" + cycle[0].name, x_0_k + x_0_k_1))
     self.add_atom(Atom("Neq_" + cycle[0].name, x_0_0 + x_0_k))
Beispiel #20
0
 def __init__(self, atom, q):
     head_atom = Atom("Rlvant_" + atom.name, atom.content)
     DatalogQuery.__init__(self, head_atom)
     for atom2 in q.get_atoms():
         self.add_atom(atom2)
Beispiel #21
0
 def __init__(self, atom, q):
     _, x, y = q.decompose_atom(atom)
     head_atom = Atom("Keep_" + atom.name, x + y)
     DatalogQuery.__init__(self, head_atom)
     self.add_atom(atom)
     self.add_atom(Atom("Garbage_" + atom.name, x), True)
Beispiel #22
0
 def __init__(self, head: Atom, done: Set[Atom]):
     DatalogQuery.__init__(self, head)
     for a_d in done:
         self.add_atom(a_d)
Beispiel #23
0
 def __init__(self, atom, q):
     _, x, _ = q.decompose_atom(atom)
     head_atom = Atom("Eq_" + atom.name, x * 2)
     DatalogQuery.__init__(self, head_atom)
     self.add_atom(atom)