LOAD CSV WITH HEADERS FROM 'file:c:/Users/Fred/Desktop/cgp2.csv' AS row 
FIELDTERMINATOR ';'
with 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)
with scripts
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)


> Am 18.05.2015 um 23:32 schrieb [email protected]:
> 
> Michael,
> 
> Thanks and sorry for that again, i'm lost with that :
> 
> WITH is required between CREATE and UNWIND (line 14, column 1 (offset: 386))
> "unwind range(0,size(scripts)-2) as idx"
> 
> Best Regards,
> 
> Fred
> 
> 
> Le lundi 18 mai 2015 23:20:27 UTC+2, Michael Hunger a écrit :
> Sorry, forgot a WITH row
> 
>> LOAD CSV WITH HEADERS FROM 'file:c:/Users/Fred/Desktop/cgp2.csv' AS row 
>> FIELDTERMINATOR ';'
> WITH row
>> where row.Lundi = "x"
> ...
> 
>> Am 18.05.2015 um 22:20 schrieb cdu8...@ <>gmail.com <http://gmail.com/>:
>> 
>> Hi Michael,
>> 
>> It should be nearly good but it isn't.
>> 
>> LOAD CSV WITH HEADERS FROM 'file:c:/Users/Fred/Desktop/cgp2.csv' AS row 
>> FIELDTERMINATOR ';'
>> 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)
>> 
>> I've got the following error :
>> Invalid input 'h': expected 'i/I' (line 2, column 2 (offset: 93))
>> "where row.Lundi = "x""
>> 
>> Thanks a lot for your help.
>> 
>> Best Regards,
>> 
>> Fred
>> 
>> 
>> Le samedi 16 mai 2015 23:44:02 UTC+2, Michael Hunger a écrit :
>> you need to have the nodes for days, servers, scripts etc. before otherwise 
>> use merge
>> 
>>> Am 16.05.2015 um 23:21 schrieb [email protected] <>:
>>> 
>>> Hi Michael,
>>> 
>>> Thanks for your answer, i tried to followyour solution but without success.
>>> 
>>> LOAD CSV WITH HEADERS FROM 'file:c:/Users/Fred/Desktop/cgp2.csv' AS row 
>>> FIELDTERMINATOR ';'
>>> merge (d:Day {name:"Lundi"})
>>> where row.Lundi = "x"
>>> with d,row.Serveur as serverName, collect(row.Script) as scripts
>>> merge (s:Serveur {name:serverName})
>>> merge (d)-[:PROCESS]->(s)
>>> with s, scripts, size(scripts) as size
>>> merge (scr1:Script {name: scripts[0]})
>>> create (s)-[:EXECUTION]->(scr1)
>>> FOREACH (idx in range(0,size-2) |
>>>   MERGE (s1:Script {name:scripts[idx]})
>>>   MERGE (s2:Script {name:scripts[idx+1]})
>>>   CREATE (s1)-[:AFTER]->(s2))
>>> WITH scripts, s
>>> 
>>> When i do a match n return n it returns nothing.
>>> 
>>> Thanks for your help.
>>> 
>>> Best regards,
>>> 
>>> Fred
>>> 
>>> Le vendredi 15 mai 2015 11:49:23 UTC+2, [email protected] 
>>> <http://gmail.com/> a écrit :
>>> 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] <>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>>> <cgp2.csv>
>> 
>> 
>> -- 
>> 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 neo4j+un...@ <>googlegroups.com <http://googlegroups.com/>.
>> 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] 
> <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