我目前浏览了Redland的Python绑定,还没有找到一种通过它在存储引擎上执行事务的干净方法。我在低层Redland模块中发现了一些模型事务:
import RDF, Redland
storage = RDF.Storage(...)
model = RDF.Model(storage)
Redland.librdf_model_transaction_start(model._model)
try:
# Do something
Redland.librdf_model_transaction_commit(model._model)
model.sync()
except:
Redland.librdf_model_transaction_rollback(model._model)
这些也会转化到存储层吗?在
谢谢:-)
是的,这应该行得通。目前在python包装器中没有模型类的方便函数,但它们与您编写的类似:
相关问题 更多 >
编程相关推荐