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

Warning relation excelparser #366

Merged
merged 10 commits into from
Mar 2, 2022
12 changes: 10 additions & 2 deletions ontopy/excelparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,12 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
)

# Add properties in a second loop

for index in added_rows:
row = data.loc[index]
properties = row["Relations"]
if properties == "nan":
properties = None
if isinstance(properties, str):
try:
concept = onto.get_by_label(row["prefLabel"].strip())
Expand All @@ -301,10 +304,15 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
f"Error is {exc}."
)
except NoSuchLabelError as exc:
msg = (
f"Error in Property assignment for: {concept}. "
f"Property to be Evaluated: {prop}. "
f"Error is {exc}."
)
if force is True:
pass
warnings.warn(msg)
else:
raise ExcelError(exc) from exc
raise ExcelError(msg) from exc

# Synchronise Python attributes to ontology
onto.sync_attributes(
Expand Down