Adding classes using for loop

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

Adding classes using for loop

Ruch
Is there a way to add classes whose names are in a list using for loop?  How can I make the ThingClass iterable?
Reply | Threaded
Open this post in threaded view
|

Re: Adding classes using for loop

Jiba
Administrator
Hello,

> Is there a way to add classes whose names are in a list using for loop?  How

I think you need to create classes dynamically, as explained here in the doc:

        http://owlready2.readthedocs.io/en/latest/class.html#creating-classes-dynamically


> can I make the ThingClass iterable?

No, ThingClass is defined by OwlReady2 and you cannot modify it. If you want to iterate over classes, use your_ontology.classes()

Best regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13