Open tfrancart opened 2 years ago
Voir également l'API query : https://www.mediawiki.org/wiki/API:Prefixsearch Sur la page d'accueil, voici l'API qui est envoyée:
https://www.wikidata.org/w/api.php?action=wbsearchentities&search=chat&format=json&errorformat=plaintext&language=en&uselang=en&type=item
The following SPARQL query against wikidata endpoint works fine with autocompletion + class criteria. The drawback is that 50 entities are returned first, and after only the filtering on the type happens. Which can lead to small number of results
SELECT DISTINCT ?person ?personLabel WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "EntitySearch" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:search "alb" .
bd:serviceParam mwapi:language "en" .
# The maximum limit we can set is 50.
# bd:serviceParam mwapi:limit "50" .
?person wikibase:apiOutputItem mwapi:item .
}
?person wdt:P31/wdt:P279* wd:Q5.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?personLabel
There is also the OpenLink Wikidata demo SPARQL endpoint : https://wikidata.demo.openlinksw.com/sparql?default-graph-uri=&query=%0D%0Aselect+%3Fs+%3Fo+%0D%0Awhere+%0D%0A++%7B+%0D%0A++++++graph+%3Fg+%0D%0A++++++%7B+%0D%0A+++++++++%3Fs+rdfs%3Alabel+%3Fo+.%0D%0A+++++++++%3Fo+bif%3Acontains++%27%22Paris%22%27++.%0D%0A+++++++++filter+%28lang%28%3Fo%29+%3D+%22en%22%29%0D%0A++++++++%0D%0A++++++%7D%0D%0A++++%0D%0A++%7D%0D%0A%0D%0Alimit+100+&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&signal_void=on&signal_unconnected=on&run=+Run+Query+
Voici l'appel qui est fait depuis l'autocompletion dans l'interface Wikidata:
On voit aussi passer ca:
Doc de l'API wbsearhentities: https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities
Extrait du résultat: