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
9 changes: 8 additions & 1 deletion 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

sygout marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -304,8 +307,12 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
if force is True:
sygout marked this conversation as resolved.
Show resolved Hide resolved
pass
sygout marked this conversation as resolved.
Show resolved Hide resolved
else:
warnings.warn(
sygout marked this conversation as resolved.
Show resolved Hide resolved
f"Error in Property assignment for: {concept}. "
f"Property to be Evaluated: {prop}. "
f"Error is {exc}.")
raise ExcelError(exc) from exc
sygout marked this conversation as resolved.
Show resolved Hide resolved

sygout marked this conversation as resolved.
Show resolved Hide resolved
# Synchronise Python attributes to ontology
onto.sync_attributes(
name_policy="uuid", name_prefix="EMMO_", class_docstring="elucidation"
Expand Down