cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Confuse about Node Properties

Hi, I'm kinda confuse about setting node properties. I've seen 2 ways of doing that on the internet and i don't know the difference.

LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
CREATE (n:Customer {a: row.a, b: row.b, c: row.c})

LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
CREATE (n:Customer {a: row.a})
ON CREATE SET n.b = row.b , n.c = row.c
;

what I need is a node with 3 properties a, b, and c. Thanks

4 REPLIES 4

either approach you list is valid.
Is there a specific concern?

hi @dana.canzano thanks for replying.

are both approach exactly the same for applying property? when i tried the first one (CREATE (n:Customer {a: row.a, b: row.b, c: row.c})) , i cant see b and c while visualizing in Neo4j Browser. meanwhile i could when using the latter approach

if you run

LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
CREATE (n:Customer1 {a: row.a, b: row.b, c: row.c});

LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
CREATE (n:Customer2 {a: row.a})
ON CREATE SET n.b = row.b , n.c = row.c
;

which is the same as you previously provided other than I'm changing the labels for the node from :Customer to :Customer1 for the 1s LOAD CSV and :Customer to :Customer2 for the 2nd LOAD CSV

and then if you run

match (n:Customer1) return n.a, n.b, n.c;

and

match (n:Customer2) return n.a, n.b, n.c;

do you get the same results/output

and if your issue is that in the browser the value displayed in the node circle in graph view is a value that is not what you want then see Browser operations - Neo4j Browser which allows you to define the caption dispalyed within the node itself