How can I get all the genders of my individuals?

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

How can I get all the genders of my individuals?

Erickaan
Good evening, I have some data property of my individuals which have a gender, as to obtain all the genders of my individuals and see how many are female and male.

for i in list(onto.individuals())

for prop in onto.Esperanza.get_properties():
    for value in prop[onto.Esperanza]:
        print(".%s == %s" % (prop.python_name, value))

I understand that with this I obtain all the individuals and with the following I have the properties of a particular individual. I can't think of how to get all the genders of all the individuals.

thanks for taking the time to read.


Reply | Threaded
Open this post in threaded view
|

Re: How can I get all the genders of my individuals?

Erickaan
I managed to find the solution, below the code in case someone else has the same restlessness.


for i in onto.Usuario.instances():
    for prop in i.get_properties():
        for value in prop[i]:
             if prop.python_name == ""Here the property would go to look for all the individuals to have":