Skip to content

Commit

Permalink
Merge pull request #366 from emmo-repo/warning-relation-excelparser
Browse files Browse the repository at this point in the history
Warning relation excelparser
  • Loading branch information
CasperWA authored Mar 2, 2022
2 parents 6d49981 + a10b670 commit 6670b39
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit 6670b39

Please sign in to comment.