I want to query a string "Merkel".
I want the output to be something like:
ID instance_of LABEL
---------- ------------- ---------------
Q567 Q5 Angela Merkel
Q1921787 Q101352 Merkel
Q969485 Q1093829 Merkel
This is what I have until now. Click here to see on WIkidata Query
SELECT ?instance_of ?s ?p ?o ?label WHERE {
?s ?label "Merkel"@de.
?s ?p ?o
OPTIONAL { ?s wdt:P31 ?instance_of. }}
I want the search results to be ranked, most popular/relevant to least relevant. I have no clue on how to do that.
On the Wikidata website, they do it when you search for a term, perhaps a order by statements and sitelinks is a possible solution.