query-8486d42d91bba9cd462ebb802635324f
German members of the German Bundestag with a doctorate university degree
SELECT ?politician ?politician_label ?institution ?institutionLabel ?degreeLabel WHERE { ?politician p:P39 # find items that have the position [ps:P39 wd:Q1939555 ; # of member of German Bundestag pq:P2715 wd:Q15062956 ] . # and a qualifier "elected in the 2017 German federal election"
?politician p:P69 ?educatedAt . # has an "educated at" statement
?educatedAt ps:P69 ?institution . # get value of the "educated at" statement, i.e. the institution
?institution wdt:P625 ?geoloc . # get the geolocation of the institution just for fun
OPTIONAL {?educatedAt pq:P512 ?degree } # get qualifier "academic degree" (P512)
?degree wdt:P31/wdt:P279 wd:Q849697 . # filter for doctoral degrees
OPTIONAL {?politician rdfs:label ?politician_label filter (lang(?politician_label) = "en") .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ASC (?politician)
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# German members of the German Bundestag with a doctorate university degree
#
SELECT ?politician ?politician_label ?institution ?institutionLabel ?degreeLabel
WHERE
{
?politician p:P39 # find items that have the position
[ps:P39 wd:Q1939555 ; # of member of German Bundestag
pq:P2715 wd:Q15062956 ] . # and a qualifier "elected in the 2017 German federal election"
?politician p:P69 ?educatedAt . # has an "educated at" statement
?educatedAt ps:P69 ?institution . # get value of the "educated at" statement, i.e. the institution
?institution wdt:P625 ?geoloc . # get the geolocation of the institution just for fun
OPTIONAL {?educatedAt pq:P512 ?degree } # get qualifier "academic degree" (P512)
# ?degree wdt:P31*/wdt:P279* wd:Q849697 . # filter for doctoral degrees
OPTIONAL {?politician rdfs:label ?politician_label filter (lang(?politician_label) = "en") .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ASC (?politician)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?degree")
v3("?educatedAt")
v5("?geoloc")
v4("?institution"):::projected
v1("?politician"):::projected
v2("?politician_label"):::projected
a1((" "))
c5(["wd:Q15062956"]):::iri
c3(["wd:Q1939555"]):::iri
c13(["bd:serviceParam"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
a1 --"p:statement/P39"--> c3
a1 --"p:qualifier/P2715"--> c5
v1 --"p:P39"--> a1
v1 --"p:P69"--> v3
v3 --"p:statement/P69"--> v4
v4 --"p:direct/P625"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P512".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."rdfs:label".-> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end