コード例 #1
0
ファイル: test_catalog.py プロジェクト: kvpradap/magellan
def test_set_key_valid():
    df = mg.read_csv_metadata(path_for_A)
    mg.set_key(df, 'ID')
    assert_equal(mg.get_key(df), 'ID')

    mg.del_property(df, 'key')
    assert_equal(len(mg.get_all_properties(df)), 0)
コード例 #2
0
ファイル: test_catalog.py プロジェクト: kvpradap/magellan
def test_del_property_valid():
    df = mg.read_csv_metadata(path_for_A)
    mg.set_key(df, 'ID')
    assert_equal(mg.get_key(df), 'ID')
    mg.del_property(df, 'key')
    assert_equal(mg.is_property_present_for_df(df, 'key'), False)
    mg.del_catalog()
コード例 #3
0
 def setup(self):
     p = mg.get_install_path()
     path_for_A = os.sep.join(
         [p, 'datasets', 'example_datasets', 'bikes', 'A.csv'])
     path_for_B = os.sep.join(
         [p, 'datasets', 'example_datasets', 'bikes', 'B.csv'])
     l_key = 'id'
     r_key = 'id'
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, l_key)
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, r_key)
     l_block_attr_1 = 'city_posted'
     r_block_attr_1 = 'city_posted'
     l_output_attrs = [
         'bike_name', 'city_posted', 'km_driven', 'price', 'color',
         'model_year'
     ]
     r_output_attrs = [
         'bike_name', 'city_posted', 'km_driven', 'price', 'color',
         'model_year'
     ]
     self.ab = mg.AttrEquivalenceBlocker()
     self.C = self.ab.block_tables(self.A,
                                   self.B,
                                   l_block_attr_1,
                                   r_block_attr_1,
                                   l_output_attrs,
                                   r_output_attrs,
                                   verbose=False)
     self.l_block_attr = 'model_year'
     self.r_block_attr = 'model_year'
コード例 #4
0
ファイル: test_catalog.py プロジェクト: kvpradap/magellan
def test_get_catalog_valid():
    df = mg.read_csv_metadata(path_for_A)
    mg.set_key(df, 'ID')
    assert_equal(len(mg.get_all_properties(df)), 1)
    c = mg.get_catalog()
    assert_equal(len(c), 1)
    mg.del_catalog()
コード例 #5
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'electronics', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'electronics', 'B.csv'])
     self.l_block_attr = 'Brand'
     self.r_block_attr = 'Brand'
     self.l_output_attrs = ['Brand', 'Amazon_Price']
     self.r_output_attrs = ['Brand', 'Price']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #6
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'restaurants', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'restaurants', 'B.csv'])
     self.l_block_attr = 'PHONENUMBER'
     self.r_block_attr = 'PHONENUMBER'
     self.l_output_attrs = ['NAME', 'PHONENUMBER', 'ADDRESS']
     self.r_output_attrs = ['NAME', 'PHONENUMBER', 'ADDRESS']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #7
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'anime', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'anime', 'B.csv'])
     self.l_block_attr = 'Year'
     self.r_block_attr = 'Year'
     self.l_output_attrs = ['Title', 'Year', 'Episodes']
     self.r_output_attrs = ['Title', 'Year', 'Episodes']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #8
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'citations', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'citations', 'B.csv'])
     self.l_block_attr = 'year'
     self.r_block_attr = 'year'
     self.l_output_attrs = ['title', 'author', 'year', 'ENTRYTYPE']
     self.r_output_attrs = ['title', 'author', 'year', 'ENTRYTYPE']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #9
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'anime', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'anime', 'B.csv'])
     self.l_block_attr = 'Year'
     self.r_block_attr = 'Year'
     self.l_output_attrs = ['Title', 'Year', 'Episodes']
     self.r_output_attrs = ['Title', 'Year', 'Episodes']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #10
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'electronics', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'electronics', 'B.csv'])
     self.l_block_attr = 'Brand'
     self.r_block_attr = 'Brand'
     self.l_output_attrs = ['Brand', 'Amazon_Price']
     self.r_output_attrs = ['Brand', 'Price']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #11
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'citations', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'citations', 'B.csv'])
     self.l_block_attr = 'year'
     self.r_block_attr = 'year'
     self.l_output_attrs = ['title', 'author', 'year', 'ENTRYTYPE']
     self.r_output_attrs = ['title', 'author', 'year', 'ENTRYTYPE']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #12
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'restaurants', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'restaurants', 'B.csv'])
     self.l_block_attr = 'PHONENUMBER'
     self.r_block_attr = 'PHONENUMBER'
     self.l_output_attrs = ['NAME', 'PHONENUMBER', 'ADDRESS']
     self.r_output_attrs = ['NAME', 'PHONENUMBER', 'ADDRESS']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #13
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'anime', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'anime', 'B.csv'])
     A = mg.read_csv_metadata(path_for_A)
     mg.set_key(A, 'ID')
     B = mg.read_csv_metadata(path_for_B)
     mg.set_key(B, 'ID')
     self.C = ab.block_tables(A, B, 'Year', 'Year',
                              ['Title', 'Year', 'Episodes'],
                              ['Title', 'Year', 'Episodes'])
     self.l_block_attr = 'Episodes'
     self.r_block_attr = 'Episodes'
