query-0a547fcaf19b5ac1f842543dd5270ba1

rq turtle/ttl

specify senators who served in a particular legislative term? 19:10, 18 March 2021 (UTC)) talk (M2545)? Advice would be much appreciated! Thank you. -- W. Bazinet. Example: other legislatures (but who served as senators during house members. There should only be 40 senators in the list. How to exclude the people who served in the 1929-1930 legislature as 11 extra names for Massachusetts senators who served in the 1929-1930 legislature returns Listerabot queryThis  ⟩  (Q96050576)1929-1930 Massachusetts legislature ⟨  (P2937)parliamentary term  ⟩  (Q20058776)member of the State Senate of Massachusetts ⟨  (P39)position held  ⟩?item⟨ : I don’t know why you want to exclude this specific legislature, but here we go by filtering out those with a statement like M2545@

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT distinct ?item ?linkcount where
{
   { select ?item where
{
  ?position wdt:P279* wd:Q20058776 .    
  ?item p:P39 [ps:P39 ?position 
                      ; pq:P2937 ?leg
                      ; wikibase:rank ?rank
              ] .           # position held: Massachusetts state senator
  filter ( ?leg not in (wd:Q96050576)) .
  filter (?rank != wikibase:DeprecatedRank)

} }  FILTER NOT EXISTS {                              # has no en.wikipedia sitelink
    ?wen schema:about ?item .
    ?wen schema:isPartOf <https://en.wikipedia.org/> .
  }
  ?item wdt:P793 wd:Q96050576 .                      # significant event: 1929 legislature
  ?item wdt:P31 wd:Q5 .                            # human
  OPTIONAL {?item wikibase:sitelinks ?linkcount .} # count of sitelinks  
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v4("?leg") v6("?linkcount"):::projected v5("?position") v3("?rank") v1("?wen") a1((" ")) c5(["wd:Q96050576"]):::iri c3([https://en.wikipedia.org/]):::iri c14(["wd:Q5"]):::iri c7(["wd:Q20058776"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"schema:about"--> e0v2 e0v1 --"schema:isPartOf"--> e0c3 e0v2("?item"):::projected e0v1("?wen"):::projected e0c3([https://en.wikipedia.org/]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 f0 --> c2 f0 --> c3 v1 --"schema:about"--> v2 v1 --"schema:isPartOf"--> c3 f1[["?rank != 'wikibase:DeprecatedRank'"]] f1 --> v3 f2[["?leg != 'wd:Q96050576'"]] f2 --> v4 v5 --"p:direct/P279"--> c7 a1 --"p:statement/P39"--> v5 a1 --"p:qualifier/P2937"--> v4 a1 --"wikibase:rank"--> v3 v2 --"p:P39"--> a1 v2 --"p:direct/P793"--> c5 v2 --"p:direct/P31"--> c14 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wikibase:sitelinks".-> v6 end