I recently tried to populate a neo4j test database using this code :
WITH ["Paul","Graham","Voord","Heisenberg","Earles","Grey","Herzog","Griffith","Rogers","Huxley","Waldorf","Astor","Mellon","Humphrey","Messerschmidt","Carmichael","Buchanan","Dalton","Valentino","Meyerholz","Ellington","Abernathy","Harrington","Monroe","Rutherford","Vanderbilt","Montgomery","Worthington","Fitzwilliam","Covington","Hollingsworth"]
AS names,
["Associates",""]
AS suffixes
FOREACH (r IN range(0,49) | CREATE (:Societe {id:10000+r, name:names[r % size(names)]+" & "+names[(r+3) % size(names)]+" "+suffixes[r % size(suffixes)]}));
FOREACH (r IN range(0,99) | CREATE (:Dossier {id:20000+r, Numero:"0"+(r*4)+100}));
MATCH (s:Societe),(d:Dossier)
WITH s,d
WHERE rand() < 0.1
CREATE (s)-[:CONTAINS]->(d);
But, as you may have guessed, the four last lines create n-to-n relationships between my (:Dossiers) and my (:Societes). What i initially wanted was to create a 1-to-n relationship between these, so that a (:Dossier) can be linked to one (:Societe) at most.
Any idea how to accomplish this ?
Thanks.