コード例 #14
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'books', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'books', 'B.csv'])
     A = mg.read_csv_metadata(path_for_A)
     mg.set_key(A, 'ID')
     B = mg.read_csv_metadata(path_for_B)
     mg.set_key(B, 'ID')
     self.C = ab.block_tables(A, B, 'Author', 'Author',
                              ['Title', 'Author', 'ISBN13', 'Publisher'],
                              ['Title', 'Author', 'ISBN13', 'Publisher'])
     self.l_block_attr = 'ISBN13'
     self.r_block_attr = 'ISBN13'
コード例 #15
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'books', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'books', 'B.csv'])
     A = mg.read_csv_metadata(path_for_A)
     mg.set_key(A, 'ID')
     B = mg.read_csv_metadata(path_for_B)
     mg.set_key(B, 'ID')
     self.C = ab.block_tables(A, B, 'Author', 'Author',
                              ['Title', 'Author', 'ISBN13', 'Publisher'],
                              ['Title', 'Author', 'ISBN13', 'Publisher'])
     self.l_block_attr = 'ISBN13'
     self.r_block_attr = 'ISBN13'
コード例 #16
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'anime', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'anime', 'B.csv'])
     A = mg.read_csv_metadata(path_for_A)
     mg.set_key(A, 'ID')
     B = mg.read_csv_metadata(path_for_B)
     mg.set_key(B, 'ID')
     self.C = ab.block_tables(A, B, 'Year', 'Year',
                              ['Title', 'Year', 'Episodes'],
                              ['Title', 'Year', 'Episodes'])
     self.l_block_attr = 'Episodes'
     self.r_block_attr = 'Episodes'
コード例 #17
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'books', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'books', 'B.csv'])
     self.l_block_attr = 'Author'
     self.r_block_attr = 'Author'
     self.l_output_attrs = ['Title', 'Author', 'ISBN13', 'Publisher',
                            'Publication_Date']
     self.r_output_attrs = ['Title', 'Author', 'ISBN13', 'Publisher',
                            'Publication_Date']
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #18
0
 def setup(self):
     path_for_A = os.sep.join([datasets_path, 'books', 'A.csv'])
     path_for_B = os.sep.join([datasets_path, 'books', 'B.csv'])
     self.l_block_attr = 'Author'
     self.r_block_attr = 'Author'
     self.l_output_attrs = [
         'Title', 'Author', 'ISBN13', 'Publisher', 'Publication_Date'
     ]
     self.r_output_attrs = [
         'Title', 'Author', 'ISBN13', 'Publisher', 'Publication_Date'
     ]
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, 'ID')
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, 'ID')
コード例 #19
0
 def setup(self):
     p = mg.get_install_path()
     path_for_A = os.sep.join([p, 'datasets', 'example_datasets', 'bikes', 'A.csv'])
     path_for_B = os.sep.join([p, 'datasets', 'example_datasets', 'bikes', 'B.csv'])
     l_key = 'id'
     r_key = 'id'
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, l_key)
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, r_key)
     self.l_block_attr = 'city_posted'
     self.r_block_attr = 'city_posted'
     self.l_output_attrs = ['bike_name', 'city_posted', 'km_driven', 'price',
                            'color', 'model_year']
     self.r_output_attrs = ['bike_name', 'city_posted', 'km_driven', 'price',
                            'color', 'model_year']
     self.ab = mg.AttrEquivalenceBlocker()
コード例 #20
0
 def setUp(self):
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, l_key)
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, r_key)
     self.ab = mg.AttrEquivalenceBlocker()
コード例 #21
0
 def setUp(self):
     self.A = mg.read_csv_metadata(path_for_A)
     mg.set_key(self.A, l_key)
     self.B = mg.read_csv_metadata(path_for_B)
     mg.set_key(self.B, r_key)
     self.ab = mg.AttrEquivalenceBlocker()
コード例 #22
0
ファイル: test_catalog.py プロジェクト: kvpradap/magellan
def test_set_key_invalid_mv():
    df = mg.read_csv_metadata(path_for_A_dup)
    status = mg.set_key(df, 'ID')
    assert_equal(status, False)
コード例 #23
0
ファイル: test-catalog.py プロジェクト: kvpradap/magellan
#
# mg.set_key(A, 'ID')
#
# # mg.set_metadata(A, 'key', 'ID')
# # print mg.get_metadata(A, 'key')
#
# print mg.get_key(A)
#
# print mg.is_dfinfo_present(B)
# # mg.set_metadata(B, 'key', 'ID')
# # print mg.get_metadata(B, 'key')
# mg.set_key(B, 'ID')
#
# print mg.is_dfinfo_present(B)
# print mg.is_property_present_for_df(B, 'ltable')
#
# print mg.get_catalog_len()
#
# mg.del_property(B, 'key')
# print mg.is_property_present_for_df(B, 'ID')
#
#
# mg.del_all_properties(A)
# print mg.get_catalog_len()


A = mg.read_csv_metadata(path_for_A)
print A
print mg._catalog
mg.set_key(A, 'ID')
print 'xyx'