维基数据 SPARQL 查询演职人员
Wikidata SPARQL query cast & crew
我的 objective 是创建一个 sparql 查询来检索演员表和工作人员列表及其维基数据类型 ("director", "screenwriter", "cast member", .. .)
到目前为止我有这个:
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". }
}
我想要实现的输出是一个 table,其中的行如下:
"The Avengers", "Joss Whedon", "wd:P57", "director"
...
我想出了 this query:
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". }
}
我的 objective 是创建一个 sparql 查询来检索演员表和工作人员列表及其维基数据类型 ("director", "screenwriter", "cast member", .. .)
到目前为止我有这个:
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". } }
我想要实现的输出是一个 table,其中的行如下:
"The Avengers", "Joss Whedon", "wd:P57", "director"
...
我想出了 this query:
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". }
}