예제 #1
0
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
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()
 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
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()
 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')
 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')
 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')
 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')
 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')
 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')
 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')
 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')
 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'
 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'
 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'
 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'
 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')
 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')
 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
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
#
# 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'