ricgraph 2.8__tar.gz → 2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ricgraph-2.8/ricgraph.egg-info → ricgraph-2.9}/PKG-INFO +1 -1
- {ricgraph-2.8 → ricgraph-2.9}/pyproject.toml +1 -1
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph/__init__.py +0 -2
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph/ricgraph.py +343 -79
- {ricgraph-2.8 → ricgraph-2.9/ricgraph.egg-info}/PKG-INFO +1 -1
- {ricgraph-2.8 → ricgraph-2.9}/LICENSE +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/README-PyPI.md +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/README.md +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph.egg-info/SOURCES.txt +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph.egg-info/dependency_links.txt +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph.egg-info/requires.txt +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/ricgraph.egg-info/top_level.txt +0 -0
- {ricgraph-2.8 → ricgraph-2.9}/setup.cfg +0 -0
|
@@ -66,7 +66,7 @@ In RICGRAPH_PROPERTIES_STANDARD:
|
|
|
66
66
|
- name: name of the node, e.g. ISNI, ORCID, DOI, etc.
|
|
67
67
|
|
|
68
68
|
- category: category of the node,
|
|
69
|
-
e.g. person, person-root, book, journal article,
|
|
69
|
+
e.g. person, person-root, book, journal article, data set, etc.
|
|
70
70
|
|
|
71
71
|
- value: value of the node.
|
|
72
72
|
|
|
@@ -100,6 +100,7 @@ In the default configuration of Ricgraph, the following properties are included:
|
|
|
100
100
|
|
|
101
101
|
import os
|
|
102
102
|
import sys
|
|
103
|
+
import re
|
|
103
104
|
from datetime import datetime
|
|
104
105
|
import numpy
|
|
105
106
|
import pandas
|
|
@@ -118,7 +119,11 @@ __copyright__ = 'Copyright (c) 2023, 2024, 2025 Rik D.T. Janssen'
|
|
|
118
119
|
__email__ = ''
|
|
119
120
|
__license__ = 'MIT License'
|
|
120
121
|
__package__ = 'Ricgraph'
|
|
121
|
-
|
|
122
|
+
|
|
123
|
+
# __version__ should be placed here instead of in __init__.py.
|
|
124
|
+
# If not here, it cannot be found when executing something like
|
|
125
|
+
# PYTHONPATH=../ricgraph ../bin/python ricgraph_explorer.py
|
|
126
|
+
__version__ = '2.9'
|
|
122
127
|
|
|
123
128
|
|
|
124
129
|
# ########################################################################
|
|
@@ -168,7 +173,7 @@ graphdb_nr_deletes = 0
|
|
|
168
173
|
# An example mapping may look like this:
|
|
169
174
|
# mapping = {
|
|
170
175
|
# 'book': ROTYPE_BOOK,
|
|
171
|
-
# '
|
|
176
|
+
# 'data set': ROTYPE_DATASET,
|
|
172
177
|
# 'software': ROTYPE_SOFTWARE
|
|
173
178
|
# }
|
|
174
179
|
#
|
|
@@ -300,7 +305,7 @@ def open_ricgraph() -> Driver:
|
|
|
300
305
|
"""
|
|
301
306
|
global _graph
|
|
302
307
|
|
|
303
|
-
print('Opening
|
|
308
|
+
print('Opening Ricgraph.\n')
|
|
304
309
|
try:
|
|
305
310
|
_graph = GraphDatabase.driver(GRAPHDB_URL,
|
|
306
311
|
auth=(GRAPHDB_USER, GRAPHDB_PASSWORD))
|
|
@@ -325,7 +330,7 @@ def close_ricgraph() -> None:
|
|
|
325
330
|
"""
|
|
326
331
|
global _graph
|
|
327
332
|
|
|
328
|
-
print('Closing
|
|
333
|
+
print('Closing Ricgraph.\n')
|
|
329
334
|
_graph.close()
|
|
330
335
|
return
|
|
331
336
|
|
|
@@ -353,28 +358,16 @@ def empty_ricgraph(answer: str = '') -> None:
|
|
|
353
358
|
"""
|
|
354
359
|
global _graph
|
|
355
360
|
|
|
356
|
-
if answer
|
|
357
|
-
print('
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
+
if answer != 'yes' and answer != 'no':
|
|
362
|
+
print('empty_ricgraph(): invalid answer "' + answer + '" on the question')
|
|
363
|
+
print('to empty Ricgraph, exiting.')
|
|
364
|
+
exit(1)
|
|
365
|
+
|
|
366
|
+
if answer == 'no':
|
|
367
|
+
print('empty_ricgraph(): Ricgraph will not be emptied.\n')
|
|
361
368
|
return
|
|
362
|
-
else:
|
|
363
|
-
print('Do you want to empty Ricgraph? You have the following options:')
|
|
364
|
-
print('- "yes": Ricgraph will be emptied.')
|
|
365
|
-
print('- "no": Ricgraph will not be emptied.')
|
|
366
|
-
print('- any other answer: Ricgraph will not be emptied, execution of this script will abort.')
|
|
367
|
-
user_input = input('Please make a choice: ')
|
|
368
|
-
if user_input.lower() == 'yes':
|
|
369
|
-
print('\nRicgraph will be emptied.\n')
|
|
370
|
-
# Fall through.
|
|
371
|
-
elif user_input.lower() == 'no':
|
|
372
|
-
print('\nRicgraph has not been emptied.\n')
|
|
373
|
-
return
|
|
374
|
-
else:
|
|
375
|
-
print('\nRicgraph has not been emptied, exiting.\n')
|
|
376
|
-
exit(1)
|
|
377
369
|
|
|
370
|
+
print('empty_ricgraph(): Ricgraph will be emptied.\n')
|
|
378
371
|
graphdb_name = ricgraph_database()
|
|
379
372
|
graphdb_databasename = ricgraph_databasename()
|
|
380
373
|
|
|
@@ -755,6 +748,14 @@ def cypher_create_edge_if_not_exists(left_node_element_id: str, right_node_eleme
|
|
|
755
748
|
# ##############################################################################
|
|
756
749
|
# General Ricgraph functions.
|
|
757
750
|
# ##############################################################################
|
|
751
|
+
def get_ricgraph_version() -> str:
|
|
752
|
+
"""Get the version Ricgraph.
|
|
753
|
+
|
|
754
|
+
:return: the version string.
|
|
755
|
+
"""
|
|
756
|
+
return __version__
|
|
757
|
+
|
|
758
|
+
|
|
758
759
|
def get_ricgraph_ini_file() -> str:
|
|
759
760
|
"""Get the location of the ricgraph ini file.
|
|
760
761
|
|
|
@@ -927,6 +928,184 @@ def create_well_known_url(name: str, value: str) -> str:
|
|
|
927
928
|
return ''
|
|
928
929
|
|
|
929
930
|
|
|
931
|
+
def normalize_doi(identifier: str) -> str:
|
|
932
|
+
"""Normalize DOI.
|
|
933
|
+
|
|
934
|
+
:param identifier: identifier to normalize.
|
|
935
|
+
:return: Result of normalizing.
|
|
936
|
+
"""
|
|
937
|
+
if identifier == '':
|
|
938
|
+
return ''
|
|
939
|
+
identifier = identifier.lower()
|
|
940
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
941
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
942
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
943
|
+
identifier = re.sub(pattern=r'doi.org/', repl='', string=identifier)
|
|
944
|
+
identifier = re.sub(pattern=r'doi', repl='', string=identifier)
|
|
945
|
+
identifier = re.sub(pattern=r'.proxy.uu.nl/', repl='', string=identifier)
|
|
946
|
+
return identifier
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
def normalize_ror(identifier: str) -> str:
|
|
950
|
+
"""Normalize ROR.
|
|
951
|
+
|
|
952
|
+
:param identifier: identifier to normalize.
|
|
953
|
+
:return: Result of normalizing.
|
|
954
|
+
"""
|
|
955
|
+
if identifier == '':
|
|
956
|
+
return ''
|
|
957
|
+
identifier = identifier.lower()
|
|
958
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
959
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
960
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
961
|
+
identifier = re.sub(pattern=r'ror.org/', repl='', string=identifier)
|
|
962
|
+
return identifier
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
def normalize_orcid(identifier: str) -> str:
|
|
966
|
+
"""Normalize ORCID.
|
|
967
|
+
|
|
968
|
+
:param identifier: identifier to normalize.
|
|
969
|
+
:return: Result of normalizing.
|
|
970
|
+
"""
|
|
971
|
+
if identifier == '':
|
|
972
|
+
return ''
|
|
973
|
+
identifier = identifier.lower()
|
|
974
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
975
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
976
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
977
|
+
identifier = re.sub(pattern=r'orcid.org/', repl='', string=identifier)
|
|
978
|
+
identifier = identifier.upper()
|
|
979
|
+
return identifier
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
def normalize_isni(identifier: str) -> str:
|
|
983
|
+
"""Normalize ISNI.
|
|
984
|
+
|
|
985
|
+
:param identifier: identifier to normalize.
|
|
986
|
+
:return: Result of normalizing.
|
|
987
|
+
"""
|
|
988
|
+
if identifier == '':
|
|
989
|
+
return ''
|
|
990
|
+
identifier = identifier.lower()
|
|
991
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
992
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
993
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
994
|
+
identifier = re.sub(pattern=r'isni.org/isni/', repl='', string=identifier)
|
|
995
|
+
identifier = identifier.upper()
|
|
996
|
+
return identifier
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
def normalize_openalex(identifier: str) -> str:
|
|
1000
|
+
"""Normalize OpenAlex identifier.
|
|
1001
|
+
|
|
1002
|
+
:param identifier: identifier to normalize.
|
|
1003
|
+
:return: Result of normalizing.
|
|
1004
|
+
"""
|
|
1005
|
+
if identifier == '':
|
|
1006
|
+
return ''
|
|
1007
|
+
identifier = identifier.lower()
|
|
1008
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
1009
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
1010
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
1011
|
+
identifier = re.sub(pattern=r'openalex.org/', repl='', string=identifier)
|
|
1012
|
+
identifier = identifier.upper()
|
|
1013
|
+
return identifier
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
def normalize_scopus_author_id(identifier: str) -> str:
|
|
1017
|
+
"""Normalize SCOPUS_AUTHOR_ID. Return a uniform value.
|
|
1018
|
+
|
|
1019
|
+
:param identifier: identifier to normalize.
|
|
1020
|
+
:return: Result of normalizing.
|
|
1021
|
+
"""
|
|
1022
|
+
if identifier == '':
|
|
1023
|
+
return ''
|
|
1024
|
+
identifier = identifier.lower()
|
|
1025
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
1026
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
1027
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
1028
|
+
identifier = re.sub(pattern=r'scopus.com/authid/detail.uri', repl='', string=identifier)
|
|
1029
|
+
identifier = re.sub(pattern=r'\?authorid\=', repl='', string=identifier)
|
|
1030
|
+
return identifier
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
def normalize_researcher_id(identifier: str) -> str:
|
|
1034
|
+
"""Normalize RESEARCHER_ID.
|
|
1035
|
+
|
|
1036
|
+
:param identifier: identifier to normalize.
|
|
1037
|
+
:return: Result of normalizing.
|
|
1038
|
+
"""
|
|
1039
|
+
if identifier == '':
|
|
1040
|
+
return ''
|
|
1041
|
+
identifier = identifier.lower()
|
|
1042
|
+
identifier = re.sub(pattern=r'https|http', repl='', string=identifier)
|
|
1043
|
+
identifier = re.sub(pattern=r'://', repl='', string=identifier)
|
|
1044
|
+
identifier = re.sub(pattern=r'www.', repl='', string=identifier)
|
|
1045
|
+
identifier = re.sub(pattern=r'researcherid.com/rid/', repl='', string=identifier)
|
|
1046
|
+
identifier = identifier.upper()
|
|
1047
|
+
return identifier
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
def normalize_digital_author_id(identifier: str) -> str:
|
|
1051
|
+
"""Normalize DIGITAL_AUTHOR_ID.
|
|
1052
|
+
|
|
1053
|
+
:param identifier: identifier to normalize.
|
|
1054
|
+
:return: Result of normalizing.
|
|
1055
|
+
"""
|
|
1056
|
+
if identifier == '':
|
|
1057
|
+
return ''
|
|
1058
|
+
identifier = identifier.lower()
|
|
1059
|
+
identifier = re.sub(pattern=r'urn:nbn:nl:ui:', repl='', string=identifier)
|
|
1060
|
+
identifier = re.sub(pattern=r'info:eu-repo/dai/nl/', repl='', string=identifier)
|
|
1061
|
+
identifier = identifier.upper()
|
|
1062
|
+
return identifier
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
def normalize_email(identifier: str) -> str:
|
|
1066
|
+
"""Normalize email address.
|
|
1067
|
+
|
|
1068
|
+
:param identifier: identifier to normalize.
|
|
1069
|
+
:return: Result of normalizing.
|
|
1070
|
+
"""
|
|
1071
|
+
if identifier == '':
|
|
1072
|
+
return ''
|
|
1073
|
+
identifier = identifier.lower()
|
|
1074
|
+
return identifier
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
def normalize_identifiers(df: pandas.DataFrame) -> pandas.DataFrame:
|
|
1078
|
+
"""Normalize selected identifiers in the dataframe.
|
|
1079
|
+
Delete empty rows and duplicates.
|
|
1080
|
+
|
|
1081
|
+
:param df: dataframe with identifiers.
|
|
1082
|
+
:return: Result of normalizing.
|
|
1083
|
+
"""
|
|
1084
|
+
df_mod = df.copy(deep=True)
|
|
1085
|
+
|
|
1086
|
+
# Ensure that all '' values are NaN, so that those rows can be easily removed with dropna()
|
|
1087
|
+
df_mod.replace('', numpy.nan, inplace=True)
|
|
1088
|
+
# dropna(how='all'): drop row if all row values contain NaN
|
|
1089
|
+
df_mod.dropna(axis=0, how='all', inplace=True)
|
|
1090
|
+
df_mod.drop_duplicates(keep='first', inplace=True, ignore_index=True)
|
|
1091
|
+
|
|
1092
|
+
# The values in this list correspond to the normalize functions above,
|
|
1093
|
+
# such as normalize_doi(), normalize_ror(), etc.
|
|
1094
|
+
for identifier in ['DOI', 'ROR', 'ORCID', 'ISNI', 'OPENALEX',
|
|
1095
|
+
'SCOPUS_AUTHOR_ID', 'RESEARCHER_ID', 'DIGITAL_AUTHOR_ID',
|
|
1096
|
+
'EMAIL']:
|
|
1097
|
+
function_name = f'normalize_{identifier.lower()}'
|
|
1098
|
+
if not callable(globals().get(function_name)):
|
|
1099
|
+
print('normalize_identifiers(): Error, function "' + function_name + '"')
|
|
1100
|
+
print(' does not exist, exiting.')
|
|
1101
|
+
exit(1)
|
|
1102
|
+
|
|
1103
|
+
if identifier in df_mod.columns:
|
|
1104
|
+
df_mod[identifier] = df_mod[identifier].apply(
|
|
1105
|
+
lambda x: globals()[function_name](x) if isinstance(x, str) else x)
|
|
1106
|
+
return df_mod
|
|
1107
|
+
|
|
1108
|
+
|
|
930
1109
|
def create_history_line(property_name: str, old_value: str, new_value: str) -> str:
|
|
931
1110
|
"""Create a line to be used in the 'history' property of a node.
|
|
932
1111
|
"""
|
|
@@ -2798,69 +2977,154 @@ def get_commandline_argument(argument: str, argument_list: list) -> str:
|
|
|
2798
2977
|
return ''
|
|
2799
2978
|
|
|
2800
2979
|
|
|
2980
|
+
def get_commandline_argument_organization(argument_list: list) -> str:
|
|
2981
|
+
"""Get the value of a command line argument '--organization'.
|
|
2982
|
+
Prompt if no argument is given.
|
|
2983
|
+
|
|
2984
|
+
:param argument_list: the argument list.
|
|
2985
|
+
:return: the organization, or '' if no answer is given.
|
|
2986
|
+
"""
|
|
2987
|
+
answer = get_commandline_argument(argument='--organization',
|
|
2988
|
+
argument_list=argument_list)
|
|
2989
|
+
if answer == '':
|
|
2990
|
+
print('\nYou need to specify an organization abbreviation.')
|
|
2991
|
+
print('This script will be run for that organization.')
|
|
2992
|
+
print('The organization abbreviation you enter will determine')
|
|
2993
|
+
print('which parameters will be read from the Ricgraph ini file')
|
|
2994
|
+
print('"' + get_ricgraph_ini_file() + '".')
|
|
2995
|
+
print('If you make a typo, you can run this script again.')
|
|
2996
|
+
print('If you enter an empty value, this script will exit.')
|
|
2997
|
+
answer = input('For what organization do you want to run this script? ')
|
|
2998
|
+
if answer == '':
|
|
2999
|
+
return ''
|
|
3000
|
+
|
|
3001
|
+
answer = answer.upper()
|
|
3002
|
+
return answer
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
def get_commandline_argument_empty_ricgraph(argument_list: list) -> str:
|
|
3006
|
+
"""Get the value of a command line argument '--empty_ricgraph'.
|
|
3007
|
+
Prompt if no argument is given.
|
|
3008
|
+
|
|
3009
|
+
:param argument_list: the argument list.
|
|
3010
|
+
:return: 'yes' or 'no', the answer whether to empty Ricgraph,
|
|
3011
|
+
or '' if no answer is given.
|
|
3012
|
+
"""
|
|
3013
|
+
answer = get_commandline_argument(argument='--empty_ricgraph',
|
|
3014
|
+
argument_list=argument_list)
|
|
3015
|
+
if answer == '':
|
|
3016
|
+
print('\nDo you want to empty Ricgraph? You have the following options:')
|
|
3017
|
+
print('- "yes": Ricgraph will be emptied.')
|
|
3018
|
+
print('- "no": Ricgraph will not be emptied.')
|
|
3019
|
+
print('- any other answer: Ricgraph will not be emptied,')
|
|
3020
|
+
print(' execution of this script will abort.')
|
|
3021
|
+
answer = input('Please make a choice: ')
|
|
3022
|
+
if answer == '':
|
|
3023
|
+
return ''
|
|
3024
|
+
|
|
3025
|
+
answer = answer.lower()
|
|
3026
|
+
if answer != 'yes' and answer != 'no':
|
|
3027
|
+
return ''
|
|
3028
|
+
return answer
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
def get_commandline_argument_harvest_projects(argument_list: list) -> str:
|
|
3032
|
+
"""Get the value of a command line argument '--harvest_projects'.
|
|
3033
|
+
Prompt if no argument is given.
|
|
3034
|
+
|
|
3035
|
+
:param argument_list: the argument list.
|
|
3036
|
+
:return: 'yes' or 'no', the answer whether to harvest projects,
|
|
3037
|
+
or '' if no answer is given.
|
|
3038
|
+
"""
|
|
3039
|
+
answer = get_commandline_argument(argument='--harvest_projects',
|
|
3040
|
+
argument_list=argument_list)
|
|
3041
|
+
if answer == '':
|
|
3042
|
+
print('\nYou can specify whether you want to harvest projects.')
|
|
3043
|
+
print('Only if enter "yes", this script will harvest projects.')
|
|
3044
|
+
answer = input('Do you want to harvest projects? ')
|
|
3045
|
+
if answer == '':
|
|
3046
|
+
return ''
|
|
3047
|
+
|
|
3048
|
+
answer = answer.lower()
|
|
3049
|
+
if answer != 'yes' and answer != 'no':
|
|
3050
|
+
return ''
|
|
3051
|
+
return answer
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
def get_configfile_key(section: str, key: str) -> str:
|
|
3055
|
+
"""Get the value of a key in the Ricgraph config file.
|
|
3056
|
+
|
|
3057
|
+
:param section: the section where the key is to be read from.
|
|
3058
|
+
:param key: the name of the key.
|
|
3059
|
+
:return: the value of the key (can be ''), or '' if absent.
|
|
3060
|
+
"""
|
|
3061
|
+
config = configparser.ConfigParser()
|
|
3062
|
+
config.read(get_ricgraph_ini_file())
|
|
3063
|
+
try:
|
|
3064
|
+
value = config[section][key]
|
|
3065
|
+
except KeyError:
|
|
3066
|
+
return ''
|
|
3067
|
+
|
|
3068
|
+
return value
|
|
3069
|
+
|
|
3070
|
+
|
|
2801
3071
|
# ############################################
|
|
2802
3072
|
# ################### main ###################
|
|
2803
3073
|
# ############################################
|
|
2804
3074
|
# This will be executed on module initialization
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
print('Ricgraph initialization: error, ricgraph_properties_standard and/or')
|
|
2823
|
-
print(' ricgraph_properties_hidden and/or ricgraph_properties_additional')
|
|
2824
|
-
print(' are empty in Ricgraph ini file, exiting.')
|
|
2825
|
-
exit(1)
|
|
3075
|
+
RICGRAPH_PROPERTIES_STANDARD = tuple(get_configfile_key(section='Ricgraph',
|
|
3076
|
+
key='ricgraph_properties_standard').split(','))
|
|
3077
|
+
RICGRAPH_PROPERTIES_HIDDEN = tuple(get_configfile_key(section='Ricgraph',
|
|
3078
|
+
key='ricgraph_properties_hidden').split(','))
|
|
3079
|
+
RICGRAPH_PROPERTIES_ADDITIONAL = tuple(get_configfile_key(section='Ricgraph',
|
|
3080
|
+
key='ricgraph_properties_additional').split(','))
|
|
3081
|
+
if len(RICGRAPH_PROPERTIES_STANDARD) == 0 \
|
|
3082
|
+
or len(RICGRAPH_PROPERTIES_HIDDEN) == 0 \
|
|
3083
|
+
or len(RICGRAPH_PROPERTIES_ADDITIONAL) == 0 \
|
|
3084
|
+
or RICGRAPH_PROPERTIES_STANDARD[0] == '' \
|
|
3085
|
+
or RICGRAPH_PROPERTIES_HIDDEN[0] == '' \
|
|
3086
|
+
or RICGRAPH_PROPERTIES_ADDITIONAL[0] == '':
|
|
3087
|
+
print('Ricgraph initialization: error, "ricgraph_properties_standard" and/or')
|
|
3088
|
+
print(' "ricgraph_properties_hidden" and/or "ricgraph_properties_additional"')
|
|
3089
|
+
print(' are not existing or empty in Ricgraph ini')
|
|
3090
|
+
print(' file "' + get_ricgraph_ini_file() + '", exiting.')
|
|
3091
|
+
exit(1)
|
|
2826
3092
|
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
else:
|
|
2835
|
-
print('Ricgraph is using "' + RICGRAPH_NODEADD_MODE + '" for ricgraph_nodeadd_mode.')
|
|
2836
|
-
except KeyError:
|
|
2837
|
-
print('Ricgraph initialization: error, ricgraph_properties_standard and/or')
|
|
2838
|
-
print(' ricgraph_properties_hidden and/or ricgraph_properties_additional and/or ricgraph_nodeadd_mode')
|
|
2839
|
-
print(' not found in Ricgraph ini file, exiting.')
|
|
3093
|
+
# For more explanation, see file docs/ricgraph_install_configure.md,
|
|
3094
|
+
# section RICGRAPH_NODEADD_MODE.
|
|
3095
|
+
RICGRAPH_NODEADD_MODE = get_configfile_key(section='Ricgraph', key='ricgraph_nodeadd_mode')
|
|
3096
|
+
if RICGRAPH_NODEADD_MODE != 'strict' and RICGRAPH_NODEADD_MODE != 'lenient':
|
|
3097
|
+
print('Ricgraph initialization: error, not existing or unknown value "' + RICGRAPH_NODEADD_MODE + '"')
|
|
3098
|
+
print(' for "ricgraph_nodeadd_mode" in Ricgraph ini')
|
|
3099
|
+
print(' file "' + get_ricgraph_ini_file() + '", exiting.')
|
|
2840
3100
|
exit(1)
|
|
2841
3101
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
hostname=GRAPHDB_HOSTNAME,
|
|
2858
|
-
port=GRAPHDB_PORT)
|
|
2859
|
-
except KeyError:
|
|
2860
|
-
print('Ricgraph initialization: error, one or more of GraphDB parameters '
|
|
2861
|
-
+ 'not found in Ricgraph ini file, exiting.')
|
|
3102
|
+
print('Ricgraph is using "' + RICGRAPH_NODEADD_MODE + '" for "ricgraph_nodeadd_mode".')
|
|
3103
|
+
|
|
3104
|
+
GRAPHDB = get_configfile_key(section='GraphDB', key='graphdb')
|
|
3105
|
+
GRAPHDB_HOSTNAME = get_configfile_key(section='GraphDB', key='graphdb_hostname')
|
|
3106
|
+
GRAPHDB_DATABASENAME = get_configfile_key(section='GraphDB', key='graphdb_databasename')
|
|
3107
|
+
GRAPHDB_USER = get_configfile_key(section='GraphDB', key='graphdb_user')
|
|
3108
|
+
GRAPHDB_PASSWORD = get_configfile_key(section='GraphDB', key='graphdb_password')
|
|
3109
|
+
GRAPHDB_SCHEME = get_configfile_key(section='GraphDB', key='graphdb_scheme')
|
|
3110
|
+
GRAPHDB_PORT = get_configfile_key(section='GraphDB', key='graphdb_port')
|
|
3111
|
+
if GRAPHDB == '' or GRAPHDB_HOSTNAME == '' or GRAPHDB_DATABASENAME == '' \
|
|
3112
|
+
or GRAPHDB_USER == '' or GRAPHDB_PASSWORD == '' \
|
|
3113
|
+
or GRAPHDB_SCHEME == '' or GRAPHDB_PORT == '':
|
|
3114
|
+
print('Ricgraph initialization: error, one or more of the GraphDB parameters')
|
|
3115
|
+
print(' not existing or empty in Ricgraph ini')
|
|
3116
|
+
print(' file "' + get_ricgraph_ini_file() + '", exiting.')
|
|
2862
3117
|
exit(1)
|
|
2863
3118
|
|
|
3119
|
+
GRAPHDB_URL = '{scheme}://{hostname}:{port}'.format(scheme=GRAPHDB_SCHEME,
|
|
3120
|
+
hostname=GRAPHDB_HOSTNAME,
|
|
3121
|
+
port=GRAPHDB_PORT)
|
|
3122
|
+
|
|
2864
3123
|
# Make sure DataFrames are printed with all columns on full width
|
|
2865
3124
|
pandas.set_option('display.max_columns', None)
|
|
2866
3125
|
pandas.set_option('display.width', 500)
|
|
3126
|
+
# To prevent warning
|
|
3127
|
+
# "FutureWarning: Downcasting behavior in `replace` is deprecated and will be removed
|
|
3128
|
+
# in a future version. To retain the old behavior, explicitly call `result.infer_objects(copy=False)`.
|
|
3129
|
+
# To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`"
|
|
3130
|
+
pandas.set_option('future.no_silent_downcasting', True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|