wetneb / openrefine-wikibase

This repository has migrated to:
https://gitlab.com/nfdi4culture/ta1-data-enrichment/openrefine-wikibase
Other
100 stars 24 forks source link

Differences in results returned with suggest.py and wbsearchentities #132

Closed thadguidry closed 2 years ago

thadguidry commented 2 years ago

Summary

I have run some simple tests and there are differences between what is returned by wbsearchentities directly from a browser and what is returned from the suggest.py with it's find_something() that uses wbsearchentities and noting the differences in resullts with the same parameters used against both services.

This reflects itself as either very limited results or an empty array returned as @diegodlh mentioned in first comment in Issue #116 such as in clients like OpenRefine: image

Results


https://wdreconcile.toolforge.org/en/suggest/property?prefix=massach&spell=always&exact=false&scoring=schema&prefixed=true&type=Q207326

{result: [{id: "P8239", name: "MACRIS ID",…}]}
result: [{id: "P8239", name: "MACRIS ID",…}]
0: {id: "P8239", name: "MACRIS ID",…}
description: "identifier for a structure or a building in the Massachusetts Cultural Resource Information System database"
id: "P8239"
name: "MACRIS ID"

https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&search=massach&type=item&uselang=en

{"searchinfo":{"search":"massach"},"search":[{"id":"Q771","title":"Q771","pageid":1079,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q771","concepturi":"http://www.wikidata.org/entity/Q771","label":"Massachusetts","description":"state of the United States of America","match":{"type":"label","language":"en","text":"Massachusetts"}},{"id":"Q49108","title":"Q49108","pageid":51085,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q49108","concepturi":"http://www.wikidata.org/entity/Q49108","label":"Massachusetts Institute of Technology","description":"research university in Cambridge, Massachusetts, United States","match":{"type":"label","language":"en","text":"Massachusetts Institute of Technology"}},{"id":"Q126412","title":"Q126412","pageid":128513,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q126412","concepturi":"http://www.wikidata.org/entity/Q126412","label":"Massachusetts General Hospital","description":"teaching hospital in Massachusetts, United States","match":{"type":"label","language":"en","text":"Massachusetts General Hospital"}},{"id":"Q15142","title":"Q15142","pageid":17447,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q15142","concepturi":"http://www.wikidata.org/entity/Q15142","label":"University of Massachusetts Amherst","description":"public university in Massachusetts, USA","match":{"type":"alias","language":"en","text":"Massachusetts State College"},"aliases":["Massachusetts State College"]},{"id":"Q171985","title":"Q171985","pageid":172120,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q171985","concepturi":"http://www.wikidata.org/entity/Q171985","label":"Massachusetts Bay Transportation Authority","description":"public transit operator in the Boston metropolitan area","match":{"type":"label","language":"en","text":"Massachusetts Bay Transportation Authority"}},{"id":"Q17342542","title":"Q17342542","pageid":18939165,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q17342542","concepturi":"http://www.wikidata.org/entity/Q17342542","label":"member of the Massachusetts House of Representatives","match":{"type":"alias","language":"en","text":"Massachusetts representative"},"aliases":["Massachusetts representative"]},{"id":"Q20058776","title":"Q20058776","pageid":21728906,"repository":"wikidata","url":"//www.wikidata.org/wiki/Q20058776","concepturi":"http://www.wikidata.org/entity/Q20058776","label":"member of the State Senate of Massachusetts","description":"elected position in Massachusetts","match":{"type":"alias","language":"en","text":"Massachusetts State Senator"},"aliases":["Massachusetts State Senator"]}],"search-continue":7,"success":1}

Additional Context

It doesn't look like find_something() is tested in test_suggest.py with something like

        elif typ == 'item':
            return await suggest_engine.find_something(kwargs)

@wetneb The other thought is that &type=Q207326 and &type=item are completely different. Maybe this is an OpenRefine Reconcile column dialog improvement itself? My thought is that the As Property suggest dropdown boxes in OpenRefine Reconcile column dialog when used with Wikidata should always use &type=item or maybe I'm missing something?

wetneb commented 2 years ago

Yes, this is normal, the suggest endpoint of the reconciliation service that you are using is for properties, not for items. Use /en/suggest/entities (not /en/suggest/properties) if you want to get suggestions for items.

thadguidry commented 2 years ago

Ah! (drinks more coffee to make the day just a bit less frustrating)