我想获得职业生涯的信息,为球员曾在某一特定的球队,谁是出生后的特定日期。我成功地执行了以下查询:
select ?playerName ?year ?teamName ?matches ?goals where {
?player a dbo:SoccerPlayer ;
rdfs:label ?playerName ;
dbo:birthDate ?birthDate ;
dbo:careerStation ?station .
?station dbo:years ?year ;
dbo:team ?team ;
dbo:team/rdfs:label ?teamName ;
dbo:numberOfMatches ?matches ;
dbo:numberOfGoals ?goals .
filter (langMatches(lang(?teamName), "EN"))
filter (xsd:date(?birthDate) > "1980-01-01"^^xsd:date)
filter (
?team = <http://dbpedia.org/resource/Olympique_Lyonnais>
|| ?team = <http://dbpedia.org/resource/AS_Monaco_FC>
)
}
order by ?playerName ?year我的问题是:
谢谢你的帮助!
发布于 2019-03-28 14:41:28
正如评论中指出的那样,你必须使用一个子查询来让所有的球员都为那些球队效力,并在1980年之后出生。在外部查询中,您可以获得他们所有的职业数据:
select ?playerName ?year ?teamName ?matches ?goals where {
# get all players for given teams born after 1980
{
select distinct ?player {
?player a dbo:SoccerPlayer ;
dbo:birthDate ?birthDate ;
dbo:careerStation/dbo:team ?team
filter (?team in (dbr:Olympique_Lyonnais, dbr:AS_Monaco_FC))
filter (xsd:date(?birthDate) > "1980-01-01"^^xsd:date)
}
}
# get all their career station data
?player a dbo:SoccerPlayer ;
rdfs:label ?playerName ;
dbo:birthDate ?birthDate ;
dbo:careerStation ?station .
?station dbo:years ?year ;
dbo:team ?team ;
dbo:team/rdfs:label ?teamName ;
dbo:numberOfMatches ?matches ;
dbo:numberOfGoals ?goals .
filter (langMatches(lang(?teamName), "EN"))
}
order by ?playerName ?yearhttps://stackoverflow.com/questions/55397864
复制相似问题