files is a class level param
@@ -9,9 +9,10 @@ always_print_env_variables = {'EXAMPLES_DIR', 'USE_CASES_DIR', 'GRAPH', 'OUT', '
class ConfigureKGTK(object):
- def __init__(self, kgtk_path: str = None, input_files_url: str = None):
+ def __init__(self, file_list: List[str], kgtk_path: str = None, input_files_url: str = None):
- self.INPUT_FILES_URL = "https://github.com/usc-isi-i2/kgtk-tutorial-files/raw/main/datasets/wikidata-dwd-v2" \
+ self.files = file_list
+ self.INPUT_FILES_URL = "https://github.com/usc-isi-i2/kgtk-tutorial-files/raw/main/datasets/arnold" \
if input_files_url is None else input_files_url
self.kgtk_environment_variables = set()
@@ -106,28 +107,31 @@ class ConfigureKGTK(object):
if not graph_path.endswith('/'):
graph_path += '/'
- for key in self.graph_files:
- url = f"{self.INPUT_FILES_URL}/{self.graph_files[key]}"
+ for f in self.files:
+ if f in self.graph_files:
+ url = f"{self.INPUT_FILES_URL}/{self.graph_files[f]}"
cmd = f" wget {url} --directory-prefix={graph_path}"
print(subprocess.getoutput(cmd))
+ else:
+ print(f"File: {f} not present in files config: {self.graph_files}")
- def print_env_variables(self, file_list: List[str]):
+ def print_env_variables(self):
for key in self.kgtk_environment_variables:
if key in always_print_env_variables:
print(f"{key}: {os.environ[key]}")
- for key in file_list:
+ for key in self.files:
print(f"{key}: {os.environ[key]}")
- def load_files_into_cache(self, file_list: List[str] = None):
+ def load_files_into_cache(self):
"""
Loads files into graph cache. The keys in this list should be in json_config_file
:param file_list:
:return:
"""
kypher_command = f"{os.environ['kypher']}"
- if file_list:
- for f_key in file_list:
+
+ for f_key in self.files:
kypher_command += f" -i \"{os.environ[f_key]}\" --as {f_key} "
kypher_command += " --limit 3"
print(kypher_command)
