Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
216 views
in Technique[技术] by (71.8m points)

database design - How make the relationship splitting the score of soccer in cypher

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})
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can try data model something like this: (Tool to create the model: http://www.apcjones.com/arrows/)

enter image description here

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...