我正在使用owlready2,加载了本体,并尝试删除一个类的个体:
from owlready2 import *
onto = get_ontology("file://C:/Users/stef/Desktop/my_onto.owl").load()
country_list=onto.search(type=onto.Country)
len(country_list) ----> Out[27]: 219
for indiv in country_list :
destroy_entity(indiv)
onto.search(type=onto.Country)-----> Out[29]: []
onto.save
在我看来,Country类中的个体被删除了。[[但是当我用protégé打开本体时,我发现了个体有人告诉我我想念的东西!
onto.save
通过此:
onto.save(file = "file://C:/Users/stef/Desktop/my_onto.owl")