How to query Wikidata for “also known as”

给你一囗甜甜゛ 提交于 2020-05-27 04:32:12

问题


I would like to know how to query Wikidata by using the alias ("also known as").

Right now I am trying

SELECT ?item
WHERE
{
?item rdfs:aliases ?alias.
FILTER(CONTAINS(?alias, "Angela Kasner"@en))
}
LIMIT 5

This is simply a query that works if I replace rdfs:aliases by rdfs:labels.

I am trying this, because Help:Aliases says that aliases are searchable in the same way as labels, but I can't find any other resource on that nor can I find an example.


回答1:


This query might be helpful for someone querying also known as for properties:

SELECT ?property ?propertyLabel ?propertyDescription (GROUP_CONCAT(DISTINCT(?altLabel); separator = ", ") AS ?altLabel_list) WHERE {
    ?property a wikibase:Property .
    OPTIONAL { ?property skos:altLabel ?altLabel . FILTER (lang(?altLabel) = "en") }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
 }
GROUP BY ?property ?propertyLabel ?propertyDescription
LIMIT 5000


来源:https://stackoverflow.com/questions/46850562/how-to-query-wikidata-for-also-known-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!