问题
In EPL match, the results between two teams is 2-6, so how to make the relationship
and show that the high goals scored team won the match.
Here is an attempt to load the CSV data.
LOAD CSV WITH HEADERS FROM "file:///EPL_dataset_for_2018_19_assignment.csv" as row
MERGE (team1:EPL_Teams{name:row.Team1})
MERGE (team2:EPL_Teams{name:row.Team2})
MERGE (round:Round{name:row.Round})
MERGE (date:Date{name:row.Date})
MERGE (score1:Scores{name:row.HT})
MERGE (score2:Scores{name:row.FT})
回答1:
You can try data model something like this: (Tool to create the model: http://www.apcjones.com/arrows/)
This is just a hint, I stored score in the relationship if you need you can create a Score node and save the score and outcome in it and then connect this node to Match/Game and Team.
To get the score from string 2-6, you can split these values using the split function like this:
split(row.HT, "-") AS scores
This will create an array of length 2. You can easily get these values into variables or properties like:
scores[0] as team1_score, scores[1] as team2_score
来源:https://stackoverflow.com/questions/53976047/how-make-the-relationship-splitting-the-score-of-soccer-in-cypher