错误:MERGE开放密码查询Agensgraph只允许一种关系类型

时间:2018-08-24 15:30:58

标签: cypher relationship agens-graph

在开放密码查询中是否允许以下​​Realationship创建,我要在Agensgraph中进行尝试,

MATCH (mc: mat_comp)
MATCH (p:plant)
MATCH (mb: material)
WHERE mc.component = mb.material and mc.plant=p.b_plant
MERGE (mc) <- [ comp_2_p] - ( p)
;
ERROR: only one relationship type is allowed for MERGE

我在做什么错误...因为mat_comp和plant节点具有共同的植物mat_comp和material节点具有共同的材料     mat_comp     有材料栏     植物专栏

p: plant
mb:
material colum

MATCH (mc: mat_comp)
MATCH (p:plant)
MATCH (mb: material)
WHERE mc.comp = mb.material and mc.plant=p.b_plant
RETURN mc.comp, mb.material, mc.plant, p.b_plant;
comp | material | plant | b_plant
------------+------------+-------+--------------
"10" | "10" | "33" | "33"

=# \d material
material | character varying(50) | | | |
b_plant | character varying(50) |

=# \d mat_comp
material | character varying(50) | | | |
comp | character varying(50) | | | |
plant | character varying(50) | | | |

-# \d plant
--------------+-----------------------+-----------+----------+---------+-------------
b_plant | character varying(50) |

1 个答案:

答案 0 :(得分:0)

我认为您的查询在MERGE子句中有一个简单的错误。

切入要点。您可以使用此查询

MERGE (mc) <- [:comp_2_p] - (p)

错误是冒号。 冒号后面的单词是组件的类型(例如节点和边)。 冒号前面的单词就像Cypher子句中的代词(我不知道它的确切名字。)。

如果使用上述查询仍然存在另一个错误,则应检查是否声明了elabel“ comp_2_p”。