In Wikidata, entities can have subclass of statements linking them to other entities. This creates a class polyhierarchy, a.k.a. an ontology.
The top-level class in Wikidata's class hierarchy is entity (superclass of all classes).
You can reconstruct the ontology of Wikidata by following the subclass of statements, starting from the entity class, as shown below.
Made by Anton Vasetenkov.
If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.