query-4ebc8669333d2fc39aa2154da9de6327
Human beings with at least five 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 ?human ?humanLabel ?spouse_number WHERE {
?human wdt:P31 wd:Q5 .
{SELECT ?human (COUNT(?spouse) AS ?spouse_number) WHERE {
?human p:P26 ?spouse_statement .
?spouse_statement v:P26 ?spouse
} GROUP BY ?human } .
FILTER (?spouse_number>=5)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY DESC(?spouse_number) ?humanLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?human"):::projected
v2("?humanLabel"):::projected
v5("?spouse")
v6("?spouse_number"):::projected
v4("?spouse_statement")
c7(["bd:serviceParam"]):::iri
c3(["wd:Q5"]):::iri
c9(["en"]):::literal
f0[["?spouse_number >= '5^^xsd:integer'"]]
f0 --> v6
v3 --"p:direct/P31"--> c3
v3 --"p:P26"--> v4
v4 --"p:statement/P26"--> v5
bind2[/"count(?spouse)"/]
v5 --o bind2
bind2 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end