query-6322d9c4e15ac3dd43fdc8f7a41665d0
Propertiesinstance of (P31)educated at (P69)
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?college ?collegeLabel (COUNT(DISTINCT ?alum) AS ?count)
WHERE {
{?college wdt:P31 wd:Q2581649} UNION {?college wdt:P31 wd:Q3338504}. # college or private hall
?alum wdt:P69 ?college.
MINUS { ?alum wdt:P31 wd:Q15632617 } # Exclude fictional people
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
?college rdfs:label ?collegeLabel }
} GROUP BY ?college ?collegeLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?alum"):::projected
v2("?college"):::projected
v4("?collegeLabel"):::projected
v5("?count")
c7(["bd:serviceParam"]):::iri
c3(["wd:Q3338504"]):::iri
c5(["wd:Q15632617"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
c2(["wd:Q2581649"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> c2
end
union0r <== or ==> union0l
end
v3 --"wdt:P69"--> v2
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P31"--> c5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
v2 --"rdfs:label"--> v4
end
bind2[/"count(?alum)"/]
v3 --o bind2
bind2 --as--o v5