I'd probably do a multi-pass, one per day

load csv with headers from "" as row
where row.Lundi = "x"
match (d:Day {name:"Lundi"})
with d,row.Serveur as serverName, collect(row.Script) as scripts
match (s:Server {name:serverName})
merge (d)-[:PROCESS]->(s)
with s,head(scripts) as first, scripts
match (scr1:Script {name: first})
create (s)-[:EXECUTION]->(scr1)
unwind range(0,size(scripts)-2) as idx
MATCH (a:Script {name:scripts[idx])
MATCH (b:Script {name:scripts[idx+1])
CREATE (a)-[:PUIS]->(b);


1. instead of MATCH you can also use merge, make sure you have the indexes / 
constraints created
2. instead of UNWIND you can also use FOREACH (but then you have to use MERGE 
for a,b not MERGE)

Michael

> Am 15.05.2015 um 11:49 schrieb [email protected]:
> 
> Hi all,
> 
> I've got .csv file with servers and scripts and days
> 
> Serveur            Script        Lundi        Mardi        Samedi
> AALTO            Script1        x                x           x
> AALTO            Script2        x                x
> AALTO            Script3                          x
> AALTO            Script4        x
> ABBOTT          Script5                         x           x
> ABBOTT          Script6        x
> ABBOTT          Script7                        x
> ABBOUD         Script8        x              x
> ABBOUD         Script9        x              x
> ABBOUD         Script10      x                           x
> ABBOUD         Script11                      x           x
> ABBOUD         Script12                      x           x
> 
> And i'd like to create following relationships :
> 
> Lundi-[:Process]->(AALTO)-[:Execution]->(Script1)-[:Puis]->(Script2)-[:Puis]->(Script4)
> Lundi-[:Process]->(ABBOTT)-[:Execution]->(Script6)
> Lundi-[:Process]->(ABBOUD)-[:Execution]->(Script8)-[:Puis]->(Script9)-[:Puis]->(Script10)
> 
> And so on for Mardi and Samedi
> 
> Thanks a lot for your help.
> 
> Fred
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to