cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot create relationships using the csv load headers

I have been trying to create a relationship between my data that I have imported using the csv load headers. The below code all works fine:

:auto USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:/Volumes/K_USB_YR4/Uni_Final_Year/Advanced_Databases/Twitter_Dataset/tweets.csv" AS csvLine
CREATE (:Tweet {tweetID: csvLine.tweetID, username: csvLine.username, text: csvLine.text});


:auto USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///C:/Users/BCH02300/Desktop/users.csv" AS csvLine
CREATE (:User {username: csvLine.username, source: csvLine.source});


:auto USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///C:/Users/BCH02300/Desktop/hashtags.csv" AS csvLine
CREATE (:Hashtag {hashtag: csvLine.tag});


CREATE INDEX ON :User(username);
CREATE INDEX ON :Tweet(tweetID);
CREATE INDEX ON :Hashtag(hashtag);

However the moment I try to create the relationships, the query does not ever finish loading:

:auto USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///C:/Users/BCH02300/Desktop/tweets.csv" AS csvLine 
MATCH (tweet:Tweet {tweetID: csvLine.tweetID}) 
MATCH (user:User {username: csvLine.username}) 
MERGE (user)-[:POSTS]->(tweet);


:auto USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///C:/Users/BCH02300/Desktop/tweets_and_hashtags.csv" AS csvLine
MATCH (tweet:Tweet {tweetID: csvLine.tweetID})
MATCH (hashtag:Hashtag {hashtag: csvLine.tag}) 
MERGE (tweet)-[:TAGS]->(hashtag);

The query works on my university network fine when I go to create the relationships, however not for my PC. I am running: Neo4j Browser version: 4.0.3 Neo4j Server version: 3.5.14 (enterprise)

Please can someone help me?
1 ACCEPTED SOLUTION

Sure. I can help.

You will need to modify the settings either through the Neo4j Desktop (Manage / Settings), or directly on the neo4j.conf file.

You will want to modify the following settings:

dbms.memory.heap.initial_size
dbms.memory.heap.max_size

I don't what else you are using your Mac for, but I would recommend increasing these settings to
2GB and 4G respectively.

dbms.memory.heap.initial_size=2G
dbms.memory.heap.max_size=4G

If you were running your Mac primarily for Neo4j, then I would recommend adjusting the other setting:

dbms.memory.pagecache.size

I would recommend changing this setting as follows:
dbms.memory.pagecache.size=4G

-yyyguy

View solution in original post

4 REPLIES 4

yyyguy
Graph Buddy

Can you try to do a bit of troubleshooting?

For the first section of creating a relationship, instead of trying to complete the MERGE, can you see if the Cypher query returns the Tweets and the Users?

LOAD CSV WITH HEADERS FROM "file:///C:/Users/BCH02300/Desktop/tweets.csv" AS csvLine 
MATCH (tweet:Tweet {tweetID: csvLine.tweetID}) 
MATCH (user:User {username: csvLine.username}) 
RETURN tweet, user;

If that is returning expected values, then you should be good to go with the MERGE.

Hello,

Yes so I return just users and tweets and the correct nodes do get returned.

I recently had an error that is no longer appearing however if stated: there is not enough memory to perform the current task please increase memory heap max size.

My Mac has 8GB of RAM? Could you advise what I can try?

Kayleigh Haydock

Sure. I can help.

You will need to modify the settings either through the Neo4j Desktop (Manage / Settings), or directly on the neo4j.conf file.

You will want to modify the following settings:

dbms.memory.heap.initial_size
dbms.memory.heap.max_size

I don't what else you are using your Mac for, but I would recommend increasing these settings to
2GB and 4G respectively.

dbms.memory.heap.initial_size=2G
dbms.memory.heap.max_size=4G

If you were running your Mac primarily for Neo4j, then I would recommend adjusting the other setting:

dbms.memory.pagecache.size

I would recommend changing this setting as follows:
dbms.memory.pagecache.size=4G

-yyyguy

Thank you so much, this has fixed my error that has been a long pain in my head. Much appreciated!!