如何建立关系来分裂足球中的足球得分 [英] How make the relationship splitting the score of soccer in cypher

查看:87
本文介绍了如何建立关系来分裂足球中的足球得分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EPL比赛中,两队之间的结果是2-6,因此如何建立关系
并显示得分高的球队赢得了比赛.

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.

这是尝试加载CSV数据的尝试.

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})

推荐答案

您可以尝试如下数据模型: (用于创建模型的工具: http://www.apcjones.com/arrows/)

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

这只是一个提示,如果需要,我会在关系中存储分数,您可以创建一个Score节点并在其中保存分数和结果,然后将该节点连接到Match/Game和Team.

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.

要从字符串2-6获得分数,您可以使用以下拆分函数拆分这些值:

To get the score from string 2-6, you can split these values using the split function like this:

split(row.HT, "-") AS scores

这将创建一个长度为2的数组. 您可以轻松地将这些值转换为变量或属性,例如:

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

这篇关于如何建立关系来分裂足球中的足球得分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