Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created February 15, 2023 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommorris/2df994f52f04a023fe329d5a445e350c to your computer and use it in GitHub Desktop.
Save tommorris/2df994f52f04a023fe329d5a445e350c to your computer and use it in GitHub Desktop.
wikidata query for follows/followed by mistakes
# finds all things that have a "follows" or "followed by" relationship, where the thing it follows is a year.
# these exist because parsers pulled next/prev links from wikipedia and decided to infer the thing it follows is a year.
# action: check and remove
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?a ?aLabel ?aType ?aTypeLabel ?b ?bLabel
WHERE
{
?a wdt:P31 ?aType .
{ ?a wdt:P155 ?b . } UNION { ?a wdt:P156 ?b . }
?b wdt:P31 wd:Q3186692 .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
MINUS {
{ ?a wdt:P31 wd:Q3186692. } UNION { ?a wdt:P31 wd:Q577 . }
}
}
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment