Skip to content
Snippets Groups Projects
Commit 6872d5c8 authored by Malte Schokolowski's avatar Malte Schokolowski
Browse files

Alinas Änderungen eingefügt

parent 20c84af6
No related branches found
No related tags found
1 merge request!11merge verarbeitung to main repo
...@@ -94,7 +94,7 @@ class ProcessingTest(unittest.TestCase): ...@@ -94,7 +94,7 @@ class ProcessingTest(unittest.TestCase):
nodes_old_single, edges_old_single = process_main(['doi_lg_1_i'],2,2,True) nodes_old_single, edges_old_single = process_main(['doi_lg_1_i'],2,2,True)
nodes_old_both, edges_old_both = process_main(['doi_lg_1_i','doi_lg_2_i'],2,2,True) nodes_old_both, edges_old_both = process_main(['doi_lg_1_i','doi_lg_2_i'],2,2,True)
nodes_new_both, edges_new_both = input_from_json('test_output.json') nodes_new_both, edges_new_both = input_from_json('test_output.json')
nodes_new_single, edges_new_single = check_graph_updates(['doi_lg_1_i'], nodes_old_both, edges_old_both, True) nodes_new_single, edges_new_single = check_graph_updates(['doi_lg_1_i'], nodes_old_both, edges_old_both, 'test_output.json', 2, 2, True)
self.assertCountEqual(nodes_old_single,nodes_new_single) self.assertCountEqual(nodes_old_single,nodes_new_single)
self.assertCountEqual(edges_old_single, edges_new_single) self.assertCountEqual(edges_old_single, edges_new_single)
......
...@@ -23,14 +23,14 @@ from verarbeitung.construct_new_graph.Processing import initialize_nodes_list, c ...@@ -23,14 +23,14 @@ from verarbeitung.construct_new_graph.Processing import initialize_nodes_list, c
from verarbeitung.construct_new_graph.add_citations_rec import add_citations from verarbeitung.construct_new_graph.add_citations_rec import add_citations
from verarbeitung.construct_new_graph.export_to_json import output_to_json from verarbeitung.construct_new_graph.export_to_json import output_to_json
def connect_old_and_new_input(json_file, new_doi_list, search_height, search_depth, test_var = False): def connect_old_and_new_input(json_file, new_doi_list, search_depth, search_height, test_var = False):
global nodes, edges global nodes, edges
nodes = [] nodes = []
edges = [] edges = []
nodes, edges = input_from_json(json_file) nodes, edges = input_from_json(json_file)
complete_changed_group_nodes(new_doi_list, search_height, search_depth, test_var) complete_changed_group_nodes(new_doi_list, search_depth, search_height, test_var)
# initializes nodes/edges from input and gets a list with publication objects for citations and references returned # initializes nodes/edges from input and gets a list with publication objects for citations and references returned
references_obj_list, citations_obj_list = initialize_nodes_list(new_doi_list,search_depth, search_height, test_var) references_obj_list, citations_obj_list = initialize_nodes_list(new_doi_list,search_depth, search_height, test_var)
...@@ -48,21 +48,17 @@ def connect_old_and_new_input(json_file, new_doi_list, search_height, search_dep ...@@ -48,21 +48,17 @@ def connect_old_and_new_input(json_file, new_doi_list, search_height, search_dep
return(nodes, edges) return(nodes, edges)
def complete_changed_group_nodes(new_doi_list, search_height_max, search_depth_max, test_var): def complete_changed_group_nodes(new_doi_list, search_depth_max, search_height_max, test_var):
changed_group_node_citations = [] changed_group_node_citations = []
changed_group_node_references = [] changed_group_node_references = []
for node in nodes: for node in nodes:
if (node.group != 0) and (node.doi in new_doi_list): if (node.group < 0) and (node.doi in new_doi_list):
node.group = 0 node.group = "input"
# inserts references as publication objects into list and
# inserts first depth references into nodes/edges if maximum search depth > 0
for reference in add_citations(nodes, edges, node, 0, search_depth_max, "Reference", test_var): elif (node.group > 0):
changed_group_node_references.append(reference) node.group = "input"
# inserts citations as publication objects into list and
# inserts first height citations into nodes if maximum search height > 0
for citation in add_citations(nodes, edges, node, 0, search_height_max, "Citation", test_var):
changed_group_node_citations.append(citation)
...@@ -23,6 +23,7 @@ from input.publication import Publication ...@@ -23,6 +23,7 @@ from input.publication import Publication
from verarbeitung.get_pub_from_input import get_pub from verarbeitung.get_pub_from_input import get_pub
from .Knoten_Vergleich import doi_listen_vergleichen from .Knoten_Vergleich import doi_listen_vergleichen
from .update_graph_del import delete_nodes_and_edges from .update_graph_del import delete_nodes_and_edges
from .connect_new_input import connect_old_and_new_input
def get_old_input_dois(old_obj_input_list): def get_old_input_dois(old_obj_input_list):
...@@ -64,7 +65,7 @@ def get_new_input_dois(new_input, test_var): ...@@ -64,7 +65,7 @@ def get_new_input_dois(new_input, test_var):
return(new_input_dois) return(new_input_dois)
def check_graph_updates(new_doi_input_list, old_obj_input_list, old_edges_list, test_var = False): def check_graph_updates(new_doi_input_list, old_obj_input_list, old_edges_list, json_file, search_depth, search_height, test_var = False):
''' '''
:param new_doi_input_list: input list of doi from UI :param new_doi_input_list: input list of doi from UI
:type new_doi_input_list: list of strings :type new_doi_input_list: list of strings
...@@ -101,5 +102,7 @@ def check_graph_updates(new_doi_input_list, old_obj_input_list, old_edges_list, ...@@ -101,5 +102,7 @@ def check_graph_updates(new_doi_input_list, old_obj_input_list, old_edges_list,
if (len(deleted_nodes) > 0): if (len(deleted_nodes) > 0):
processed_input_list_del, valid_edges_del = delete_nodes_and_edges(processed_input_list, deleted_nodes, old_doi_input_list, old_edges_list) processed_input_list_del, valid_edges_del = delete_nodes_and_edges(processed_input_list, deleted_nodes, old_doi_input_list, old_edges_list)
if (len(inserted_nodes) > 0):
connect_old_and_new_input(json_file, inserted_nodes, search_depth, search_height, test_var)
return(processed_input_list_del, valid_edges_del) return(processed_input_list_del, valid_edges_del)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment