我目前正在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 MERGE
with other directives
答案 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)