-
Notifications
You must be signed in to change notification settings - Fork 25
Feature request: filter a given claim by language #122
Description
This issue follows on from a comment I left on #72.
I would like to be able to filter a given claim by language in order to create a column that contains, for example, only English occurrences of some data point.
My example (detailed at the Open Data Stack Exchange) uses Leptospermum scoparium (Q1520028), which has 8 common name (P1843) entries in various languages, including three in English.
Apologies if my naïveté in this regard causes any problems, but discussion on Twitter suggested that it might help to alter the SPARQL query here to include a FILTER(LANG(?best_label) = "en") statement, where en is the sought-after language:
openrefine-wikibase/wdreconcile/propertypath.py
Lines 285 to 297 in 2b066e1
| SELECT ?qid ?value | |
| (SAMPLE(COALESCE(?best_label, ?fallback_label)) as ?label) | |
| WHERE { | |
| ?qid %s ?value. | |
| VALUES ?value { %s } | |
| OPTIONAL { | |
| ?qid rdfs:label ?best_label . | |
| FILTER(LANG(?best_label) = "%s") | |
| } | |
| OPTIONAL { ?qid rdfs:label ?fallback_label } | |
| } | |
| GROUP BY ?qid ?value | |
| LIMIT %d |
If I can help in any way I would be happy to. Thank you.