How make the relationship splitting the score of soccer in cypher

送分小仙女□ 提交于 2019-12-13 22:30:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!