Hi, i have created a neo4j graph database with formula 1 data based on data 
found on ergast.com developer api. 
All well sofar. Now i want to use a multi line case kind of statement in 
cypher in order to do a match based on the content of a field in the input 
file but i cannot make the case statement to work.. the syntax is not 
correct as i get en error on the case statement  .. most of the code works 
but what would be the valid approach to create such a case statement in 
cypher ... ?

My cypher code looks like

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS
FROM "file:///incident.csv" AS line
MERGE (incident:Incident { id: TOINT(line.incidentId) })
SET incident.session = line.session, incident.allegation = line.allegation
SET incident.involving = line.`incident involving`, incident.outcome = 
line.outcome
SET incident.reason = line.reason, incident.notes = line.notes
WITH line,incident
CASE incident.session
    WHEN "R"  THEN MATCH (session:Session:R)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "Q1" THEN MATCH (session:Session:Q1)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "Q2" THEN MATCH (session:Session:Q2)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "Q3" THEN MATCH (session:Session:Q3)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "P1" THEN MATCH (session:Session:P1-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "P2" THEN MATCH (session:Session:P2)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    WHEN "P3" THEN MATCH (session:Session:P3)-->(grandprix:GrandPrix {id: 
TOINT(line.raceId)})
    END
MERGE (incident)-[:SESSION]->(session)


thanks koen


-- 
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