当前位置: 首页>>代码示例>>Python>>正文


Python Pump.summarize方法代码示例

本文整理汇总了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
开发者ID:ctsit,项目名称:vivo-pump,代码行数:10,代码来源:test_vivopump.py

示例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)
开发者ID:ctsit,项目名称:vivo-pump,代码行数:18,代码来源:test_vivopump.py

示例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
开发者ID:ctsit,项目名称:vivo-pump,代码行数:5,代码来源:test_vivopump.py

示例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)
开发者ID:ctsit,项目名称:vivo-pump,代码行数:7,代码来源:test_vivopump.py

示例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)
开发者ID:ctsit,项目名称:vivo-pump,代码行数:6,代码来源:test_vivopump.py

示例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)
开发者ID:ctsit,项目名称:vivo-pump,代码行数:64,代码来源:sv.py


注:本文中的pump.pump.Pump.summarize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。