0

I am trying to model soccer matches and the referees and teams that play in them. I want to create nodes based on matches, referees, and players and am not clear on the best approach to model them? That is should I model it after cities, matches? Do I create a root node Id etc?

The kind of information I would looking for later would be stuff like:

1). Show all the matches for a particular referee (could be in multiple cities) 2). Show all matches where referee worked and home team won 3). show all referees that that have the highest count of wins for the home team? 4). show most active refereess in a particular city

As you can see there are all sorts of questions and for someone new this can be a little overwhelming. While I am reading some books, I wanted to see if any experts could help me in the scenario above. Again not sure if I need a root node that connects all the cities and referees and matches or just keep things independent. Your feedback would be most appreciated.

4

2 回答 2

1

我做了一些足球/足球比赛的建模,这可能会很有趣 - http://staging.thinkingingraphs.com/

与 Luanne 所说的大致相同,尽管我有特定的关系类型表明哪支球队在主场和客场比赛。我一直在写我在这里建立模型时发现的东西 - http://www.markhneedham.com/blog/tag/neo4j/page/2/

于 2013-07-08T22:39:41.153 回答
1

目前似乎满足您发布的查询的可能模型之一:

(球队)-[:PLAYS]->(比赛)

(比赛)-[:HAS_REFEREE]->(裁判)

(比赛)-[:PLAYED_IN]->(城市)

PLAYS 关系可以有一个属性来指示球队是否是主队。您还可以在 PLAYS 关系上使用一个属性来指示该团队是否获胜。或者,如果获胜是您所寻找的重要部分,您可以创建一个额外的关系,例如 (Team)-[:WON]->(Match) (不过,您需要考虑如何为平局建模。一场比赛中两支球队中的任何一支都没有获胜关系可能表明可能是平局)。

1) 特定裁判的所有比赛:从裁判开始,穿过比赛到城市。您可以索引裁判的一些独特属性,以便能够快速查找他

2) 裁判工作且主队获胜的所有比赛:从裁判开始,查找他的所有比赛,过滤 WON 关系/属性和主队属性

3)主队胜场数最高的所有裁判:同上,从所有裁判开始

4)一个城市最活跃的裁判:从城市开始,找到所有比赛及其裁判

您可能会根据您想要回答的更多问题(尤其是主队属性、赢/输关系或属性等)稍微调整一下。

而且我认为您根本不需要根节点。如果您想找到所有比赛/城市/裁判等,您可以编制索引

于 2013-07-08T13:17:49.483 回答