Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
09b8f637
Commit
09b8f637
authored
3 years ago
by
Molkentin, Alina
Committed by
Malte Schokolowski
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
connect new input hinzugefügt
parent
00f57dce
No related branches found
Branches containing commit
No related tags found
1 merge request
!11
merge verarbeitung to main repo
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
verarbeitung/connect_new_input.py
+67
-0
67 additions, 0 deletions
verarbeitung/connect_new_input.py
with
67 additions
and
0 deletions
verarbeitung/connect_new_input.py
0 → 100644
+
67
−
0
View file @
09b8f637
# -*- coding: utf-8 -*-
"""
Functions to update a graph representing citations between multiple ACS/Nature journals
"""
__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
import_form_json
import
input_from_json
from
Processing
import
initialize_nodes_list
,
process_citations_rec
,
process_references_rec
,
complete_inner_edges
,
create_graph_structure_references
,
create_graph_structure_citations
from
json_demo
import
output_to_json
def
connect_old_and_new_input
(
json_file
,
new_doi_list
,
search_height
,
search_depth
,
test_var
=
False
):
global
nodes
,
edges
nodes
=
[]
edges
=
[]
nodes
,
edges
=
input_from_json
(
json_file
)
complete_changed_group_nodes
(
new_doi_list
,
search_height
,
search_depth
,
test_var
)
# 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
)
# function calls to begin recursive processing up to max depth/height
process_citations_rec
(
citations_obj_list
,
1
,
search_height
,
test_var
)
process_references_rec
(
references_obj_list
,
1
,
search_depth
,
test_var
)
# adds edges between reference group and citation group of known publications
complete_inner_edges
(
test_var
)
# calls a skript to save nodes and edges of graph in .json file
output_to_json
(
nodes
,
edges
,
test_var
)
return
(
nodes
,
edges
)
def
complete_changed_group_nodes
(
new_doi_list
,
search_height_max
,
search_depth_max
,
test_var
):
changed_group_node_citations
=
[]
changed_group_node_references
=
[]
for
node
in
nodes
:
if
(
node
.
group
!=
"
input
"
)
and
(
node
.
doi
in
new_doi_list
):
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
create_graph_structure_references
(
node
,
0
,
search_depth_max
,
test_var
):
changed_group_node_references
.
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_graph_structure_citations
(
node
,
0
,
search_height_max
,
test_var
):
changed_group_node_citations
.
append
(
citation
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment