query-5c0cb50c073d15d9c00ab5c5e45cf04f
For each geospatial object in Belgium use the language as a layer if there is only one Label language.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?location ?layer WHERE {
{
SELECT ?item ?itemLabel ?itemDescription ?location (MIN (LANG(?lang_label)) as ?layer) (COUNT(?lang_label) as ?count_label) WHERE {
?item wdt:P17 wd:Q31.
?item wdt:P625 ?location.
?item rdfs:label ?lang_label.
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,fr,de,en,es,pl,ru,sv,ceb". }
}
GROUP BY ?item ?itemLabel ?itemDescription ?location
}
FILTER (?count_label = 1)
}
Query found at
- https://www.wikidata.org/wiki/User:Geertivp/training/Wikidata_Query/Geolocation/Languages_in_Belgium
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count_label")
v2("?item"):::projected
v4("?lang_label")
v5("?layer"):::projected
v3("?location"):::projected
c9(["nl,fr,de,en,es,pl,ru,sv,ceb"]):::literal
c7(["bd:serviceParam"]):::iri
c3(["wd:Q31"]):::iri
f0[["?count_label = '1^^xsd:integer'"]]
f0 --> v6
v2 --"wdt:P17"--> c3
v2 --"wdt:P625"--> v3
v2 --"rdfs:label"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind3[/"min(?lang_label)"/]
v4 --o bind3
bind3 --as--o v5
bind4[/"count(?lang_label)"/]
v4 --o bind4
bind4 --as--o v6