Wikidata SPARQL查询演员和剧组

Wikidata SPARQL查询演员和剧组,sparql,wikidata,Sparql,Wikidata,我的目标是创建一个sparql查询,检索演员和剧组的列表,以及它的wikidata类型导演、编剧、演员成员 到目前为止,我有: SELECT ?titleLabel ?castLabel ?property ?propertyLabel WHERE { ?title wdt:P345 "tt0848228". ?title wdt:P57 ?cast. ?property wikibase:propertyType ?propertyType. SERVICE w

我的目标是创建一个sparql查询,检索演员和剧组的列表,以及它的wikidata类型导演、编剧、演员成员

到目前为止,我有:

SELECT ?titleLabel ?castLabel ?property ?propertyLabel WHERE { ?title wdt:P345 "tt0848228". ?title wdt:P57 ?cast. ?property wikibase:propertyType ?propertyType. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } 我想要获得的输出是一个表,其中包含如下行:

复仇者,Joss Whedon,wd:P57,导演 …我想到了:


就是这样。谢谢
SELECT ?titleLabel ?castLabel ?property ?propLabel
WHERE {
    ?title wdt:P345 "tt0848228".
    # take all claims on this movie
    ?title ?property ?cast .
    # that involve a human
    ?cast wdt:P31 wd:Q5 .

    # get the property label
    # see https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries#Adding_labels_for_properties
    hint:Query hint:optimizer "None" .
    ?prop wikibase:directClaim ?property .

    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}