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
Merge requests
!7
Main
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Main
bav1758/ci-s-projekt-verarbeitung:main
into
main
Overview
0
Commits
22
Pipelines
0
Changes
3
Merged
Große, Judith
requested to merge
bav1758/ci-s-projekt-verarbeitung:main
into
main
3 years ago
Overview
0
Commits
22
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Viewing commit
81489864
Prev
Next
Show latest version
3 files
+
243
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
81489864
added Processing_test.py v1.0
· 81489864
Malte Schokolowski
authored
3 years ago
verarbeitung/Processing_test.py
0 → 100644
+
101
−
0
Options
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 3 16:54:43 2021
@author: Malte Schokolowski
"""
from
bs4
import
BeautifulSoup
as
bs
import
requests
as
req
import
sys
from
pathlib
import
Path
import
input_test
as
inp
def
process_main
(
array
,
depth
):
#ERROR-Handling doi_array = NULL, Tiefe < 0 oder 1 ??? +
if
(
depth
<
0
):
print
(
"
Error, depth of search must be positive
"
)
# leeres Array für die Knoten wird erstellt
# leeres Array für die Kanten wird erstellt
global
V
,
E
V
=
[]
E
=
[]
# Füge in Knoten-Array alle Starterknoten ein
for
pub_doi
in
array
:
pub
=
inp
.
input
(
pub_doi
)
V
.
append
(
pub
)
#print("\n")
process_rec
(
array
,
0
,
depth
)
return
(
V
,
E
)
def
process_rec
(
array
,
depth
,
depth_max
):
depth
+=
1
for
pub_doi
in
array
:
# Input aufrufen und speichern
pub
=
inp
.
input
(
pub_doi
)
# Klasseninstanz bestehend aus u.a.
# Name, Autoren, DOI, Jahr,
# was_wir_zitiert_haben, wo_wir_zitiert_wurden
for
citation
in
pub
.
_citations
:
#print(pub.doi_url, ".\t", citation.doi_url, "\n")
#Knoten j erstellen, wenn noch unbekannt
if
(
citation
not
in
V
):
if
(
depth
<=
depth_max
):
V
.
append
(
citation
)
#print(citation.doi_url, "\n")
E
.
append
([
pub
,
citation
])
#print(pub.doi_url, ".\t", citation.doi_url, "\n")
else
:
E
.
append
([
pub
,
citation
])
# Kante erstellen, wenn citation bekannt, also wenn beide im Input sind oder bei Zyklus
#print(pub.doi_url, ".\t", citation.doi_url, "\n")
#for k in wo_wir_zitiert_wurden:
#if (i != k):
#Knoten k erstellen, wenn noch unbekannt
#Kante erstellen von k nach i
if
(
depth
<
depth_max
):
cit_arr
=
[]
for
citation
in
pub
.
_citations
:
if
(
"
acs
"
in
citation
.
doi_url
):
cit_arr
.
append
(
citation
.
doi_url
)
process_rec
(
cit_arr
,
depth
,
depth_max
)
# Knoten- und Kantenmenge zurückgeben
# {1,2,3,4,5} oder
# {{1="paper1",0}, {2 = "paper2"},1} oder
# {1="paper1", 2 = "paper2"}
# {(1,2),(2,3),(2,4)}
arr
=
[]
arr
.
append
(
'
https://pubs.acs.org/doi/10.1021/acs.jcim.9b00249
'
)
arr
.
append
(
'
https://doi.org/10.1021/acs.jmedchem.0c01332
'
)
#arr.append('https://doi.org/10.1021/acs.jcim.0c00741')
#arr.append('https://doi.org/10.1021/acs.accounts.1c00440')
#arr.append('https://doi.org/10.1021/ci700007b')
#arr.append('https://doi.org/10.1021/acs.jcim.5b00292')
#url = sys.argv[1]
#arr.append[url]
V
,
E
=
process_main
(
arr
,
1
)
for
vortex
in
V
:
#print(vortex, "\n")
print
(
vortex
.
doi_url
,
"
\n
"
)
print
(
"
\n
"
)
for
i
in
range
(
len
(
E
)):
#print(edge,"\n")
print
(
E
[
i
][
0
].
doi_url
,
"
,
"
,
E
[
i
][
1
].
doi_url
,
"
\n
"
)
\ No newline at end of file
Loading