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

Feature request: filter a given claim by language #122

Open
hughlilly opened this issue Sep 9, 2021 · 2 comments
Open

Feature request: filter a given claim by language #122

hughlilly opened this issue Sep 9, 2021 · 2 comments

Comments

@hughlilly
Copy link

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:

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.

@wetneb
Copy link
Owner

wetneb commented Sep 9, 2021

So the tasks for this would be to:

  • decide on a syntax to specify such a filter in our current property paths. Perhaps something like P1843[en]?
  • implement it, with the appropriate unit tests

@trnstlntk
Copy link

+1'ing this use case / feature request. Today, I tried to use data extension to specifically retrieve Spanish-language monolingual taxon common name values of a set of taxon items on Wikidata; it would be great if this were possible.

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

3 participants