Establish relationship among nodes in Neo4j -


i new neo4j. have customer , product data neo4j. while loading have not established relationship among them. want establish relation among them like:

create (customer1)-[:bought]->(item1),(customer1)-[:bought]->(item2); 

after execute statement says relationship established , when try access like:

start n=node(*) match (n)-[:bought]->(items) n.nodename! = "customer1" return items; 

it says 0 rows. think if establishes relationship should give me 2 items, item1 & item2.

any idea?

apparently, didn't set nodename customer1 node in creation query. try modify this:

create (customer1 { nodename:'customer1' }), (item1 { nodename:'item1' }), (item2 { nodename:'item2' }), (customer1)-[:bought]->(item1), (customer1)-[:bought]->(item2); 

then second query should return 2 rows expected.

update: ok, didn't understand question correctly. so, want establish relationship between existing nodes. try this:

start customer1=node:node_auto_index(nodename='customer1'), item1=node:node_auto_index(nodename='item1'), item2=node:node_auto_index(nodename='item2') create (customer1)-[:bought]->(item1),(customer1)-[:bought]->(item2); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -