Strange behaviour with pizza ontology: 'NoneType' object is not callable

Posted by eliskav on
URL: http://owlready.306.s1.nabble.com/Strange-behaviour-with-pizza-ontology-NoneType-object-is-not-callable-tp2688.html

We've been having some strange issues trying to instantiate classes from the Pizza ontology (from protege's website, url below in code). It seems to work when instantiated inside the onto.classes() for loop, so it should be loaded correctly, but fails outside of it with TypeError: 'NoneType' object is not callable error. This exception does not seem to occur when we try the same thing with other ontologies, at least what we've found so far (both the example bacteria ontology and our work ontology work just fine with directly using onto.<class_name>()).

    onto = get_ontology("https://protege.stanford.edu/ontologies/pizza/pizza.owl")
    onto.load()
    for onto_class in onto.classes():
        print(onto_class)
        individual = onto_class()
        print(individual)

        # acts as expected to this point

    # out of the loop, starts acting strange
    print(f"`onto.Veneziana` returns: {onto.Veneziana}")
    test_pizza = onto.Veneziana("example_id")
    # Error: TypeError: 'NoneType' object is not callable

Am I missing something? Are we calling the class wrong, or is something wrong with the ontology itself?