此查询应该返回特定比赛中特定球队的球员比例。但是,当我在我的 stardog db 上运行它时,什么都没有返回。Stardog 甚至没有表示有 0 个结果或填写列标题。我将查询粘贴到 yasgui.org 的界面中,查询似乎格式正确(没有语法错误)。有谁知道为什么它没有返回预期的结果?
select ?competition ?team (COUNT(distinct ?team_1_player)/COUNT(distinct ?player) as ?proportion)
where {
?team_1_player prop:competesIn ?competition.
?team_1_player prop:memberOf ?team.
?player prop:competesIn ?competition.
}
group by ?competition ?team
order by desc(?proportion)
以下类似查询确实返回了预期结果。它的作用完全一样,只是它返回的是团队球员和比赛中所有球员的总和,而不是某个球队的球员比例。
select distinct ?competition ?team (COUNT(distinct ?team_1_player) as ?num_team_players) (COUNT(distinct ?player) as ?num_players)
where {
?team_1_player prop:competesIn ?competition.
?team_1_player prop:memberOf ?team.
?player prop:competesIn ?competition.
}
group by ?competition ?team
order by desc(?num_team_players)