def xdr_compressed(): cidxposchema = os.path.join(TEST_SCHEMA_PATH, 'CIDXPOSCHEMA.xdr') apertum = os.path.join(TEST_SCHEMA_PATH, 'Apertum.xdr') G1 = compress_graph( xdr_parser.schema_tree2Graph(xdr_parser.parse_xdr(cidxposchema))) G2 = compress_graph( xdr_parser.schema_tree2Graph(xdr_parser.parse_xdr(apertum))) print( 'Example of run with CIDXPOSCHEMA.xdr + Apertum.xdr, compressed and fixpoint_incremental' ) print('Printing first schema: ') s1 = utils.schema_graph_print(G1) input('Press any key to continue...') print('Printing second schema: ') s2 = utils.schema_graph_print(G2) input('Press any key to continue...') sf = ipg.SFGraphs(G1, G2) print('Executing similarity flooding algorithm:') ipg.similarity_flooding(sf, max_steps=500, verbose=False, fixpoint_formula=ipg.fixpoint_incremental, tqdm=True) print('Executing filter algorithm') pairs = f.select_filter(sf) print('Printing results of filter selection: ') f.print_pairs(pairs)
def test_on_xdr(formula, outfile=sys.stdout): import similarityflooding.parse.xdr_parser as xdr_parser G1 = xdr_parser.schema_tree2Graph( xdr_parser.parse_xdr('test_schemas/CIDXPOSCHEMA.xdr')) G2 = xdr_parser.schema_tree2Graph( xdr_parser.parse_xdr('test_schemas/Apertum.xdr')) sf = gen_sf(G1, G2, formula=formula) pairs = f.select_filter(sf) f.print_pairs(utils.combine_oid_to_name_pairs(G1, G2, pairs), outfile)
def test_on_sql_uncompressed(formula, outfile=sys.stdout): import similarityflooding.parse.sql_parser as sql_parser G1 = sql_parser.sql_ddl2Graph( sql_parser.parse_sql('test_schemas/test_schema_from_paper1.sql')) G2 = sql_parser.sql_ddl2Graph( sql_parser.parse_sql('test_schemas/test_schema_from_paper2.sql')) sf = gen_sf(G1, G2, formula=formula) pairs = f.select_filter(sf) f.print_pairs(utils.combine_oid_to_name_pairs(G1, G2, pairs), outfile)
def test_on_xdr_compressed(formula, outfile=sys.stdout): import similarityflooding.parse.xdr_parser as xdr_parser G1 = compress_graph( xdr_parser.schema_tree2Graph( xdr_parser.parse_xdr('test_schemas/CIDXPOSCHEMA.xdr'))) G2 = compress_graph( xdr_parser.schema_tree2Graph( xdr_parser.parse_xdr('test_schemas/Apertum.xdr'))) sf = gen_sf(G1, G2, formula=formula) pairs = f.select_filter(sf) f.print_pairs(pairs, outfile)
def test_on_sql_compressed(formula, outfile): import similarityflooding.parse.sql_parser as sql_parser G1 = compress_graph( sql_parser.sql_ddl2Graph( sql_parser.parse_sql('test_schemas/test_schema_from_paper1.sql'))) G2 = compress_graph( sql_parser.sql_ddl2Graph( sql_parser.parse_sql('test_schemas/test_schema_from_paper2.sql'))) sf = gen_sf(G1, G2, formula=formula) utils.schema_graph_draw(sf.IPG) pairs = f.select_filter(sf) f.print_pairs(pairs, outfile)
def test_on_xml(): import similarityflooding.parse.xml_parser as xml_parser G1 = compress_graph( xml_parser.schema_tree2Graph( xml_parser.parse_xml('test_schemas/test_schema.xml'))) utils.schema_graph_print(G1) G2 = compress_graph( xml_parser.schema_tree2Graph( xml_parser.parse_xml('test_schemas/test_schema_2.xml'))) sf = gen_sf(G1, G2) pairs = f.select_filter(sf) f.print_pairs(pairs)