query-af58c7273d7be8493c9761d4fbf5f5e8
]reply[01:14, 22 January 2021 (UTC)) talk (GettinwikiwiditThe idea here being that if someone took office as the first person after a scheduled election year then they were most likely elected to that office. I also tried excluding people who were appointed, but it looks like no one was appointed under this circumstance. ]reply[01:38, 23 January 2021 (UTC)) talk (GettinwikiwiditI've used this heuristic to fill in people who were elected in regular elections. As mentioned above it's probably a good idea to try to cross check this against other sources. The ones without an election are likely appointed. This can also be cross checked. . The hypothesis is that these were all elected in special elections. There are only ~170 of them. It should be easy enough to check.(P748)appointed by qualifiers, I looked at their first congresses served in and removed those marked with (P2715)elected in For senators without
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?sen ?senLabel ?district ?districtLabel ?termNum ?appointed ?start WHERE {
{
SELECT ?sen ?district (MIN(?term) AS ?first) WHERE {
?sen p:P39 ?ps.
?ps ps:P39 wd:Q4416090;
pq:P2937 ?term;
pq:P768 ?district;
pq:P580 ?start.
FILTER(NOT EXISTS { ?ps pq:P2715 ?election. })
FILTER(?start > "1913"^^xsd:dateTime)
}
GROUP BY ?sen ?district
}
?sen p:P39 ?ps.
?ps ps:P39 wd:Q4416090;
pq:P2937 ?first;
pq:P768 ?district;
pq:P580 ?start.
?first p:P31/pq:P1545 ?termNum.
FILTER(NOT EXISTS { ?ps pq:P2715 ?election. })
FILTER( xsd:integer(?termNum) > 65 )
FILTER NOT EXISTS { ?ps pq:P748 ?appointed. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?start