Dear community,
I'm struggling to grasp the essence of cypher.
my set :
USER (FIRSTNAME, LASTNAME, ...., LISTOFNAMES)
user1{'firstname1', 'lastname2', ....., 'firstname2 lastname2, firstname11 lastname11, firstname100 lastname 100'}
user2{'firstname2', lastname2', .... , 'firstname44 lastname 44'}
...
coming from a form. Users can name other users with their full name ('Firstname Lastname', not Firstname, Lastname).
I want to examinate the LISTOFNAMES. If inside this list an other user from my set is found (by comparing the concatenate of userX Firstname and Lastname), THEN I want to create a relationship between the two (I managed to do that somehow)
If the user is not found, I want to create this new user
LOAD CSV WITH HEADERS from 'file:///doc.csv' as row
match (n)
with n, split(row.LISTOFNAMES, ", ") as fullnames
unwind fullnames as fullname
match (m)
where fullname = m.Firstname + ' ' + m.Lastname
CREATE (n)-[rel]->(m)
(so far, that only does half of the job, and I cannot figure how to make the other case)
I tried the CASE and Foreach but either I get stuck in the process, or I get stuck by the syntax. It's very tricky.
Would you be so kind to guide me towards examples I could relate to ?