使用 Sparql (Wikidata) 查找美国总统的排名(数量)
Find Rank (Number) of US Presidents with Sparql (Wikidata)
我想使用 Sparql 查询从维基数据中查找排名(特朗普 45、奥巴马 44...)。
这个属性对于实体美国总统(Q11696)似乎不存在。有谁知道如何解决这个问题?
谢谢!
查看现有数据是您的朋友...至少我查看了例如Gerald Ford and found that there is a "position held" statement which itself has a "series ordinal" 值:
SELECT ?p ?pLabel ?rank WHERE {
# presidents of US
wd:Q30 (p:P6/ps:P6) ?p.
# get their "position held" statement (to "President of the United States of America" only)
?p p:P39 ?position_held_statement .
?position_held_statement ps:P39 wd:Q11696 .
?position_held_statement pq:P1545 ?rank . # here is the rank (series ordinal)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
我想使用 Sparql 查询从维基数据中查找排名(特朗普 45、奥巴马 44...)。 这个属性对于实体美国总统(Q11696)似乎不存在。有谁知道如何解决这个问题?
谢谢!
查看现有数据是您的朋友...至少我查看了例如Gerald Ford and found that there is a "position held" statement which itself has a "series ordinal" 值:
SELECT ?p ?pLabel ?rank WHERE {
# presidents of US
wd:Q30 (p:P6/ps:P6) ?p.
# get their "position held" statement (to "President of the United States of America" only)
?p p:P39 ?position_held_statement .
?position_held_statement ps:P39 wd:Q11696 .
?position_held_statement pq:P1545 ?rank . # here is the rank (series ordinal)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}