Beispiel #1
0
def execute_query(dataset_file, results_file, engine, m_relation, driver):

    keywords = []
    results = []

    #open dataset file
    with open(dataset_file, "r") as dataset:

        #get keywords
        keywords = util.random_keywords(dataset)

    #gathering results for any metamorphic relation

    if m_relation == "MPublished":
        results = metamorphic_relations.MPublished(engine, keywords, driver)

    if m_relation == "MPTitle":
        results = metamorphic_relations.MPTitle(engine, keywords, driver)

    if (m_relation == "MPReverseJD") or (m_relation == "SwapJD"):
        results = metamorphic_relations.MPReverseJD_SwapJD(
            engine, keywords, driver)

    if m_relation == "Top1Absent":
        results = metamorphic_relations.Top1Absent(engine, keywords, driver)

    #saving results into CSV file
    with open(results_file, "a") as sheet_results:
        out = csv.writer(sheet_results, delimiter=',', quoting=csv.QUOTE_ALL)
        out.writerow(results)
Beispiel #2
0
def execute_query(dataset_file, results_file, engine, m_relation, driver):
    
    keywords = []
    results = []
    
    #open dataset file
    with open(dataset_file, "r") as dataset:

        #get keywords
        keywords = util.random_keywords(dataset) 


    #gathering results for any metamorphic relation      

    if m_relation == "MPublished":
        results, condition = metamorphic_relations.MPublished(engine, keywords, driver)

    if m_relation == "MPTitle":
        results, condition = metamorphic_relations.MPTitle(engine, keywords, driver)

    if (m_relation == "MPReverseJD") or (m_relation == "MPShuffleJD"):
        results, condition = metamorphic_relations.MPShuffleJD(engine, keywords, driver)

    if m_relation == "Top1Absent":
        results, condition = metamorphic_relations.Top1Absent(engine, keywords, driver)

    #condition is a boolean value that stands if the execution happened as expected (we abort executions that went worong. Eg.: Scidirect strings > 255 chars)
    if condition:
        #saving results into CSV file
        with open(results_file, "a", encoding='utf-8') as sheet_results:
            out = csv.writer(sheet_results, delimiter=',',quoting=csv.QUOTE_ALL)
            out.writerow(results)
Beispiel #3
0
def test_create_search_string():

    path_file = os.getcwd() + "/dataset/keywords_sample.csv"

    with open(path_file, "r") as afile:
        keywords = util.random_keywords(afile)

        result = engines_string_generator.ieee_string(
            keywords, title="Some title of test")
        print("IEEE|Springer String: %s" % (result))

        result = engines_string_generator.spring_string(
            keywords, title="Some title of test")
        print("Springer String: %s" % (result))

        result = engines_string_generator.scopus_string(
            keywords, title="Some title of test")
        print("Scopus String: %s" % (result))

        result = engines_string_generator.sciente_direct_string(
            keywords, title="Some title of test")
        print("Science Direct String: %s" % (result))

        result = engines_string_generator.acm_string(
            keywords, title="Some title of test")
        print("ACM String: %s" % (result))
Beispiel #4
0
def test_random_keywords():

    path_file = os.getcwd() + "/dataset/keywords_sample.csv"

    with open(path_file, "r") as afile:
        keywords = util.random_keywords(afile)

    print(("A random keywords list from a file: %s") % (keywords))
Beispiel #5
0
    def test_random_keywords(self):

        path_file = os.getcwd() + "/dataset/keywords_sample.csv"

        with open(path_file, "r") as afile:
            keywords = util.random_keywords(afile)

        print(("A random keywords list from a file: %s") % (keywords))
        self.assertTrue(isinstance(keywords, list))