此查询应该返回特定比赛中某个球队的球员比例。 但是当我在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)