I want to get the class which an individual belongs to. In more detail, I want to pass a parameter to a method which is an individual using python (using rdflib), method should return class of an individual which it belongs to.
For example: I have a AlcoholicBeverage class, it has subclass Beer and Beer class has a subclass Brands. In Brands class there are many individuals which represents beer brands. I want to pass a parameter to a method, run SPARQL query to find, xyz is an individual of Brands class.
Ideally I also want to get, xyz is a Beer (because Brands class is subclass of Beer) and Beer is a AlcoholicBeverage.
Thanks for your help.