How to access the classes and existential restrictions inside a General Class Axiom
I am trying to create a function to normalize ontologies so only certain constructions of General Class Axioms are accepted (e.g. A1 & A2 is_a B1, where A1, A2 and B1 are simple classes is a GCA in normal form). In order to do this, I want to iterate over the left and right sides of a GCA, but 'GeneralClassAxiom' objects are not iterable in Owlready. Is there anyway to circumvent this that doesn't involve changing the type of the object (to a string, for example, and doing some regex magic to achieve what I want)? Thank you!
Re: How to access the classes and existential restrictions inside a General Class Axiom
The right side of the GCA is gca.is_a, and can be iterated. You can iterate over gca.is_a, and verify that all parent classes are instances of ThingClass (to ensure they are plain OWL named classes, and not constructs).
GCA have a single left side, so you don't need to iterate over it. You can access as gca.left_side.
Then you can check that gca.left_side is an instance of ThingClass (= a named class) or an instance of And (= an interaction), and if so, that all the members of the intersection are instances of ThingClass (use gca.left_side.Classes to access the members of the intersection).