kloud
kloud

Reputation: 321

Delete individuals with owlready2


I am using owlready2 I load my ontology and I tried to delete the individuals of a class :

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

it seems to me that the individuals in the class Country are deleted But when I open the ontology with protégé I found the individuals
someone tell me what I am missing !

Upvotes: 3

Views: 1052

Answers (1)

kloud
kloud

Reputation: 321

I have fixed this issue by replacing this line

onto.save

by this :

onto.save(file = "file://C:/Users/stef/Desktop/my_onto.owl")

Upvotes: 1

Related Questions