本文整理汇总了Python中pump.pump.Pump.summarize方法的典型用法代码示例。如果您正苦于以下问题:Python Pump.summarize方法的具体用法?Python Pump.summarize怎么用?Python Pump.summarize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pump.pump.Pump
的用法示例。
在下文中一共展示了Pump.summarize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_summarize
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [as 别名]
def test_summarize(self):
from testgraph import TestGraph
p = Pump("data/person_def.json")
p.original_graph = TestGraph()
print p.update_def
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n1723097935',
u'any1': u'1'}}
print p.summarize() # No exception thrown by summarize
示例2: test_normal_closure
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [as 别名]
def test_normal_closure(self):
from testgraph import TestGraph
from rdflib import URIRef
p = Pump("data/teaching_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'',
u'instructor': 'http://orcid.org/0000-0002-1305-8447',
u'course': 'Introduction to Statistics',
u'start_date': '2012',
u'end_date': u'2013'}}
print p.summarize()
[add, sub] = p.update()
self.assertTrue(len(add) == 8 and len(sub) == 0 and
(URIRef("http://vivo.school.edu/individual/n25674"),
URIRef("http://purl.obolibrary.org/obo/BFO_0000056"),
URIRef("http://vivo.school.edu/individual/n7501")) in add)
示例3: test_default_usage
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [as 别名]
def test_default_usage(self):
p = Pump()
self.assertTrue("pump_def.json" in p.summarize()) # Using the default definition
示例4: test_pump_summarize
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [as 别名]
def test_pump_summarize(self):
p = Pump("data/building_def.json")
result = p.summarize()
print result
self.assertTrue("Pump Summary for data/building" in result)
示例5: test_normal_case
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [as 别名]
def test_normal_case(self):
p = Pump("data/person_def.json")
summary = p.summarize()
self.assertTrue(summary.find('people_types') > -1)
示例6: main
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import summarize [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)