query-161e3184e4adeda027f3c92b4847daa2
title: Classes of national pre-selections for Eurovision SELECT distinct ?item ?itemLabel ?stateLabel (COUNT(?inst) AS ?cnt) WHERE { ?item (wdt:P31) wd:Q62584801 . OPTIONAL {?item wdt:P17|wdt:P495 ?state} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ru,en" } OPTIONAL {?inst wdt:P31|wdt:P179 ?item} } GROUP BY ?item ?itemLabel ?stateLabel
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#>
#title: Classes of national pre-selections for Eurovision
SELECT distinct ?item ?itemLabel ?stateLabel (COUNT(?inst) AS ?cnt) WHERE {
?item (wdt:P31) wd:Q62584801 .
OPTIONAL {?item wdt:P17|wdt:P495 ?state}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ru,en" }
OPTIONAL {?inst wdt:P31|wdt:P179 ?item}
}
GROUP BY ?item ?itemLabel ?stateLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?cnt")
v3("?inst"):::projected
v1("?item"):::projected
v2("?state")
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,ru,en"]):::literal
c2(["wd:Q62584801"]):::iri
v1 --"wdt:P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 -."wdt:P495".-> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P17"--> v2
end
union0r <== or ==> union0l
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v3 -."wdt:P179".-> v1
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> v1
end
union1r <== or ==> union1l
end
end
bind1[/"count(?inst)"/]
v3 --o bind1
bind1 --as--o v4