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.

All nodes and relationships appear

I just downloaded and installed Neo4J. Now I'm working with a simple csv that is looking like that:

So first I'm using the merge and some constraint for that file:

LOAD CSV WITH HEADERS FROM 'file:///Athletes.csv' AS line
MERGE(Rank:rank{rang: line.Rank})
MERGE(Name:name{nom: line.Name})
MERGE(Sport:sport{sport: line.Sport})
MERGE(Nation:nation{pays: line.Nation})
MERGE(Gender: gender{genre: line.Gender})
MERGE(BirthDate:birthDate{dateDeNaissance: line.BirthDate})
MERGE(BirthPlace: birthplace{lieuDeNaissance: line.BirthPlace})
MERGE(Height: height{taille: line.Height})
MERGE(Pay: pay{salaire: line.Pay})
CREATE CONSTRAINT ON(name:Name) ASSERT name.nom IS UNIQUE
CREATE CONSTRAINT ON(rank:Rank) ASSERT rank.rang IS UNIQUE

Then I want to display to which country the athletes live to. For that I use:

Create(name)-[:WORK_AT]->(nation)

But I have have that appear:

2X_3_329cdd1b35a15e25c5ed1a911769faaa289802f5.png

I would like to know why I have that please.

I thank in advance anyone that takes time to help me.

4 REPLIES 4

Hello Barbara,

You are creating nodes for each property read from the CSV file.

You should decide what your data model will be. For example, you will have Person nodes and possibly nodes for Sport and Country?

Please take a look at the example for loading data in the free online training course, Introduction to Neo4j. The last lesson of that course covers import.

You probably want a Person node to have a set of properties such as name, pay gender.

Much of how you model your data will depend upon the types of queries you want to do against the graph.

You should also check our our developer resources for graph data modeling here:

Elaine

ameyasoft
Graph Maven

Try this:

MATCH p = (n:name)-[:WORK_AT]->(m:nation) RETURN p

or

MATCH (n:name)-[:WORK_AT]->(m:nation) RETURN n, m

intouch_vivek
Graph Steward

Hi @barbara.rayan.34

You have used label variable as Name and Nation while creating Node and node variable used as name and nation while creating the relationship WORK_AT

Also it will be great if you explain bit more on your requirement if above does not work

Hi,
ok I understand better now. Thanks a lot !