1

Leptospermum scoparium (Q1520028) has 8 common name (P1843) entries.

I have data in OpenRefine reconciled to this object: Google OpenRefine screenshot showing plain-text data reconciled to WikiData

How can I get only those P1843 entries that are in English? The reconciliation documentation says to use Len to get, for example, the English label of a given object, but I can't work out the SPARQL syntax that would deliver what I want.

I have tried P1843/Len and P1843|Len but these operators don't work the way I thought:

OpenRefine reconcile data modal

I realise I can limit the number of values returned per row, but the values are returned in the order in which they appear, meaning in this instance the Welsh common name appears first.

If I can't do what I need through a SPARQL-like syntax on the reconcile screen, is there some way to obtain the JSON response from the reconciliation and parse it? I've tried jsonize(cell.recon.match) but that just gives:

{"id":"Q1520028","name":"Leptospermum scoparium","types":["Q16521"],"score":100}

Thanks in advance.

0

Currently there is no way to do this simply via the reconciliation API. What you could do instead is use the "Add columns by fetching URLs" feature to retrieve the JSON representation of the item from Wikidata (for instance with the expression "https://www.wikidata.org/wiki/Special:EntityData/"+cell.recon.match.id+".json").

Then manipulate that object to get what you need (probably doable in GREL, but personally I would go for Python).

1
  • Excellent, thanks! That syntax is exactly the sort of thing I wanted -- how to build my own query and parse the JSON.
    – Hugh
    Sep 9 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.