Find all super classes of Wikidata object (recursive)

496 Views Asked by At

I need to write a query that gets all super classes of an object from the Wikidata project. I have already seen a very similiar question (& answer) here, however this query does not show super classes of a super class: finding super classes of an entity in SPARQL

One example where this is not working is the german city "Lübeck", when using this query, it will show super classes, however it won't show the super class "human settlement" (Q486972).

https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fc%20WHERE%20%7B%0A%20%20%3FQ%20wdt%3AP31%2Fwdt%3AP279%3F%20%3Fc%20.%0A%20%20%3FQ%20rdfs%3Alabel%20%22L%C3%BCbeck%22%40de%0A%7D%20

The super class "urban municipality of Germany", is shown, but "human settlement" (which is a super class of "city" which is a super class of "urban municipality of Germany") is not shown.

How could I adjust the query to show ALL super classes?

0

There are 0 best solutions below