query-f23e428c9726d2b7195fedaff9023170
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?p ?pLabel ?instance (GROUP_CONCAT(DISTINCT ?native_name; separator=", ") AS ?nativenames) (GROUP_CONCAT(DISTINCT ?birth_name; separator=", ") AS ?birthnames)
WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "ja.wikipedia.org"; #エンドポイントを設定
wikibase:api "Generator";
mwapi:generator "categorymembers";
mwapi:gcmtitle "Category:人物名目録(日本)";. #対象カテゴリ
?item wikibase:apiOutputItem mwapi:item.
}
FILTER BOUND (?item) # 入れないと下位カテゴリ(?)も含まれる為
# ?item wdt:P301 ?p.
OPTIONAL {?item wdt:P301 ?p.}
BIND(IF(BOUND(?p),?p,"P301が未リンク") AS ?p).
OPTIONAL { ?p wdt:P31 ?instance } # 分類
OPTIONAL { ?p wdt:P1559 ?native_name } #母語表記
OPTIONAL { ?p wdt:P1477 ?birth_name. } #出生名
SERVICE wikibase:label { bd:serviceParam wikibase:language "ja,en". }
}
GROUP BY ?item ?itemLabel ?p ?pLabel ?instance
LIMIT 5000