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.

My First Try - Modeling and Import CSV Structure

Good day. I've gone through the basic Neo4j and Cypher lessons. However, I have yet to start my first project -- until now. I'm a little rusty on what I studied in the spring. I have a list of employees who travel and work around the world. The employees might speak several languages and have several specialty areas they work in. Here is a sample of the data I want to enter as a graph:

Nodes

Associate
name: string
account#: string

Specialty
specialty: string (most associates will have multiple specialties)

Country
country: string

Organization
name: string
location: string

HealthCoverage (multiple types per associate possible)
type: string

Language
language:string

(I need to collect proficency level of each language spoken -- should this be a property of the language? Or a property of the SPEAKS relationship?)

Relationships

SPEAKS
SERVES_IN
SERVES_AT
HAS_SPECIALTY
HAS_HEALTH_COVERAGE

A simple query would find all associates with a certain specialty area, speaking French at a level 3 proficiency working in Peru.

Oh, and I'm trying to figure out the best way to set up my .csv file.

Do I list all of the Nodes as columns? Do I use a separate .csv for each node? How do I link them together?

Thanks!

John the Noob

4 REPLIES 4

ameyasoft
Graph Maven
Try this:

Assuming this .csv file structure:

Associate,Specialty,Country,Organization,HealthCoverage,Language,Proficiency

MERGE (a:Associate {name: "XYZ"})
MERGE (s:Specialty {specialty: ["XYZ","ABC"]})
MERGE (c:Country {country: "Peru"})
MERGE (o:Organization {name: "ABC"})
MERGE (h:HealthCoverage {name: "AMX"})
MERGE (l:Language {languages: ["English", "French"], profieciency: toInteger("3")  })

MERGE (c)-[:ORGANIZATION]->(o)
MERGE (o)-[:ASSPOCIATE]->(a)
MERGE (a)-[:SPECIALTY]->(s)
MERGE (a)-[:HEALTH_COVERAGE]->(h)
MERGE (a)-[:LANGUAGES]->(l)

Thank you for your quick reply. That looks good. I appreciate your help and will give it a try a little later.

Have a great day!

John

John,

collect proficency level of each language spoken -- should this be a property of the language? Or a property of the SPEAKS relationship?

I recommend you move proficiency to the relationship.

Also consider having a master set of Specialty nodes (1 per specialty) and link the person to each node. You can do that even if your CSV file is has single column with comma separated values

see this post for some ideas about CSV structure and load cypher - Populating database from CSV file with relations

Robert,

Thank you for taking the time to respond. I appreciate your helpful insights. I'm looking at the article you recommended now.

Have a great day!

John