oat
oat

Reputation: 484

Got Neo4j syntax error using the same code from "Learning Neo4j" by Rik Van Bruggen

I used the following code from Rik's book (page 105): enter image description here

However, I got the following syntax error: enter image description here

I assume the symbols quoting Relationship Type is the backtick `

May I ask how to correct the syntax errors here?

Upvotes: 0

Views: 42

Answers (2)

SylvainRoussy
SylvainRoussy

Reputation: 359

Try to add parentheses like that : CREATE (from)-[:REL {type:rels.`Relationship type`}]->(to) Before v3.0, parentheses in patterns were not mandatory, now they are.

Upvotes: 1

Bruno Peres
Bruno Peres

Reputation: 16375

This is probably only a typo error in the book or maybe an old-syntax style. You should put parenthesis in from and to variables:

load csv with headers from "file:/your/path/to/rels.csv"
as rels
match (from {id: rels.From}), (to {id: rels.To})
create (from)-[:REL {type: rels.`Relationship Type`}]->(to)
return from, to

Upvotes: 2

Related Questions