我无法提取公司总部的位置属性。
我的查询:查找所有公司或子类,并返回一些基本属性,例如 ISIN 和 URL,以及总部位置。
我已经尝试使用这个例子来扩展查询的总部部分以返回位置信息,例如城市、国家和坐标纬度和经度。但是,我被困在拉取值或标签上。
谢谢
SELECT
?item ?itemLabel ?web ?isin ?hq ?hqloc ?inception
# valueLabel is only useful for properties with item-datatype
WHERE
{
?item p:P31/ps:P31/wdt:P279* wd:Q783794.
OPTIONAL{?item wdt:P856 ?web.} # get item
OPTIONAL{?item wdt:P946 ?isin.} # get item
OPTIONAL{?item wdt:P571 ?inception.} # get item
OPTIONAL{?item wdt:P159 ?hq.}
OPTIONAL{?item p:P159 ?hqItem. # get property
?hqItem ps:P159 wd:Q515. # get property-statement wikidata-entity
?hqItem pq:P17 ?hqloc. # get country of city
}
?article schema:about ?item .
?article schema:inLanguage "en" .
?article schema:isPartOf <https://en.wikipedia.org/>.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 10
一个更简单的查询来选择你提到的一些值:
SELECT
?company ?companyLabel ?isin ?web ?country ?countryLabel ?inception
WHERE
{
?article schema:inLanguage "en" .
?article schema:isPartOf <https://en.wikipedia.org/>.
?article schema:about ?company .
?company p:P31/ps:P31/wdt:P279* wd:Q783794.
?company wdt:P946 ?isin.
OPTIONAL {?company wdt:P856 ?web.}
OPTIONAL {?company wdt:P571 ?inception.}
OPTIONAL {?company wdt:P17 ?country.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} LIMIT 10
我改变了什么:
从这里开始,选择其他值应该很容易。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句