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.

Help with data import and creating a complex relationship

Hi I'm a neo4j beginner. I want to build a complex relationship using csv file.

company_name,ticker,isin,country,marketcap,industry,concept,concept_id,year_quarter,total_hits,total_documents
BBVA BANCO FRANCES ADR,,US0589341009,US,1200.0,Financial,Payment services,138,2017-03,1.0,1.0
BBVA BANCO FRANCES ADR,,US0589341009,US,1200.0,Financial,Digital banking ,130,2017-03,5.0,1.0
BBVA BANCO FRANCES,FRAN,ARP125991090,AR,1213.25704,Financial,Payment services,138,2017-03,1.0,1.0

Here is the csv sample data.

I want to build relationship like this (company_name,industry,concept) -[:hist{num:total_hits}->year_quarter]

I'm very appreciate if you can help me.

thanks

1 REPLY 1

I think the data model needs tweaking, but here is something to help you get started.

load csv with headers from "file:///Book1.csv" as row
merge(n:Company{company_name:row.company_name,industry:row.industry,concept_id:row.concept_id})
merge(c:YearQuarter{period:row.year_quarter})
merge(n)-[:HISTORY{total_hits:row.total_hits}]->(c)
return n, c

Screen Shot 2022-12-01 at 2.26.44 PM.png