Relationship between nodes of same Label

Hi Elena and Neo4j Community,

Greetings for the Day,

Hope this message finds you well.

I am new to this forum and new for Neo4j as well. I was wondering if you can help with resolving an error when I was trying to replicate the same solution which you have provide to Jim in the above discuss. I'm using the same code and I am getting an error as follows


For the following statement:
MATCH (n:App) WHERE exists(n.Integration_ID)
UNWIND range(0,length(n.Integration_ID)) as element
MATCH (m:App {AID: n.Integration_ID[element]})
CREATE (n)-[:IS_INTEGRATED_WITH {dataPassed:n.Data_Passed[element]}]->(m)

Can you please tell me what am I doing wrong here?

Thanks
Regards
Nijil

Use size() for lists. length() I believe is currently reserved only for path variables.

Hi Andrew,

Thanks for the response. Really appreciate it..

Thanks
Regards
Nijil

@elena.kohlwey Awesome! Just what I was looking for. I was stuck with this for 2 days. Thanks a tonne!!!
@jfollen1 I wasn't able to put this similar issue in words. Thanks for asking this!

Hi Elena,
I have a data nodes like this. node1(email1) node2 (email2;email3)
I have to connect email1 to email2 and email1 to email3. I have to two columns in csv, first column only email1 will be there. In the second column some cells have single email and some cells have different emails like in node 2. I have to connect email1 in first column to different emails in second column. But in second column, some cells consists of two email ids. I have to split and connect them. Kindly suggest the solution

Hi ramthottempudi,

So, I am assuming that you load this csv file and you already have the nodes in Neo4j? Or do you want to create the nodes when loading the csv file?

If you already have the nodes and just want to connect them up then you need to do something like this:

LOAD CSV WITH HEADERS FROM 'file:///filename.csv' as row
MATCH (emailNodeFrom {email: row.node1})
WITH emailNodeFrom, split(row.node2,';') as emailsTo
UNWIND emailsTo AS emailTo
MATCH (emailNodeTo {email: emailTo})
CREATE (emailNodeFrom)-[:SOME_LABEL]->(emailNodeTo )

Regards,
Elena

Thank You So Much Elena.

--ramthottempudi

Hi, Elena thanks for quick response my previous email. I have one more question.

Question: I have two email nodes like : Person{email1}------{date, timestamp}------Person{email2}.
I have loaded the data from csv file. Now the question is a) between two timestamps, how many email communications are there between two time stamps many to many people emails. b) How frequently two people are communicating between two timestamps?

Hi,
I guess you are looking for something like:
a):

MATCH (a)-[s]->(b) WHERE s.timestamp > MyFirstTimeStamp AND s.timestamp < MyLastTimeStamp return count(s)

b):

MATCH (a {email:"email1"})-[s]->(b {email:"email2"}) WHERE s.timestamp > MyFirstTimeStamp AND s.timestamp < MyLastTimeStamp return count(s)