'NoneType' object is not callable

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

'NoneType' object is not callable

Ina
Hello,

I'm trying to create an ontology with Owlready2, create the classes and then some individuals.
The ontology and the classes are created but once I try to create the instances I get an error:
'NoneType' object is not callable

Here is my code:
 onto  = get_ontology("onto.owl")
 class User(Thing):
    namespace = onto  
 class Element(Thing):
    namespace = onto
 onto.save()
 onto  = get_ontology("onto.owl")
 onto.load()
 user1 =  onto.User('user1')
 element =  onto.Element('element')
 onto.save()

Thank you in advance for your help.
Reply | Threaded
Open this post in threaded view
|

Re: 'NoneType' object is not callable

Jiba
Administrator
Hi,

The problem is related to the IRI of your ontology. You need to pass either a full IRI (for example http://server.com/onto.owl) to get_ontology() when you want to create a new ontology. Passing a filename is only allowed when loading an ontology.

For example you can use:

  onto  = get_ontology("http://test.org/onto.owl")

Jiba
Ina
Reply | Threaded
Open this post in threaded view
|

Re: 'NoneType' object is not callable

Ina
Dear Jiba,

that works well, thank you.

Ina