Skip to content

Instantly share code, notes, and snippets.

@napsternxg
Created July 14, 2020 05:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save napsternxg/e70326e6b11aec41b6c6e5e11278e051 to your computer and use it in GitHub Desktop.
Save napsternxg/e70326e6b11aec41b6c6e5e11278e051 to your computer and use it in GitHub Desktop.
Wikidata get all subclasses of a given class
SELECT ?subClass ?subClassLabel ?desc WHERE {
?subClass wdt:P279* wd:Q5. # Here we are getting all subClasses of Human and its subclasses
OPTIONAL {
?subClass rdfs:label ?desc.
FILTER((LANG(?desc)) = "en")
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment