query-8c819f204101c91a6cbe34ad5324f6ef
I started doing this query for just any US senators and their academic majors, but those are so sparsely populated that I didn't proceed, the data just doesn't seem to be there.22:04, 10 February 2019 (UTC)) talk (Andrew Gray Senators/Representatives (below) currentYeah, the "major" qualifier isn't well-populated at all (partly because it's hard to import, I guess). There are just nine for
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 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#>
SELECT distinct ?person ?personLabel ?institutionLabel ?acaMajorLabel WHERE {
?person wdt:P31 wd:Q5.
{ ?person p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q13217683. }
union
{ ?person p:P39 ?positionStatement . ?positionStatement ps:P39 wd:Q13218630. }
?person p:P69 ?pEdu. ?pEdu ps:P69 ?institution . ?pEdu pq:P812 ?acaMajor.
?positionStatement pq:P2937 wd:Q28227688 . # current term only - comment out for all
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?acaMajor")
v4("?institution")
v3("?pEdu")
v1("?person"):::projected
v2("?positionStatement")
c11(["wd:Q28227688"]):::iri
c6(["wd:Q13218630"]):::iri
c13(["bd:serviceParam"]):::iri
c5(["wd:Q13217683"]):::iri
c2(["wd:Q5"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"p:direct/P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"p:P39"--> v2
v2 --"p:statement/P39"--> c6
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:P39"--> v2
v2 --"p:statement/P39"--> c5
end
union0r <== or ==> union0l
end
v1 --"p:P69"--> v3
v3 --"p:statement/P69"--> v4
v3 --"p:qualifier/P812"--> v5
v2 --"p:qualifier/P2937"--> c11
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end