query-416a6812dca7f5a50548d7291bda251b
German chancellors with number of spouses
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#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?chancellor ?chancellorLabel ?spouse_number WHERE {
?chancellor wdt:P569 ?birthday .
?chancellor wdt:P39 wd:Q4970706 .
{SELECT ?chancellor (COUNT(?spouse) AS ?spouse_number) WHERE {
?chancellor p:P26 ?spouse_statement .
?spouse_statement v:P26 ?spouse
} GROUP BY ?chancellor }.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "de" .
}
} ORDER BY DESC(?spouse_number) ?birthday
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?birthday")
v3("?chancellor"):::projected
v5("?spouse")
v6("?spouse_number"):::projected
v4("?spouse_statement")
c9(["de"]):::literal
c7(["bd:serviceParam"]):::iri
c3(["wd:Q4970706"]):::iri
v3 --"p:direct/P569"--> v2
v3 --"p:direct/P39"--> c3
v3 --"p:P26"--> v4
v4 --"p:statement/P26"--> v5
bind1[/"count(?spouse)"/]
v5 --o bind1
bind1 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end