Too many return relationships

Disclaimer: I am new to neo4j. I went through the textbook. I created my data and loaded it into graphdb, and I'm trying to check if the import is correct.

I am not sure if the problem I am facing is what I am doing in import or in cypher request.

I use this import tool to import the following files (it was filtered below to just contain the lines that I am currently studying):

application_id node file:

application_id:ID(application_id),:LABEL 2036983247,application_id 2037028183,application_id 

personal_phone node file:

 personal_phone:ID(personal_phone),:LABEL 5555551234,personal_phone 

relationship file:

 :START_ID(personal_phone),:END_ID(application_id),:TYPE 5555551234,2036983247,APPLIED 5555551234,2037028183,APPLIED 

My cypher request:

 match p= (a {personal_phone:'5555551234'}) -->(b) return p 

In my results, I see that the personal_phone node has 2 'APPLIED' relationships with each of the application_id nodes. I expected to see only one. Where am I mistaken?

EDIT: This is what I see. The center of the node is the personal_phone node.

enter image description here

EDIT 2: So, I realized that with the dump statement from neo4j shell I can get the database export. I decided that I ran it for the nodes in question:

 $ dump match p= (a personal_phone:'5555551234'})-->(b) return p; 

Returns:

 begin create (_5:`application_id` {`application_id`:"2036983247"}) create (_410:`application_id` {`application_id`:"2037028183"}) create (_6928:`personal_phone` {`personal_phone`:"5555551234"}) create _6928-[:`APPLIED`]->_410 create _6928-[:`APPLIED`]->_5 create _6928-[:`APPLIED`]->_410 create _6928-[:`APPLIED`]->_5 ; commit 

This shows that I definitely have a recurring relationship. Any ideas on how I can fix this?

+7
neo4j cypher
source share
2 answers

Wow - the error in my import was a problem. It went unnoticed because many different files were imported, but basically I had a relationship file importing twice into my script file:

 --relationships "f:\temp\r_personal_phone_application_id_APPLIED.csv" --relationships "f:\temp\r_personal_phone_application_id_APPLIED.csv" 
+1
source share

You add two APPLIED relationships from one personal_phone node to two different application_id nodes.

When you MATCH all relationships from this personal_phone node, you really expect to get two APPLIED relationships as a result.

+2
source share

All Articles