query-ad051373ed2c631b10cdd5917890b7db
19:44, 27 August 2024 (UTC)) talk (VicarageIf I understand it right, I would just do: : I'm not sure I understand what you are trying to do exactly. This query seems way to complex for what you want. The second line is useless and the variables ?itemLabel and ?english have the same content. And if you want the variable ?native why not just get the Dutch label? Right now, you are also getting the multilingual label just to discard it afterwards.Vicarage@
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?native ?kLabel WHERE {
VALUES ?item {wd:Q2189292}
OPTIONAL {?item wdt:P31 ?k }
SERVICE wikibase:label {bd:serviceParam wikibase:language "en". }
OPTIONAL {?item wdt:P1448 ?native. FILTER (lang(?native) = "nl")} # official name
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v3("?k")
v1("?native"):::projected
c4(["bd:serviceParam"]):::iri
c6(["en"]):::literal
bind0[/VALUES ?item/]
bind0-->v2
bind00(["wd:Q2189292"])
bind00 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P31".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1448".-> v1
end