Skip to content
Snippets Groups Projects

merge verarbeitung to main repo

Merged Schokolowski, Malte requested to merge bav1758/ci-s-projekt-verarbeitung:main into main
14 files
+ 231
303
Compare changes
  • Side-by-side
  • Inline
Files
14
@@ -23,7 +23,6 @@ from input.publication import Publication
from verarbeitung.get_pub_from_input import get_pub
from .export_to_json import output_to_json
from .add_citations_rec import add_citations, create_global_lists_cit
from .add_references_rec import add_references, create_global_lists_ref
def initialize_nodes_list(doi_input_list, search_depth_max, search_height_max, test_var):
@@ -61,39 +60,36 @@ def initialize_nodes_list(doi_input_list, search_depth_max, search_height_max, t
break
if (not_in_nodes): #there is no node with this doi in the set
nodes.append(pub) #appends Publication Object
pub.group = "input"
pub.group = 0
else:
doi_input_list.remove(pub_doi) #deletes the doi-dublicate from input list
# inserts references as publication objects into list and
# inserts first depth references into nodes/edges if maximum search depth > 0
for reference in create_global_lists_ref(nodes, edges, pub, 0, search_depth_max, test_var):
for reference in create_global_lists_cit(nodes, edges, pub, 0, search_depth_max, "Reference", test_var):
references_pub_obj_list.append(reference)
# inserts citations as publication objects into list and
# inserts first height citations into nodes if maximum search height > 0
for citation in create_global_lists_cit(nodes, edges, pub, 0, search_height_max, test_var):
for citation in create_global_lists_cit(nodes, edges, pub, 0, search_height_max, "Citation", test_var):
citations_pub_obj_list.append(citation)
return(references_pub_obj_list, citations_pub_obj_list)
def complete_inner_edges(test_var):
def complete_inner_edges():
'''
:param test_var: variable to differenciate between test and url call
:type test_var: boolean
completes inner edges between nodes of group height and depth
'''
for node in nodes:
if (node.group == "depth"):
if (node.group < 0):
for citation in node.citations:
for cit in nodes:
if (citation == cit.doi_url and [citation, node.doi_url] not in edges):
edges.append([citation, node.doi_url])
if (node.group == "height"):
if (node.group > 0):
for reference in node.references:
for ref in nodes:
if (reference == ref.doi_url and [node.doi_url, reference] not in edges):
@@ -103,7 +99,7 @@ def complete_inner_edges(test_var):
def process_main(doi_input_list, search_height, search_depth, test_var = False):
'''
:param doi_input_list: input list of doi from UI
:type doi_input_list: list of strings
:type doi_input_list: List[String]
:param search_height: maximum height to search for citations
:type search_height: int
@@ -139,11 +135,11 @@ def process_main(doi_input_list, search_height, search_depth, test_var = False):
references_obj_list, citations_obj_list = initialize_nodes_list(doi_input_list,search_depth, search_height, test_var)
# function calls to begin recursive processing up to max depth/height
add_citations(nodes, edges, citations_obj_list, 1, search_height, test_var)
add_references(nodes, edges, references_obj_list, 1, search_depth, test_var)
add_citations(nodes, edges, citations_obj_list, 1, search_height, "Citation", test_var)
add_citations(nodes, edges, references_obj_list, 1, search_depth, "Reference", test_var)
# adds edges between reference group and citation group of known publications
complete_inner_edges(test_var)
complete_inner_edges()
# calls a skript to save nodes and edges of graph in .json file
output_to_json(nodes,edges, test_var)
Loading