everypolitician / compare_with_wikidata

Library for diffing Wikidata and CSVs
MIT License
2 stars 0 forks source link

Example case: Heads of Government #14

Closed tmtmtmtm closed 7 years ago

tmtmtmtm commented 7 years ago

We have a variety of reports to make sure that the Heads of Government information in Wikidata is consistent across three different ways it could be added. However, if a country gets a new HoG, and no-one updates any of those three in Wikidata, it will be consistently wrong. So we also scrape the Wikipedia "Heads of State and Government" page to https://morph.io/everypolitician-scrapers/heads-of-government-wikipedia, and want to be able to compare that against what's in Wikidata:

SELECT DISTINCT ?item ?itemLabel ?office ?officeLabel ?officeholder ?officeholderLabel
WHERE { 
  ?item wdt:P31 wd:Q6256 . 
  OPTIONAL { 
    ?item wdt:P1313 ?office . 
    OPTIONAL { ?office wdt:P1308 ?officeholder . } 
  } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?itemLabel

Try it!

tmtmtmtm commented 7 years ago

An acceptable first version of this would report solely on which people have been added/removed, but the fuller version should be able to show the country+office as well.

chrismytton commented 7 years ago

Example of comparing the Wikipedia page with the SPARQL query using daff.