必须为Neo4j中的CREATE指定单个关系类型

时间:2016-03-02 09:21:34

标签: neo4j

我正在尝试使用以下查询在两个节点之间创建关系:

load csv with headers from 
"file:C:/Users/abc/Documents/Neo4j/RT__RISK_LOSSEVENT.csv" as risklossevent 
match (a: RT__RISK_LOSSEVENT {LossEventId: risklossevent.LOSSEVENT_ID}),
(b: RT_RISK {RiskId: risklossevent.RISK_ID}) 
create (a)-[ASSOCIATED_WITH]->(b);

正在抛出错误说明

A single relationship type must be specified for CREATE (line 1, column 236 (offset: 235))

Neo.ClientError.Statement.InvalidSyntax

为了创建两个节点,我使用了以下查询:

load csv with headers from 
file:C:/Users/abc/Documents/Neo4j/RT__RISK_LOSSEVENT.csv" as risklossevent
create (rle1:RT__RISK_LOSSEVENT {RiskId: risklossevent.RISK_ID, LossEventId: risklossevent.LOSSEVENT_ID});

load csv with headers from "file:C:/Users/abc/Documents/Neo4j/RT_RISK.csv" as risk 
create (rle3:RT_RISK {RiskId: risk.RISK_ID, Owner: risk.OWNER, RiskCategory: risk.RISK_CATEGORY, Description: risk.DESCRIPTION});

任何人都知道语法或查询有什么问题吗?

1 个答案:

答案 0 :(得分:10)

实际上,您获得的异常并不是真正涉及您的语法错误,因此没有意义。

您忘记在查询中的关系类型之前添加colon:

create (a)-[:ASSOCIATED_WITH]->(b);