本文整理汇总了Python中Session.Session.commit方法的典型用法代码示例。如果您正苦于以下问题:Python Session.commit方法的具体用法?Python Session.commit怎么用?Python Session.commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session.Session
的用法示例。
在下文中一共展示了Session.commit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: breaks
# 需要导入模块: from Session import Session [as 别名]
# 或者: from Session.Session import commit [as 别名]
# Execute each sparql rule over until the number of new objects
# doesn't change. Once the total of objects stabilises, then the
# loop breaks (as rules can inference each other).
#
while currentObjs - initialObjs > 0:
initialObjs = currentObjs
for queryObj in orderOfService:
# if config print rule executuon
if Config.DEBUG > 0:
print "Executing query: " + queryObj[0]
res = rdf_session.sparql_query(queryObj[1], False)
# if config, print result
if Config.DEBUG > 0:
print ">>" + str(res)
if res:
for sub, pred, obj in res:
# add assertion
rdf_session.add_assertion([sub, pred, obj], queryObj[4], True)
# commit assertion
rdf_session.commit()
resList = []
currentObjs = rdf_session.store_sizes()[0]
rdf_session.commit()
currentObjs = rdf_session.store_sizes()[0]
# check sizes - how many new assertions
if Config.DEBUG > 0:
print str(initialObjs)
print str(currentObjs)