And I should add there's a third party api called open refine that can filter by types:
https://tools.wmflabs.org/openrefine-wikidata/ https://tools.wmflabs.org/openrefine-wikidata/en/api?query=%7B%22query%22:%22bush%22,%22type%22:%22Q5%22%7D On Tue, Jun 4, 2019 at 2:44 PM Marielle Volz <marielle.v...@gmail.com> wrote: > Yes, the api is at > https://www.wikidata.org/w/api.php?action=query&list=search&srsearch=Bush > > There's a sandbox where you can play with the various options: > > https://www.wikidata.org/wiki/Special:ApiSandbox#action=query&format=json&list=search&srsearch=Bush > > > On Tue, Jun 4, 2019 at 2:22 PM Tim Finin <fi...@umbc.edu> wrote: > >> What's the best way to search Wikidata for items whose name or alias >> matches a string? The search available via pywikibot seems to only find a >> match if the search string is a prefix of an item's name or alias, so >> searching for "Bush" does not return any of the the George Bush items. I >> don't want to use a SPARQL query with a regex, since I expect that to be >> slow. >> >> The search box on the Wikidata pages is closer to what I want. Is there >> a good way to call this via an API? >> >> Ideally, I'd like to be able to specify a language and also a set of >> types, but I can do that once I've identified candidates based on a simple >> match with a query string. >> _______________________________________________ >> Wikidata mailing list >> Wikidata@lists.wikimedia.org >> https://lists.wikimedia.org/mailman/listinfo/wikidata >> >
_______________________________________________ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata