Py学习  »  Redis

RedisGraph-将多个指令与MERGE结合

Kasun Ilangaratne • 4 年前 • 882 次点击  

我正在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

  1. 有什么解决办法吗?
  2. 可以更改查询以允许它在不使用match语句的情况下执行相同的功能吗?
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50089
 
882 次点击  
文章 [ 1 ]  |  最新文章 4 年前
SWilly22
Reply   •   1 楼
SWilly22    5 年前

我现在看到的唯一选择就是把它分成两个查询, 第一个检查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)