Skip to content

Commit

Permalink
Create Java/RDFRules directories if they don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
kdouda committed Jan 9, 2025
1 parent 9766fee commit efad618
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pyrdfrules/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Karel Douda <kareldouda1@gmail.com>
#
# SPDX-License-Identifier: MIT
__version__ = "0.0.9"
__version__ = "0.0.11"
9 changes: 9 additions & 0 deletions src/pyrdfrules/engine/util/jvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def setup(rdf_rules_path: str = '', jvm_path: str = '', workspace_path: str|Path
global _workspace_path
_workspace_path = str(workspace_path)

if not os.path.exists(_workspace_path):
os.makedirs(_workspace_path, exist_ok=True)

if not os.path.exists(_rdfrules_path):
os.makedirs(_rdfrules_path, exist_ok=True)

if _jvm_path and not os.path.exists(_jvm_path):
os.makedirs(_jvm_path, exist_ok=True)

pass

def get_jvm_path() -> str:
Expand Down
3 changes: 3 additions & 0 deletions src/tests/test_local_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def get_path(file_name):
# from https://stackoverflow.com/questions/16694907/download-large-file-in-python-with-requests
def download_file(url, file_name, base_path):
file_path = os.path.join(base_path, "dbpedia_yago", file_name)

os.makedirs(os.path.join(base_path, "dbpedia_yago"), exist_ok=True)

print(file_path)
# check if the file already exists
if os.path.exists(file_path):
Expand Down

0 comments on commit efad618

Please sign in to comment.