query-87fa522fe0666fbc3b9cbd428023cf0e

rq turtle/ttl

Appointments after election to the subsequent term, but are described as having been appointed subsequent to a term they were elected for. Appointed SenatorsThese senators are not listed on senate.gov's list of

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?sen ?senLabel ?ps ?diff WHERE {
  #hint:Query hint:optimizer "None".
  ?sen p:P39 ?ps;
       wdt:P1157 ?bioid.
  ?ps ps:P39 wd:Q4416090;
      pq:P2937 ?term;
      pq:P580 ?start.
  ?term p:P31/pq:P1545 ?termNum;
      wdt:P582 ?termEnd.
FILTER NOT EXISTS { ?ps pq:P2715 [] }
FILTER NOT EXISTS { ?ps pq:P748 [] }
  FILTER NOT EXISTS {
    ?term wdt:P155 ?prevTerm.
    ?sen p:P39 ?ps2.
    ?ps2 ps:P39 wd:Q4416090;
         pq:P748 [];
         pq:P2937 ?prevTerm. }
FILTER ( xsd:integer(?termNum) > 65 )
  BIND ( (?termEnd - ?start) AS ?diff )
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by xsd:integer(?diff )

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?bioid") v11("?diff"):::projected v4("?prevTerm") v7("?ps"):::projected v6("?ps2") v5("?sen"):::projected v9("?start") v3("?term") v10("?termEnd") v2("?termNum") a3((" ")) a2((" ")) a1((" ")) a4((" ")) c15(["bd:serviceParam"]):::iri c5(["wd:Q4416090"]):::iri c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["http://www.w3.org/2001/XMLSchema#integer(?termNum) > '65^^xsd:integer'"]] f0 --> v2 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"p:direct/P155"--> e0v2 e0v3 --"p:P39"--> e0v4 e0v4 --"p:statement/P39"--> e0c4 e0v4 --"p:qualifier/P748"--> e0a1 e0v4 --"p:qualifier/P2937"--> e0v2 e0v2("?prevTerm"):::projected e0v4("?ps2"):::projected e0v3("?sen"):::projected e0v1("?term"):::projected e0a1((" ")):::projected e0c4(["wd:Q4416090"]):::iri end f1--EXISTS--> f1e0 f1 --> v3 f1 --> c2 f1 --> v4 f1 --> v5 f1 --> c3 f1 --> v6 f1 --> c4 f1 --> c5 f1 --> c6 f1 --> a1 f1 --> c7 v3 --"p:direct/P155"--> v4 v5 --"p:P39"--> v6 v6 --"p:statement/P39"--> c5 v6 --"p:qualifier/P748"--> a1 v6 --"p:qualifier/P2937"--> v4 f2[["not "]] subgraph f2e1["Exists Clause"] e1v1 --"p:qualifier/P748"--> e1a1 e1v1("?ps"):::projected e1a1((" ")):::projected end f2--EXISTS--> f2e1 f2 --> v7 f2 --> c6 f2 --> a2 v7 --"p:qualifier/P748"--> a2 f3[["not "]] subgraph f3e2["Exists Clause"] e2v1 --"p:qualifier/P2715"--> e2a1 e2v1("?ps"):::projected e2a1((" ")):::projected end f3--EXISTS--> f3e2 f3 --> v7 f3 --> c8 f3 --> a3 v7 --"p:qualifier/P2715"--> a3 v5 --"p:P39"--> v7 v5 --"p:direct/P1157"--> v8 v7 --"p:statement/P39"--> c5 v7 --"p:qualifier/P2937"--> v3 v7 --"p:qualifier/P580"--> v9 v3 --"p:P31"--> a4 a4 --"p:qualifier/P1545"--> v2 v3 --"p:direct/P582"--> v10 bind4[/"?termEnd - ?start"/] v10 --o bind4 v9 --o bind4 bind4 --as--o v11 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end