calling onto.object_properties giving error

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

calling onto.object_properties giving error

Pradip
The code:
from owlready import *
print("\n\n")
onto = get_ontology("file:///home/pradip/Desktop/demo.owl").load()
print(onto.object_properties())

Error:

* Owlready * Creating new ontology owl <http://www.w3.org/2002/07/owl>.
* Owlready * Creating new ontology 22-rdf-syntax-ns <http://www.w3.org/1999/02/22-rdf-syntax-ns>.
* Owlready * Creating new ontology rdf-schema <http://www.w3.org/2000/01/rdf-schema>.
* Owlready * Creating new ontology XMLSchema <http://www.w3.org/2001/XMLSchema>.
* Owlready * Creating new ontology anonymous <http://anonymous>.
* Owlready * Creating new ontology owlready_ontology <http://www.lesfleursdunormal.fr/static/_downloads/owlready_ontology.owl>.
* Owlready *     ...loading ontology owlready_ontology from /usr/local/lib/python3.4/dist-packages/owlready/owlready_ontology.owl...
* Owlready * Creating new ontology demo <file:///home/pradip/Desktop/demo.owl>.
* Owlready *     ...loading ontology demo from /home/pradip/Desktop/demo.owl...

Traceback (most recent call last):
  File "/home/pradip/Desktop/owlquery.py", line 6, in <module>
    print(onto.object_properties())
  File "/usr/local/lib/python3.4/dist-packages/owlready/__init__.py", line 325, in __getattr__
    raise AttributeError("Ontology '%s' has not object '%s'!" % (self, attr))
AttributeError: Ontology 'demo' has not object 'object_properties'!
Reply | Threaded
Open this post in threaded view
|

Re: calling onto.object_properties giving error

Jiba
Administrator
Hello,

Are you using Owlready version 1 or 2? The import in your example corresponds to version 1, which is no longer maintained. However, onto.object_properties corresponds to version 2.

Best regards,

Jiba