RedisGraph-将多个指令与MERGE结合

时间:2018-12-18 12:22:13

标签: cypher anormcypher redisgraph

我目前正在Neo4J上运行以下查询

match (p:Initial{state: 'Initial', name: 'Initial'}), (c:Encounter{code:'abcd', state: 'Encounter', name: 'Encounter1'})
merge (p)-[:raw {person_id:'1234', type:'Encounter', code:'abcd'}]->(c)

但是我无法在RedisGraph上执行相同的查询。 根据到目前为止的发现,Redis似乎不支持combining MERGEwith other directives

  1. 对此有任何解决方法吗?
  2. 是否可以更改查询以允许其在没有match语句的情况下执行相同的功能?

1 个答案:

答案 0 :(得分:1)

我现在看到的唯一选择是将其分为两个查询, 第一个检查p是否连接到c:

MATCH (p:Initial{state: 'Initial', name: 'Initial'})-[:raw {person_id:'1234', type:'Encounter', code:'abcd'}]->(c:Encounter{code:'abcd', state: 'Encounter', name: 'Encounter1'}) RETURN p,c

如果以上查询返回空,则发出第二个查询以形成该关系:

MATCH (p:Initial{state: 'Initial', name: 'Initial'})(c:Encounter{code:'abcd', state: 'Encounter', name: 'Encounter1'}) CREATE (p)-[:raw {person_id:'1234', type:'Encounter', code:'abcd'}]->(c)