def test_run_a_query(engine, keywords, driver): title = 'Need a bigger string to simulate a cenario that that exceeds the maximum size allowed by the search base science direct' #generate string source_string = util.create_search_string(keywords, engine, title=title) print("String: ", source_string) #create the bots acm_bot = ACM(source_string, driver) ieee_bot = IEEE(source_string, driver) scidirect_bot = Scidirect(source_string, driver) scopus_bot = Scopus(source_string, driver) springer_bot = Springer(source_string, driver) source_results = [] #get the source query results if engine == "ACM": source_results = acm_bot.test_ACM() if engine == "IEEE": source_results = ieee_bot.test_IEEE() if engine == "Scidirect": source_results = scidirect_bot.test_scidirect() if engine == "Springer": source_results = springer_bot.test_springer() if engine == "Scopus": source_results = scopus_bot.test_Scopus()
def Top1Absent(engine, keywords, driver): #get the time using a specific format starting_time = datetime.datetime.now().strftime('%H:%M:%S') results = [] #source search source_string = util.create_search_string(keywords, engine) #create the bots acm_bot = ACM(source_string, driver) ieee_bot = IEEE(source_string, driver) scidirect_bot = Scidirect(source_string, driver) scopus_bot = Scopus(source_string, driver) springer_bot = Springer(source_string, driver) source_results = [] #get the source query results if engine == "ACM": source_results = acm_bot.test_ACM() if engine == "IEEE": source_results = ieee_bot.test_IEEE() if engine == "Scidirect": source_results = scidirect_bot.test_scidirect() if engine == "Springer": source_results = springer_bot.test_springer() if engine == "Scopus": source_results = scopus_bot.test_Scopus() #get the list of papers and conferences from source query source_papers = source_results[1] conferences_list = source_results[2] #surround by try to avoid exceptions try: #get the first paper name first_paper = source_papers[0] except: first_paper = '' try: #conference of the first paper first_conference = conferences_list[0] except: first_conference = '' #generate the followup string follow_string = util.create_search_string(keywords, engine, title=first_paper) #create a new instance of the bots acm_bot = ACM(follow_string, driver) ieee_bot = IEEE(follow_string, driver) scidirect_bot = Scidirect(follow_string, driver) scopus_bot = Scopus(follow_string, driver) springer_bot = Springer(follow_string, driver) follow_up_results = [] #get the followup query results if engine == "ACM": follow_up_results = acm_bot.test_ACM() if engine == "IEEE": follow_up_results = ieee_bot.test_IEEE() if engine == "Scidirect": #Scidirect limitation.. Strings bigger than 255 chars are not suported. End the execution and sent a False value to not registre the entry if (len(follow_string) > 255): print( "W: Follow-up string exceeds the allowed size limit for the base! This execution will be aborted and will not be logged." ) return [], False follow_up_results = scidirect_bot.test_scidirect() if engine == "Springer": follow_up_results = springer_bot.test_springer() if engine == "Scopus": follow_up_results = scopus_bot.test_Scopus() #papers from follow up query try: followup_papers = follow_up_results[1] except: followup_papers = [] try: first_followup_paper = follow_up_results[1] except: first_followup_paper = '' #check if the first paper of both query is equal if (first_paper == first_followup_paper) and (first_paper != ''): #working good fault = False else: #there is a bug fault = True results = [source_string] + source_results + [ follow_string ] + follow_up_results + [fault] + [starting_time] #add an extra return value to ensure that the execution runned as expected return results, True
def Top1Absent(engine, keywords, driver): #get the time using a specific format starting_time = datetime.datetime.now().strftime('%H:%M:%S') results = [] #source search source_string = util.create_search_string(keywords, engine) #create the bots acm_bot = ACM(source_string, driver) ieee_bot = IEEE(source_string, driver) scidirect_bot = Scidirect(source_string, driver) scopus_bot = Scopus(source_string, driver) springer_bot = Springer(source_string, driver) #get the source query results if engine == "ACM": source_results = acm_bot.test_ACM() if engine == "IEEE": source_results = ieee_bot.test_IEEE() if engine == "Scidirect": source_results = scidirect_bot.test_scidirect() if engine == "Springer": source_results = springer_bot.test_springer() if engine == "SCOPUS": source_results = scopus_bot.test_Scopus() #get the first paper from source query source_papers = source_results[1] first_paper = source_papers[0] #get the conference of the first paper conferences_list = source_results[2] first_conference = conferences_list[0] #generate the followup string follow_string = util.create_search_string(keywords, engine, title=first_paper) #create a new instance of the bots acm_bot = ACM(follow_string, driver) ieee_bot = IEEE(follow_string, driver) scidirect_bot = Scidirect(follow_string, driver) scopus_bot = Scopus(follow_string, driver) springer_bot = Springer(follow_string, driver) #get the followup query results if engine == "ACM": follow_up_results = acm_bot.test_ACM() if engine == "IEEE": follow_up_results = ieee_bot.test_IEEE() if engine == "Scidirect": follow_up_results = scidirect_bot.test_scidirect() if engine == "Springer": follow_up_results = springer_bot.test_springer() if engine == "Scopus": follow_up_results = scopus_bot.test_Scopus() #papers from follow up query followup_papers = follow_up_results[1] #check if the first paper of both query is equal if first_paper == followup_papers[0]: #working good fault = False else: #there is a bug fault = True results = [source_string] + source_results + [ follow_string ] + follow_up_results + [fault] + [starting_time] return results
def MPShuffleJD(engine, keywords, driver): #get the time using a specific format starting_time = datetime.datetime.now().strftime('%H:%M:%S') results = [] #source search source_string = util.create_search_string(keywords, engine) #create the bots acm_bot = ACM(source_string, driver) ieee_bot = IEEE(source_string, driver) scidirect_bot = Scidirect(source_string, driver) scopus_bot = Scopus(source_string, driver) springer_bot = Springer(source_string, driver) source_results = [] #get the source query results if engine == "ACM": source_results = acm_bot.test_ACM() if engine == "IEEE": source_results = ieee_bot.test_IEEE() if engine == "Scidirect": source_results = scidirect_bot.test_scidirect() if engine == "Springer": source_results = springer_bot.test_springer() if engine == "Scopus": source_results = scopus_bot.test_Scopus() #shufle the keywords from random import shuffle shuffle(keywords) #generate the followup string follow_string = util.create_search_string(keywords, engine) #create a new instance of the bots acm_bot = ACM(follow_string, driver) ieee_bot = IEEE(follow_string, driver) scidirect_bot = Scidirect(follow_string, driver) scopus_bot = Scopus(follow_string, driver) springer_bot = Springer(follow_string, driver) follow_up_results = [] #get the followup query results if engine == "ACM": follow_up_results = acm_bot.test_ACM() if engine == "IEEE": follow_up_results = ieee_bot.test_IEEE() if engine == "Scidirect": #Scidirect limitation.. Strings bigger than 255 chars are not suported. End the execution and sent a False value to not registre the entry if (len(follow_string) > 255): print( "W: Follow-up string exceeds the allowed size limit for the base! This execution will be aborted and will not be logged." ) return [], False follow_up_results = scidirect_bot.test_scidirect() if engine == "Springer": follow_up_results = springer_bot.test_springer() if engine == "Scopus": follow_up_results = scopus_bot.test_Scopus() #get the first paper from source query try: num_source = source_results[0] except: num_source = 0 try: source_papers = source_results[1] except: source_papers = [] #get followup results try: num_followup = follow_up_results[0] except: num_followup = 0 try: followup_papers = follow_up_results[1] except: followup_papers = [] #If the number of results is diferent then found a anomaly if num_source == num_followup: anon = False else: anon = True #check similarity from both results jaccard = metrics.check_similarity(source_papers, followup_papers) results = [source_string] + source_results + [ follow_string ] + follow_up_results + [anon] + [jaccard] + [starting_time] #add an extra return value to ensure that the execution runned as expected return results, True
def MPReverseJD_SwapJD(engine, keywords, driver): #get the time using a specific format starting_time = datetime.datetime.now().strftime('%H:%M:%S') results = [] #source search source_string = util.create_search_string(keywords, engine) #create the bots acm_bot = ACM(source_string, driver) ieee_bot = IEEE(source_string, driver) scidirect_bot = Scidirect(source_string, driver) scopus_bot = Scopus(source_string, driver) springer_bot = Springer(source_string, driver) #get the source query results if engine == "ACM": source_results = acm_bot.test_ACM() if engine == "IEEE": source_results = ieee_bot.test_IEEE() if engine == "Scidirect": source_results = scidirect_bot.test_scidirect() if engine == "Springer": source_results = springer_bot.test_springer() if engine == "SCOPUS": source_results = scopus_bot.test_Scopus() #shufle the keywords from random import shuffle shuffle(keywords) #generate the followup string follow_string = util.create_search_string(keywords, engine) #create a new instance of the bots acm_bot = ACM(follow_string, driver) ieee_bot = IEEE(follow_string, driver) scidirect_bot = Scidirect(follow_string, driver) scopus_bot = Scopus(follow_string, driver) springer_bot = Springer(follow_string, driver) #get the followup query results if engine == "ACM": follow_up_results = acm_bot.test_ACM() if engine == "IEEE": follow_up_results = ieee_bot.test_IEEE() if engine == "Scidirect": follow_up_results = scidirect_bot.test_scidirect() if engine == "Springer": follow_up_results = springer_bot.test_springer() if engine == "SCOPUS": follow_up_results = scopus_bot.test_Scopus() #get the first paper from source query num_source = source_results[0] source_papers = source_results[1] #get followup results num_followup = follow_up_results[0] followup_papers = follow_up_results[1] #If the number of results is diferent then found a anomaly if num_source == num_followup: anon = False else: anon = True #check similarity from both results jaccard = statistics.check_similarity(source_papers, followup_papers) results = [source_string] + source_results + [ follow_string ] + follow_up_results + [anon] + [jaccard] + [starting_time] return results