Administrator
|
Hello,
The rollback is currently not supported. You can rollback the database, and it cancels the changes, however Owlready maintain cached values at many level (property values but also individual's classes, etc). A rollback operation would require to undo all changes in the cached values, too.
However, if you are only interested in individual property values, you can clear the cached value with del :
onto = get_ontology("pizza.owl").load()
test_pizza = onto.Pizza("test_pizza_owl_identifier")
test_pizza.has_topping = []
commit()
test_pizza.has_topping = [ onto.CheeseTopping(), onto.TomatoTopping() ]
rollback()
print(test_pizza.has_topping) # => [cheese1, tomato1] : cached values
del test_pizza.has_topping # clear cache
print(test_pizza.has_topping) # => []
Hope this help,
Jiba
|