Skip to content
Permalink
Browse files

Include previous term

  • Loading branch information...
tmtmtmtm committed Aug 23, 2018
1 parent 4638041 commit 4fffb1489b835ef450947304d3b0b542f326ede1
Showing with 7 additions and 2 deletions.
  1. +7 −2 scraper.rb
@@ -3,7 +3,12 @@

require 'wikidata/fetcher'

sparq = 'SELECT DISTINCT ?item WHERE { ?item p:P39 [ ps:P39 wd:Q21328626 ; pq:P2937 wd:Q56229988 ] }'
ids = EveryPolitician::Wikidata.sparql(sparq)
sparq = <<~SPARQL
SELECT DISTINCT ?item WHERE {
?item p:P39 [ ps:P39 wd:Q21328626 ; pq:P2937 ?term ] .
?term wdt:P571 ?term_start FILTER(YEAR(?term_start) >= 2008)
}
SPARQL

ids = EveryPolitician::Wikidata.sparql(sparq)
EveryPolitician::Wikidata.scrape_wikidata(ids: ids)

0 comments on commit 4fffb14

Please sign in to comment.
You can’t perform that action at this time.