Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand repairs in convert_owl #213

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions kg_obo/robot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def convert_owl(robot_path: str, input_owl: str, output: str, robot_env: dict) -
success = True
except sh.ErrorReturnCode_1 as e: # If ROBOT runs but returns an error
print(f"ROBOT encountered an error: {e}")
print(f"Will try to repair...")
print("Will try to repair by removing object properties...")
try:
robot_command('remove',
'--input', input_owl,
Expand All @@ -118,6 +118,7 @@ def convert_owl(robot_path: str, input_owl: str, output: str, robot_env: dict) -
success = True
except sh.ErrorReturnCode_1 as e:
print(f"ROBOT encountered another error: {e}")
print("Will try to repair by removing comments..")
try:
robot_command('remove',
'--input', input_owl,
Expand All @@ -128,7 +129,18 @@ def convert_owl(robot_path: str, input_owl: str, output: str, robot_env: dict) -
success = True
except sh.ErrorReturnCode_1 as e:
print(f"ROBOT encountered yet another error: {e}")
success = False
print("Will try to repair by removing IAO:0000115...")
try:
robot_command('remove',
'--input', input_owl,
'--exclude-term', 'IAO:0000115',
'--output', output,
_env=robot_env,
)
success = True
except sh.ErrorReturnCode_1 as e:
print(f"ROBOT encountered yet a further error: {e}")
return False

# Neutralize invalid prefixes.
print("Replacing any invalid prefixes...")
Expand Down
Loading