'python_name' property is not defined.

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

'python_name' property is not defined.

Fay
Dear Friends, could anyone help me please.!

I import an ontology:

class ont_Service(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(ont_Service, self).__init__()
        self.setupUi(self)
        self.ontShow.clicked.connect(self.classTree)


    def classTree(self):

        file = QFileDialog.getOpenFileName(self, "打开", "C:/", "Text Files (*.owl)")
        filepath = file[0]
        ontpath = "file://" + filepath
        ont = get_ontology(ontpath).load()

**** I want to show the classes in a window.

Traceback (most recent call last):
  File "F:/OntServiceSystem/main_interface.py", line 64, in classTree
    ont = get_ontology(ontpath).load()
  File "D:\Program Files (x86)\Anaconda3\lib\site-packages\owlready2\namespace.py", line 808, in load
    if self.world.graph.indexed: self._load_properties()
  File "D:\Program Files (x86)\Anaconda3\lib\site-packages\owlready2\namespace.py", line 834, in _load_properties
    props.append(Prop.python_name)
  File "D:\Program Files (x86)\Anaconda3\lib\site-packages\owlready2\entity.py", line 556, in __getattr__
    if not Prop: raise AttributeError("'%s' property is not defined." % attr)
AttributeError: 'python_name' property is not defined.
Reply | Threaded
Open this post in threaded view
|

Re: 'python_name' property is not defined.

Jiba
Administrator
Hello,

python_name is normally defined in prop.py, but the error you get occurs in entity.py, which is very surprising for me.

Could you send me your ontology by email (at: jiba /at/ lesfleursdunormal.fr ) so I can analyze the problem further? I suspect your property is not entirely recognized as a property.

Jiba