本文整理汇总了Python中pump.pump.Pump类的典型用法代码示例。如果您正苦于以下问题:Python Pump类的具体用法?Python Pump怎么用?Python Pump使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pump类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pump_get_default_filename
def test_pump_get_default_filename(self):
import os
p = Pump("data/building_def.json")
filename = p.out_filename
p.get()
self.assertTrue(os.path.isfile(filename))
os.remove(filename)
示例2: test_large_case
def test_large_case(self):
from testgraph import TestGraph
p = Pump("data/person_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n25674',
u'action': u'REMOVE'}}
[add, sub] = p.update()
self.assertTrue(len(add) == 0 and len(sub) == 8)
示例3: test_not_found
def test_not_found(self):
from rdflib import Graph
p = Pump("data/person_def.json")
p.original_graph = Graph() # empty graph
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n12345678',
u'action': u'Remove'}}
[add, sub] = p.update()
self.assertTrue(len(add) == 0 and len(sub) == 0)
示例4: test_summarize
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
示例5: test_single_uri_case
def test_single_uri_case(self):
from testgraph import TestGraph
p = Pump("data/person_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n2084211328',
u'action': u'Remove'}}
[add, sub] = p.update()
self.assertTrue(len(add) == 0 and len(sub) == 1)
示例6: test_add_one_new_to_two
def test_add_one_new_to_two(self):
from testgraph import TestGraph
p = Pump("data/grant_pi_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n45',
u'pis': u'http://vivo.school.edu/individual/n1134'}}
[add, sub] = p.update()
self.assertTrue(
len(add) == 3 and len(sub) == 6)
示例7: test_none_to_empty
def test_none_to_empty(self):
from testgraph import TestGraph
p = Pump("data/grant_pi_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n44',
u'pis': u'None'}}
[add, sub] = p.update()
self.assertTrue(
len(add) == 0 and len(sub) == 0)
示例8: test_inject_empty_original_graph
def test_inject_empty_original_graph(self):
from rdflib import Graph, URIRef
p = Pump()
p.original_graph = Graph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n8984374104', u'abbreviation': u'None'}}
[add, sub] = p.update()
self.assertTrue(
len(add) == 1 and len(sub) == 0 and (None,
URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
URIRef("http://vivoweb.org/ontology/core#Building")) in add)
示例9: test_boolean_get
def test_boolean_get(self):
from pump.vivopump import read_csv
p = Pump("data/faculty_boolean_def.json")
p.get()
data = read_csv('pump_data.txt', delimiter='\t')
nfac = 0
for row, vals in data.items():
if vals['faculty'] == '1':
nfac += 1
self.assertEqual(5, nfac)
示例10: test_no_secondary_merge
def test_no_secondary_merge(self):
from testgraph import TestGraph
p = Pump("data/person_def.json")
p.original_graph = TestGraph()
p.update_data = {3: {u'uri': u'http://vivo.school.edu/individual/n710', u'action': u''},
4: {u'uri': u'http://vivo.school.edu/individual/n1723097935', u'action': u'a'},
7: {u'uri': u'http://vivo.school.edu/individual/n711', u'action': u'a'},
}
[add, sub] = p.update()
self.assertTrue(len(add) == 0 and len(sub) == 0)
示例11: test_unique_three_delete_not_found
def test_unique_three_delete_not_found(self):
from testgraph import TestGraph
# Delete the zip code from an existing address that doesn't have a zip code.
p = Pump("data/org_def.json")
p.original_graph = TestGraph()
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n3535', u'zip': u'None'}}
[add, sub] = p.update()
self.assertTrue(len(add) == 0 and len(sub) == 0)
示例12: test_add_without_datatype
def test_add_without_datatype(self):
from rdflib import URIRef, Literal
from testgraph import TestGraph
p = Pump("data/building_def.json")
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n1001011525', u'url': u'http://a'}}
p.original_graph = TestGraph()
[add, sub] = p.update()
self.assertTrue(
len(add) == 4 and len(sub) == 0 and (None,
URIRef("http://vivoweb.org/ontology/core#linkURI"),
Literal("http://a")) in add)
示例13: test_change_with_datatype
def test_change_with_datatype(self):
from rdflib import URIRef, Literal, XSD
from testgraph import TestGraph
p = Pump("data/building_def.json")
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n1001011525', u'abbreviation': u'PH9'}}
p.original_graph = TestGraph()
[add, sub] = p.update()
self.assertTrue(
len(add) == 1 and len(sub) == 1 and (URIRef("http://vivo.school.edu/individual/n1001011525"),
URIRef("http://vivoweb.org/ontology/core#abbreviation"),
Literal("PH9", datatype=XSD.string)) in add)
示例14: test_delete_unicode
def test_delete_unicode(self):
from rdflib import URIRef, Literal
from testgraph import TestGraph
p = Pump("data/person_def.json")
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n711', u'name': u'None'}}
p.original_graph = TestGraph()
[add, sub] = p.update()
self.assertTrue(
len(add) == 0 and len(sub) == 1 and (URIRef("http://vivo.school.edu/individual/n711"),
URIRef("http://www.w3.org/2000/01/rdf-schema#label"),
Literal("Ελληνικά")) in sub)
示例15: test_change_without_lang
def test_change_without_lang(self):
from rdflib import URIRef, Literal
from testgraph import TestGraph
p = Pump("data/org_def.json")
p.update_data = {1: {u'uri': u'http://vivo.school.edu/individual/n2525', u'name': u'Ad ver tising'}}
p.original_graph = TestGraph()
[add, sub] = p.update()
self.assertTrue(
len(add) == 1 and len(sub) == 1 and (URIRef("http://vivo.school.edu/individual/n2525"),
URIRef("http://www.w3.org/2000/01/rdf-schema#label"),
Literal("Ad ver tising")) in add)