有些城市不是城市或大城市的实例?维基数据的奇怪行为
Some cities aren't instances of city or big city? Odd behaviour of Wikidata
在检查官方示例查询 "Continents, countries, regions and capitals"(在 https://query.wikidata.org/, limited to Germany for your convenience here: link), I noticed that some capitals of German federal states were missing. For example Wiesbaden as capital of Hesse. I noticed that Wiesbaden is an instance of big city
, but not of city
(see https://www.wikidata.org/wiki/Q1721 上)的结果时,与其他一些城市形成对比。通过将第 17 行更改为 ?city wdt:P31/wdt:P279? wd:Q515
.
,我还包括属于 city
子类的城市,从而缓解了这个问题
仍然失踪的四个城市之一是萨克森-安哈尔特州的首府马格德堡。
诊断查询
SELECT ?cityLabel ?props
WHERE {
?city wdt:P31 ?props.
FILTER(?city = wd:Q1733 || ?city = wd:Q1726).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
显示 Magdeburg 甚至不是 city
的实例,尽管它显然是根据其维基数据页面 https://www.wikidata.org/wiki/Q1733。
我是 Wikidata 和 SPARQL 的新手。但是,这对我来说似乎是错误的。我该怎么做才能获得德国联邦州的所有首都?这种行为的原因是什么?
这些缺失的语句不是 truthy:
SELECT ?statement ?valueLabel ?rank ?best
WHERE {
wd:Q1733 p:P31 ?statement.
?statement ps:P31 ?value .
?statement wikibase:rank ?rank .
OPTIONAL { ?statement a ?best . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
它们是普通级别的语句,但是有一个首选级别的语句。
Truthy statements represent statements that have the best
non-deprecated rank for given property. Namely, if there is a
preferred statement for property P2, then only preferred statements
for P2 will be considered truthy. Otherwise, all normal-rank
statements for P2 are considered truthy.
更新
我有decreased the rank of the preferred statement just now。请再次测试您的查询。
在检查官方示例查询 "Continents, countries, regions and capitals"(在 https://query.wikidata.org/, limited to Germany for your convenience here: link), I noticed that some capitals of German federal states were missing. For example Wiesbaden as capital of Hesse. I noticed that Wiesbaden is an instance of big city
, but not of city
(see https://www.wikidata.org/wiki/Q1721 上)的结果时,与其他一些城市形成对比。通过将第 17 行更改为 ?city wdt:P31/wdt:P279? wd:Q515
.
,我还包括属于 city
子类的城市,从而缓解了这个问题
仍然失踪的四个城市之一是萨克森-安哈尔特州的首府马格德堡。
诊断查询
SELECT ?cityLabel ?props
WHERE {
?city wdt:P31 ?props.
FILTER(?city = wd:Q1733 || ?city = wd:Q1726).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
显示 Magdeburg 甚至不是 city
的实例,尽管它显然是根据其维基数据页面 https://www.wikidata.org/wiki/Q1733。
我是 Wikidata 和 SPARQL 的新手。但是,这对我来说似乎是错误的。我该怎么做才能获得德国联邦州的所有首都?这种行为的原因是什么?
这些缺失的语句不是 truthy:
SELECT ?statement ?valueLabel ?rank ?best
WHERE {
wd:Q1733 p:P31 ?statement.
?statement ps:P31 ?value .
?statement wikibase:rank ?rank .
OPTIONAL { ?statement a ?best . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
它们是普通级别的语句,但是有一个首选级别的语句。
Truthy statements represent statements that have the best non-deprecated rank for given property. Namely, if there is a preferred statement for property P2, then only preferred statements for P2 will be considered truthy. Otherwise, all normal-rank statements for P2 are considered truthy.
更新
我有decreased the rank of the preferred statement just now。请再次测试您的查询。