Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-05-2019 08:43 PM
Hi there,
I am trying to import a large dataset consists of 8 CSV files using admin import but I am facing difficulty on how to create relationships among them.
Here is the explanation of the CSV files.
I want to create relationships among them based on the addID and txID exist in each file.
Note that, I create a header of each file in a separate CSV file. I was able to successfully create the addresses and users relationship using:
neo4j-admin import --id-type=STRING \
--nodes:User="import/users-header.csv,import/users.csv" \
--nodes:Address="import/addresses-header.csv,import/addresses.csv" \
--relationships:PARTOF="import/partof-header.csv,import/users.csv,import/addresses.csv" \
--ignore-missing-nodes=true \
--ignore-duplicate-nodes=true \
--high-io=true
and the partof-header.csv is as following:
START_ID(Address),:END_ID(User)
,
the addresses-header is
addID:ID(Address),address
and users-header is
addID:IGNORE,userID:ID(User)
but when it comes to other files, I faced difficulty to create the relationship.
Can anyone guide me on how to create relationships based on their IDs.
Does anyone have any suggestions on how I could do this more efficiently?
Many thanks,
Khaled
Solved! Go to Solution.
11-10-2019 11:57 PM
Sorry for late reply, Thank you for replying me
I have already successfully loaded the files into neo4j by assigning the files that contain the primary keys in the node and the files contain foreign keys in the relationship.
I first match the files that have only addID and txID with the files that have primary keys in the node using Emeditor, then i used the following codes to process the data.
neo4j-admin import --id-type=STRING ---nodes:User="import/users-header.csv,import/user.csv" --nodes:Address="import/addresses-header.csv,import/addresses.csv" --nodes:Txhash="import/txhash-header.csv,import/txht.csv" --relationships:PARTOF="import/partof-header.csv,import/user.csv,import/addresses.csv" --relationships:TO="import/incoming-header.csv,import/txin.csv" --relationships:SENDING="import/outcoming-header.csv,import/txout.csv" --ignore-missing-nodes=true --ignore-duplicate-nodes=true --high-io=true
11-06-2019 07:36 AM
I think you could do that like this:
neo4j-admin import --id-type=STRING \
--nodes:User="import/users-header.csv,import/users.csv" \
--nodes:Address="import/addresses-header.csv,import/addresses.csv" \
--relationships:PARTOF="import/partof-header.csv,import/users.csv,import/addresses.csv" \
--relationships:ADDRESS="import/address-header.csv,import/Incoiming Transaction.csv" \
--ignore-missing-nodes=true \
--ignore-duplicate-nodes=true \
--high-io=true
where import/address-header.csv contains the following:
:START_ID(Transaction),:END_ID(Address),value
You can process the CSV multiple times to create different parts of the graph.
Does that make sense/work for you?
11-10-2019 11:57 PM
Sorry for late reply, Thank you for replying me
I have already successfully loaded the files into neo4j by assigning the files that contain the primary keys in the node and the files contain foreign keys in the relationship.
I first match the files that have only addID and txID with the files that have primary keys in the node using Emeditor, then i used the following codes to process the data.
neo4j-admin import --id-type=STRING ---nodes:User="import/users-header.csv,import/user.csv" --nodes:Address="import/addresses-header.csv,import/addresses.csv" --nodes:Txhash="import/txhash-header.csv,import/txht.csv" --relationships:PARTOF="import/partof-header.csv,import/user.csv,import/addresses.csv" --relationships:TO="import/incoming-header.csv,import/txin.csv" --relationships:SENDING="import/outcoming-header.csv,import/txout.csv" --ignore-missing-nodes=true --ignore-duplicate-nodes=true --high-io=true
All the sessions of the conference are now available online