Bug in 'destroy_entity' ?

classic Classic list List threaded Threaded
3 messages Options
Fla
Reply | Threaded
Open this post in threaded view
|

Bug in 'destroy_entity' ?

Fla
Hi All,

I'm trying something very simple :

1) Loading onto + loading SWRL rules + launching sync_reasoner_pellet()
2) catches some inferences
3) Trying to delete rules with this simple code :

# --- Destroy rules
for rule in my_onto.rules():
    print("Delete rule %s"%(rule))
    owl2.destroy_entity(rule)

Delete rule hasSameAge(?u11, ?u21), isBelow(?u11, ?u12), hasNotSameAge(?u12, ?u22), hasNamedAge(?u12, ?a1), hasNamedAge(?u22, ?a2), upperThan(?a1, ?a2), isComponentOf(?u11, ?b) -> RevealsUnconformitySince(?b, ?a1)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-19-aa4f1be105d8> in <module>
      3     if debug ==True:
      4         print("Delete rule %s"%(rule))
----> 5     owl2.destroy_entity(rule)

~/anaconda3/envs/XXXL/lib/python3.7/site-packages/owlready2/prop.py in destroy_entity(e, undoable)
    909             except: pass
    910
--> 911   e.namespace.world.graph.destroy_entity(e.storid, destroyer, relation_updater, undoer_objs, undoer_datas)
    912
    913   e.namespace.world._entities.pop(e.storid, None)

~/anaconda3/envs/XXX/lib/python3.7/site-packages/owlready2/triplelite.py in destroy_entity(self, storid, destroyer, relation_updater, undoer_objs, undoer_datas)
    908     self.execute("DELETE FROM resources WHERE storid=?", (storid,))
    909     if self._abbreviate_d:
--> 910       del self._abbreviate_d  [self._unabbreviate_d[storid]]
    911       del self._unabbreviate_d[storid]
    912

KeyError: -297



===> Where am i wrong ? Any idea ?
Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Bug in 'destroy_entity' ?

Jiba
Administrator
Hi,

There was a bug in destroy_entity() when destroying rules. I fixed it in the development version, and I will make a new release today.

Jiba
Fla
Reply | Threaded
Open this post in threaded view
|

Re: Bug in 'destroy_entity' ?

Fla
Hi
It works fine with the new release, thank you Jiba!!