Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query Wikidata for "also known as"

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.

like image 622
Junge Avatar asked Oct 20 '17 13:10

Junge


1 Answers

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
like image 178
Michail Michailidis Avatar answered Sep 20 '22 05:09

Michail Michailidis