Exemple #1
0
def merge_nodes_and_relationships(tx: Transaction, nodes: List[Node],
                                  relationships: List[Relationship]):
    for node in nodes:
        tx.merge(node)
    for rel in relationships:
        tx.merge(rel)
Exemple #2
0
def test_should_fail_on_tx_merge_object():
    tx = Transaction(FakeGraph())
    with raises(TypeError):
        tx.merge(object())
Exemple #3
0
 def create_or_merge_relationship(self, relation: Relationship,
                                  context: Transaction):
     if self.graph().exists(relation) is True:
         context.merge(relation)
     else:
         context.create(relation)