from wmera.controller.query_executer import QueryExecuter from test.t_utils.t_factory import get_mera_matcher_with_data, get_empty_mera_matcher from wmera.mera_core.result.formater_interface import MeraFormaterInterface from wmera.utils import rel_path_to_file from wmera.controller.formater_to_json import FormaterToJson from wmera.mera_core.model.entities import Dataset class FakeFormater(MeraFormaterInterface): def format_mera_results(self, list_of_dicts_with_list_of_base_results): for a_stuff in list_of_dicts_with_list_of_base_results: print a_stuff executer = QueryExecuter(matcher=get_mera_matcher_with_data(graph_path="../../files/out/usos_graph.ttl", ngram_song_path="../../files/out/song_ngrams_usos.json", ngram_artist_path="../../files/out/artist_ngrams_usos.json", counter_path="../../files/out/counter_usos.json"), formater=FormaterToJson()) # executer = QueryExecuter(matcher=get_empty_mera_matcher(), # formater=FormaterToJson()) res = executer.execute_queries_from_file( file_path=rel_path_to_file("../../files/out/cwr-json-to-mera-json/posible_queries.json", __file__)) print res with open("../../files/in/mera_results_mini_usos.json", "r") as file_io: json_matches = file_io.read() executer.introduce_json_matches_in_graph(json_matches_str=json_matches, dataset_obj=Dataset(title="MiDatasetCWR"),
from apps.mera_experiment.mera_experiment import MeraExperiment from apps.mera_experiment.query_gen.aol_query_gen import AolQueryGen from apps.mera_experiment.query_gen.musicbrainz_query_gen import MusicbrainzQueryGen __author__ = 'Dani' from test.t_utils.t_factory import get_mera_matcher_with_data from apps.mera_experiment.exp_factory import get_mera_matcher_no_refs_with_data # ######### COMPLETE WITH REFS print "---------------- STARTING COMPLETE WITH REFS...." matcher_complete_with_refs = get_mera_matcher_with_data(graph_path="files/discogs_complete_graph.ttl", ngram_song_path="files/song_ngrams_complete.json", ngram_artist_path="files/artist_ngrams_complete.json", counter_path="files/counter_complete.json") print "---------------- COMPLETE WITH REFS: Structures loaded" experiment_aol_complete_refs = MeraExperiment(query_gen=AolQueryGen(matcher=matcher_complete_with_refs, aol_path_file="files/random_aol.txt"), description="AOL against complete graph with refs") experiment_mb_complete_refs = MeraExperiment(query_gen=MusicbrainzQueryGen(matcher=matcher_complete_with_refs, musicbrainz_path_file="files/random_musicbrainz.tsv"), description="MB against a complete graph with refs") # result = experiment_aol.run() result_mb_complete_ref = experiment_mb_complete_refs.run()