Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-14-2020 06:14 AM
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:
I would like to know why I have that please.
I thank in advance anyone that takes time to help me.
04-14-2020 06:58 AM
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
04-14-2020 09:52 AM
Try this:
MATCH p = (n:name)-[:WORK_AT]->(m:nation) RETURN p
or
MATCH (n:name)-[:WORK_AT]->(m:nation) RETURN n, m
04-14-2020 11:06 AM
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
04-19-2020 12:40 PM
Hi,
ok I understand better now. Thanks a lot !
All the sessions of the conference are now available online