我正在使用以下代码向本体添加注释
from owlready import *
onto = get_ontology("C://Users//sharm//Documents//ISWC2020//Ontology_read_play//Covid_v1.owl")
ANNOTATIONS[Thing].add_annotation("comment", "My comment")
onto.save()
然后它显示一个IndexError
,当我使用 on.save() 保存它时
IndexError Traceback (most recent call last)<module>
--> onto.save()
C:\ProgramData\Anaconda3\lib\site-packages\owlready\__init__.py in save(self, filename)
282 owl = to_owl(self)
283 if filename: f = open(filename, "w")
--> 284 else: f = _open_onto_file(self.base_iri, self.name, "w")
285 print("* Owlready * Saving ontology %s to %s..." % (self.name, getattr(f, "name", "???")), file = sys.stderr)
286 f.write(owl)
C:\ProgramData\Anaconda3\lib\site-packages\owlready\__init__.py in _open_onto_file(base_iri, name, mode, only_local)
199 if os.path.exists(filename): return open(filename, mode)
200 if (mode == "r") and not only_local: return urllib.request.urlopen(base_iri)
--> 201 if (mode == "w"): return open(os.path.join(onto_path[0], "%s.owl" % name), "w")
202 raise FileNotFoundError
203
IndexError: list index out of range