本文整理汇总了Python中pump.pump.Pump.rdfprefix方法的典型用法代码示例。如果您正苦于以下问题:Python Pump.rdfprefix方法的具体用法?Python Pump.rdfprefix怎么用?Python Pump.rdfprefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pump.pump.Pump
的用法示例。
在下文中一共展示了Pump.rdfprefix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import rdfprefix [as 别名]
def main():
"""
The main function. Does the work of Simple VIVO
:return: None
"""
return_code = 0
print datetime.now(), "Start"
args = get_args()
# Create a Pump and use it to perform the requested actions based on arguments
try:
p = Pump(args.defn, args.src)
except DefNotFoundException:
print args.defn, "definition file not found"
sys.exit(1)
except InvalidDefException as invalid:
print "Invalid definition file", args.defn, "\n", invalid
sys.exit(1)
p.filter = not args.nofilters
p.inter = args.inter
p.intra = args.intra
p.rdfprefix = args.rdfprefix
p.uriprefix = args.uriprefix
p.queryuri = args.queryuri
p.username = args.username
p.password = args.password
p.prefix = args.prefix
if args.action == 'get':
n_rows = p.get()
print datetime.now(), n_rows, "rows in", args.src
elif args.action == 'update':
try:
[add_graph, sub_graph] = p.update()
except IOError:
print args.src, "file not found"
return_code = 1
else:
add_file = open(args.rdfprefix + '_add.rdf', 'w')
print >>add_file, add_graph.serialize(format='nt')
add_file.close()
sub_file = open(args.rdfprefix + '_sub.rdf', 'w')
print >>sub_file, sub_graph.serialize(format='nt')
sub_file.close()
make_inverse_subs(args.rdfprefix + '_sub.rdf', p.query_parms)
print datetime.now(), len(add_graph), 'triples to add', len(sub_graph), 'triples to sub'
elif args.action == 'summarize':
print p.summarize()
elif args.action == 'serialize':
print p.serialize()
elif args.action == 'test':
test_result = p.test()
print test_result
if 'Check' in test_result:
return_code = 1
else:
print datetime.now(), "Unknown action. Try sv -h for help"
print datetime.now(), "Finish"
sys.exit(return_code)