query-9bd38906819d3bb13efcec2d81d67f09
11:38, 16 September 2023 (UTC)) talk (ShismaIs this it, or is there a better way to do this –You just need to use VALUES instead of repeating the same query for each value:
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 ?class ?classLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?targetClass {wd:Q3658341 wd:Q15773317 wd:Q365834}
?targetClass wdt:P279* ?class.
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?targetClass")
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
bind0[/VALUES ?targetClass/]
bind0-->v1
bind00(["wd:Q3658341"])
bind00 --> bind0
bind01(["wd:Q15773317"])
bind01 --> bind0
bind02(["wd:Q365834"])
bind02 --> bind0
v1 --"wdt:P279"--> v2