|
Hello,
I like to destroy/delete a created individual via the destroy_entity() function.
It looks like destroy_entity() deletes/destroys the entity not completely in the quadstore.
For example I create an individual via individualA = onto.ClassA(), then I destroy it via owlready2.destroy_entity(individualA). Using onto.classes() shows that the individual (individualA with the name classa1) is deleted. If I now create again an individual via individualA = onto.ClassA() an individual with the name "classa2" is created. I expect that the name is classa1 not classa2, cause I destroyed classa1 in the previous step. Trying to rename the individualA via individualA.name = "classa1" leads to the following error message:
ERROR - log - write : Traceback (most recent call last):
ERROR - log - write : File "PATH/playground.py", line 12, in <module> ERROR - log - write : individualA.name = 'classa1'
ERROR - log - write : File "PATH\Python37\lib\site-packages\owlready2\individual.py", line 254, in __setattr__
ERROR - log - write : else: super().__setattr__(attr, value)
ERROR - log - write : File "PATH\Python37\lib\site-packages\owlready2\individual.py", line 57, in set_name
ERROR - log - write : self.namespace.world._refactor(self.storid, "%s%s" % (self.namespace.base_iri, name))
ERROR - log - write : File "PATH\Python37\lib\site-packages\owlready2\triplelite.py", line 515, in _refactor_dict
ERROR - log - write : self.execute("UPDATE resources SET iri=? WHERE storid=?", (new_iri, storid,))
ERROR - log - write : sqlite3
ERROR - log - write : .
ERROR - log - write : IntegrityError
ERROR - log - write : :
ERROR - log - write : UNIQUE constraint failed: resources.iri
Code:
individualA = onto.ClassA()
owlready2.destroy_entity(individualA)
list(onto.classes())
individualA = onto.ClassA()
individualA.name = "classa1"
Is my assumption correct that destroy_entity should delete the entity in python as well as in the quadstore?
Is there a different way to delete/destroy an entity in the quadstore? I am not familiar with databases/SQLite.
Thanks for your support
GoMa
|