From 9b89717dfc286af0127108b221630f9c1d054971 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Mon, 27 Oct 2014 12:31:48 +0200 Subject: DBO_rm_node_set & test --- src-py/db_controller.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src-py/db_controller.py') diff --git a/src-py/db_controller.py b/src-py/db_controller.py index 84c0743e..c73a6882 100644 --- a/src-py/db_controller.py +++ b/src-py/db_controller.py @@ -316,6 +316,25 @@ class DBO_match_link_id_set(DB_op): self.add_statement(q, q_params) +class DBO_rm_node_set(DB_op): + def __init__(self, id_set, rm_links=False): + super(DBO_rm_node_set, self).__init__() + + if rm_links: + q_arr = ['match (n)', + 'where n.id in ' + str(id_set), + 'optional match (n)-[r]-()', + 'delete n,r' + ] + else: + q_arr = ['match (n)', + 'where n.id in ' + str(id_set), + 'delete n' + ] + + q = ' '.join(q_arr) # TODO: use id param upon neo4j support: q_params = {'id_set': id_set} + self.add_statement(q) + class DB_Controller: """ neo4j DB controller -- cgit v1.3.1