Wikidata LabelService 未按预期运行
Wikidata LabelService does not behave as expected
下面的维基数据查询不符合我的预期:
# WikiData SPARQL Query
#
# Wolfgang Fahl 2018-01-06
#
# get father of queen victoria
SELECT ?queenVictoria ?queenVictoriaLabel ?fatherProperty ?fatherPropertyLabel ?father ?fatherLabel
WHERE {
#
# father
# https://www.wikidata.org/wiki/Property:P42
# Queen Victoria
# https://www.wikidata.org/wiki/Q9439
BIND (wdt:P22 AS ?fatherProperty).
BIND (wd:Q9439 AS ?queenVictoria).
?queenVictoria ?fatherProperty ?father.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
结果是
queenVictoria queenVictoriaLabel fatherProperty fatherPropertyLabel father. fatherLabel
wd:Q9439 Queen Victoria wdt:P22 http://www.wikidata.org/prop/direct/P22 wd:Q157009 Prince Edward Augustus, Duke of Kent and Strathearn
我原以为标签是维多利亚女王、父亲和 "Prince Edward Augustus"。
我的查询有什么问题?或者这是一个错误?
返回 http://www.wikidata.org/prop/direct/P22
而不是 father
的原因是 Wikidata truthy predicates do not have labels (try DESCRIBE wdt:P22
). Only proper properties 有标签(尝试 DESCRIBE wd:P22
)。
维基数据label service could wrap this situation, but it doesn't:
SERVICE wikibase:label
only supplies labels for entities in the wd:
namepace.
因此,try 这个查询:
SELECT ?queenLabel ?realpropertyLabel ?fatherLabel
WHERE {
VALUES (?queen) {(wd:Q9439)}
VALUES (?property) {(wdt:P22)}
?queen ?property ?father .
?realproperty wikibase:directClaim ?property
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
下面的维基数据查询不符合我的预期:
# WikiData SPARQL Query
#
# Wolfgang Fahl 2018-01-06
#
# get father of queen victoria
SELECT ?queenVictoria ?queenVictoriaLabel ?fatherProperty ?fatherPropertyLabel ?father ?fatherLabel
WHERE {
#
# father
# https://www.wikidata.org/wiki/Property:P42
# Queen Victoria
# https://www.wikidata.org/wiki/Q9439
BIND (wdt:P22 AS ?fatherProperty).
BIND (wd:Q9439 AS ?queenVictoria).
?queenVictoria ?fatherProperty ?father.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
结果是
queenVictoria queenVictoriaLabel fatherProperty fatherPropertyLabel father. fatherLabel
wd:Q9439 Queen Victoria wdt:P22 http://www.wikidata.org/prop/direct/P22 wd:Q157009 Prince Edward Augustus, Duke of Kent and Strathearn
我原以为标签是维多利亚女王、父亲和 "Prince Edward Augustus"。
我的查询有什么问题?或者这是一个错误?
返回 http://www.wikidata.org/prop/direct/P22
而不是 father
的原因是 Wikidata truthy predicates do not have labels (try DESCRIBE wdt:P22
). Only proper properties 有标签(尝试 DESCRIBE wd:P22
)。
维基数据label service could wrap this situation, but it doesn't:
SERVICE wikibase:label
only supplies labels for entities in the wd: namepace.
因此,try 这个查询:
SELECT ?queenLabel ?realpropertyLabel ?fatherLabel
WHERE {
VALUES (?queen) {(wd:Q9439)}
VALUES (?property) {(wdt:P22)}
?queen ?property ?father .
?realproperty wikibase:directClaim ?property
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}