如果我更改base_iri
本体的属性,则此更改在保存到文件后会丢失。如何更改 base_iri 以使此更改是永久性的?
自包含示例:
import owlready2 as owr
# create ontology in the default_world
onto = owr.get_ontology("https://w3id.org/old/onto#")
with onto:
class Node(owr.Thing):
pass
fname = "tmp.owl.xml"
new_iri = "https://foo.bar/onto#"
onto.base_iri = new_iri
print(onto.base_iri)
onto.save(fname)
w = owr.World()
onto2 = w.get_ontology(fname).load()
print(onto2.base_iri)
这输出
https://foo.bar/onto#
https://w3id.org/old/onto#
但我想要输出
https://foo.bar/onto#
https://foo.bar/onto#