RedisGraph-将多个指令与MERGE相结合



我目前正在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似乎不支持将MERGE与其他指令结合

  1. 有什么解决办法吗
  2. 是否可以更改查询以允许它在没有match语句的情况下执行相同的功能

我现在看到的唯一选项是将其拆分为两个查询,第一个检查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)

最新更新