I have to convert this mongoDB document into a neo4j. This is an example of document:
{
"_id" : "Atl.02",
"official_name" : "Club Atletico de Madrid S.A.D.",
"common_name" : "Atletico Madrid",
"country" : "Spain",
"started_by" : {
"day" : 26,
"month" : 4,
"year" : 1903
},
"stadium" : {
"name" : "Vicente Calderón",
"capacity" : 54907
},
"palmarès" : {
"La Liga" : 10,
"Segunda Division" : 1,
"Copa del Rey" : 10,
"Supercopa de Espana" : 2,
"UEFA Europa League" : 2,
"UEFA Cup Winners Cup" : 1,
"UEFA Super Cup" : 2,
"FIFA Club World cup" : 1
},
"uniform" : "blue, white and red"
}
I create a team node:
CREATE (n:team {_id:"Atl.02", official_name:"Club Atletico de Madrid S.A.D.",
common_name:"Atletico Madrid", country:"Spain",
started_by_day: 26, started_by_month:4, started_by_year:1903,
uniform:"blue, white and red"})
A stadium node:
CREATE (n:stadium {name:"Vicente Calderòn", capacity:54907})
The relationship between the team and the stadium:
MATCH (n:team), (n1:stadium) WHERE n._id="Atl.02" AND
n1.name="Vicente Calderòn" CREATE n-[r:PLAYS]->n1
Here is a picture:
The first thing is:
how to convert the information about palmarès?
I thought two possibilities:
1) put this information in team node
2) create a new node, called palmarès, and set the properties on the relationship
What do you think?
And waht about started by information? Is it a good choice to put it in team node?
I recommend that you represent the individual prizes as separate nodes, since the same prize can be won by multiple teams in different years. Also, the queries for specific prizes would be easier to write and run quicker.
For example:
I think putting "started_by" in the Team node is fine, but you might want to store the year/month/day as a single integer (e.g., an epoch date) to make it easier to do Cypher queries involving the date.
Or, if you have no convenient way to convert the year/month/day to an integer, you can combine them into an 8-character string (in year, month, and day order). Here is an example of how to do that:
The resulting
date
would be: "19930116".