redisgraph

Node reuse, instead of creating new ones?

我只是一个虾纸丫 提交于 2019-12-11 12:03:21
问题 I'm trying to create (action)->(state) pair in such a way so that if : the action exists, use it, instead of creating new one the state exists, use it, instead of creating new one and do it in single query. The one I have creates new action node if the state is different, from previous calls. So I end up with multiple action nodes which are the same. query = "merge (:state {id:%s})-[:q {q:%s}]->(:action {id:%s})" % (state, 0, action) I use radis-graph. The only way is to use 3 queries instead

How to create edges based on the equality check on vertex attributes in Cypher?

安稳与你 提交于 2019-12-11 10:26:46
问题 How to create edges based on the equality check on vertex attributes in Cypher? For example: lets say I have one object like this Employees {name: "abc, country: "NZ"} and lets say I have the following objects Manager { name: "abc", depatment: "product"} Manager {name: "abc", depatment: "sales"} Manager {name: "abc", depatment: "marketing"} Now I want to create all the edges where Employees.name = Manager.name How do I write the Cypher query to create all 4 vertices and 3 edges? 回答1: Find the