query-30ff6ce70b1a53db29378a27f624af47

rq turtle/ttl

Mismatched election dates vs start times, so thought I'd check for anyone else who was elected in a different year than their start date: (Q17020044)1994 Rotherham by-election , rather than (Q16999906)1963 Rotherham by-election was mistakenly first elected in the (Q695061)Denis MacShane In my slow tidy-up of historic by-elections, I noticed this morning that

Use at

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 ?item ?itemLabel ?start_time ?election_date WHERE {
  ?item p:P39 ?ps .
  ?ps ps:P39/wdt:P279 wd:Q16707842 .
  ?ps pq:P2715 ?election .
  ?ps pq:P580 ?start_time .
  ?election wdt:P585 ?election_date .
  FILTER (YEAR(?start_time) != YEAR (?election_date))
  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("?election") v2("?election_date"):::projected v3("?item"):::projected v4("?ps") v1("?start_time"):::projected a1((" ")) c9(["bd:serviceParam"]):::iri c4(["wd:Q16707842"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["year-from-dateTime(?start_time) != year-from-dateTime(?election_date)"]] f0 --> v1 f0 --> v2 v3 --"p:P39"--> v4 v4 --"p:statement/P39"--> a1 a1 --"p:direct/P279"--> c4 v4 --"p:qualifier/P2715"--> v5 v4 --"p:qualifier/P580"--> v1 v5 --"p:direct/P585"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end