For CREATE, one type of relationship must be specified in Neo4j.

I am trying to create a connection between two nodes using the following query:

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); 

It gives an error message

 A single relationship type must be specified for CREATE (line 1, column 236 (offset: 235)) Neo.ClientError.Statement.InvalidSyntax 

To create two nodes, I used the following queries:

 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}); 

Does anyone know what is wrong with the syntax or query?

+5
source share
1 answer

Indeed, the exception you receive is not actually related to the syntax error you have, and therefore does not make sense.

You forgot to add colon :: to the type of relationship in the request:

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

Source: https://habr.com/ru/post/1244284/


All Articles