Checking Type of passed object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Checking Type of passed object

jlvet
Hi!

This might be an easy thing to do, but I cannot figure it out.  I have a function that I want to make dynamic for creating individuals.  The issue is, I do not know how to check the type of the object being passed (the string type is easy).  

The function pseudocode is below:

generate_base_individual(self,iri:str ,fullySpecifiedName:str ,parent_class):
     parent_of_ind = None
     if isinstance(parent_class,str):
         find the class in ontology and set to parent_of_ind
     elif isinstance(parent_class,???):
         parent_of_ind = parent_class
     new_ind = parent_of_ind(iri,namespace=....)

My challenge is, what should be in the ???.  This could easily be passed from another function or entity, and I wanted to make sure that I tested the right object type.

Any help would be really greatly appreciated!
Thanks!
Jon

Reply | Threaded
Open this post in threaded view
|

Re: Checking Type of passed object

Jiba
Administrator
Hi,

The class for OWL classes is ThingClass.

Jiba