Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Supporting more formats for Qids in the entity suggest service #75

Open
wetneb opened this issue Feb 19, 2020 · 1 comment
Open

Supporting more formats for Qids in the entity suggest service #75

wetneb opened this issue Feb 19, 2020 · 1 comment

Comments

@wetneb
Copy link
Owner

wetneb commented Feb 19, 2020

@VladimirAlexiev wrote at OpenRefine/OpenRefine#2317:

In WD recon, "search for match" handles WD id's like "Q41370" nicely.

However, it should also handle other formats:

Cheers!

@wetneb
Copy link
Owner Author

wetneb commented Feb 19, 2020

If someone wants to have a go at this, the function that is responsible for this is here:

def find_something(self, args, typ='item', prefix=''):
lang = args.get('lang', 'en')
r = requests.get(mediawiki_api_endpoint,
{'action':'wbsearchentities',
'format':'json',
'type':typ,
'search':args['prefix'],
'language':lang,
'uselang':lang,
})
r.raise_for_status()
resp = r.json()
search_results = resp.get('search',[])
result = [
{
'id': item['id'],
'name': self.get_label(item, lang),
'description': item.get('description'),
}
for item in search_results]
return {'result':result}

(it handles searches for entities, properties and types)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant