Skip to content

Instantly share code, notes, and snippets.

@jacksonj04
Created September 26, 2018 11:07
Show Gist options
  • Save jacksonj04/555aefe321960449df7800c259ba34a2 to your computer and use it in GitHub Desktop.
Save jacksonj04/555aefe321960449df7800c259ba34a2 to your computer and use it in GitHub Desktop.
Generate Seed for Legislature
SELECT ?membershipLabel ("-" as ?count) ?itemLabel ?item ("yes" as ?namePopulated) ("yes" as ?positionPopulated) ?membership ?districtLabel ?district ?partyLabel ?party ("-" as ?fbPop) ?fb
WHERE
{
BIND (wd:Q1135593 as ?legislature) .
?item p:P39 ?node .
?node ps:P39 ?membership .
?membership wdt:P361 ?legislature .
OPTIONAL { ?node pq:P768 ?district }
OPTIONAL { ?node pq:P4100 ?party }
OPTIONAL { ?node pq:P582 ?endtime }
OPTIONAL { ?item wdt:P2013 ?fb }
FILTER(!BOUND(?endtime) || ?endtime > NOW())
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,es". }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment