如何修复在 owlready2 中加载本体的错误

问题描述

我正在尝试加载本体,但出现错误,您可以在帖子中看到,代码如下所示。

代码

from owlready2 import * 
import os
onto = get_ontology("file://C:/Users/achev/Documents/Carro.owl") 
onto.load() 
n_classes = len(list(onto.classes()))
print(n_classes)

错误

File "c:/Users/achev/Desktop/Proyecto de grado/Python/prueba.py",line 4,in <module>
    onto = get_ontology("file://C:/Users/achev/Documents/Carro.owl").load()
  File "C:\ProgramData\Anaconda3\lib\site-packages\owlready2\namespace.py",line 810,in load
    if self.world.graph.indexed: self._load_properties()
  File "C:\ProgramData\Anaconda3\lib\site-packages\owlready2\namespace.py",line 849,in _load_properties
    raise TypeError("'%s' belongs to more than one entity types (cannot be both a property and a class/an individual)!" % Prop.iri)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)