Newer
Older
# -*- coding: utf-8 -*-
"""
main function to call to generate a graph representing citations between multiple ACS/Nature journals
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
__authors__ = "Donna Löding, Alina Molkentin, Xinyi Tang, Judith Große, Malte Schokolowski"
__email__ = "cis-project2021@zbh.uni-hamburg.de"
__status__ = "Production"
#__copyright__ = ""
#__credits__ = ["", "", "", ""]
#__license__ = ""
#__version__ = ""
#__maintainer__ = ""
import sys
from pathlib import Path
from os import error
sys.path.append("../")
from verarbeitung.construct_new_graph.export_to_json import output_to_json
from verarbeitung.construct_new_graph.initialize_graph import init_graph_construction
from verarbeitung.update_graph.update_graph import update_graph
def Processing(url_list, search_depth, search_height, json_file = 'json_text.json'):
'''
:param url_list: list of urls to construct publication graph for
:type url_list: List[String]
:param search_depth: maximum depth to search for references
:type search_depth: int
:param search_height: maximum height to search for citations
:type search_height: int
:param json_file: file to export graph to
:type json_file: String
main function to construct new or updated publication graphs
'''
# updates graph if json file is known in directory otherwise starts new graph construction
try:
with open(json_file) as f:
nodes, edges = update_graph(url_list, json_file, search_depth, search_height)
except IOError:
nodes, edges = init_graph_construction(url_list, search_depth, search_height)
# exports graph to given json file name
output_to_json(nodes, edges, json_file)