Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Feature request: filter a given claim by language #122

@hughlilly

Description

@hughlilly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions