Skip to content

Instantly share code, notes, and snippets.

@hornc
Created August 2, 2017 06:45
Show Gist options
  • Save hornc/ff36639c02ee002cdbe2a34de8558e26 to your computer and use it in GitHub Desktop.
Save hornc/ff36639c02ee002cdbe2a34de8558e26 to your computer and use it in GitHub Desktop.
Duplicate OLIDs on Wikidata
#People with more than one OLID
#https://query.wikidata.org/#%23People%20with%20more%20than%20one%20OLID%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fcount%0AWHERE%0A%7B%0A%20%20%7B%0A%20%20%20%20SELECT%20%3Fitem%20%28COUNT%28DISTINCT%20%3Folid%29%20AS%20%3Fcount%29%20WHERE%20%7B%0A%20%20%20%20%20%20%3Fitem%20wdt%3AP31%20wd%3AQ5%20.%0A%20%20%20%20%20%20%3Fitem%20wdt%3AP648%20%3Folid%20.%0A%0A%20%20%20%20%7D%0A%20%20%20%20GROUP%20BY%20%3Fitem%0A%20%20%7D%0A%20%20FILTER%20%28%20%3Fcount%20%3E%201%20%29%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fcount%29%20%3FitemL
SELECT ?item ?itemLabel ?count
WHERE
{
{
SELECT ?item (COUNT(DISTINCT ?olid) AS ?count) WHERE {
?item wdt:P31 wd:Q5 .
?item wdt:P648 ?olid .
}
GROUP BY ?item
}
FILTER ( ?count > 1 )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY DESC(?count) ?itemL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment