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

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

This is an issue with the namespaces. Note how the pizza ontology's entities do not include the URL you load the ontology from - for example, it is
"http://www.co-ode.org/ontologies/pizza/pizza.owl#Veneziana"
instead of
"https://protege.stanford.edu/ontologies/pizza/pizza.owl#Veneziana"
This means you have to specify the correct namespace via the "get_namespace" method, see also the documentation
In your case, the following should work:

from owlready2 import *

onto = get_ontology("https://protege.stanford.edu/ontologies/pizza/pizza.owl").load()
pizza = get_namespace("http://www.co-ode.org/ontologies/pizza/pizza.owl#")

print(list(onto.classes()))
print(pizza.Veneziana)
with onto:
    test_pizza = pizza.Veneziana("example_id")
print(onto.example_id)