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

607 _check_duplicate_labels in ontology parser raises Keyerror #608

Merged
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
10 changes: 5 additions & 5 deletions osp/core/ontology/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ def labels_for_iri(iri):
in labels_for_iri(iri))
labels, iris = tuple(result[0] for result in results),\
tuple(result[1] for result in results)
coincidence_search = (i
for i in range(1, len(labels))
if labels[i - 1] == labels[i])
coincidence_search = tuple(i
for i in range(1, len(labels))
if labels[i - 1] == labels[i])
conflicting_labels = {labels[i]: set() for i in coincidence_search}
for i in range(1, len(conflicting_labels)):
yoavnash marked this conversation as resolved.
Show resolved Hide resolved
for i in coincidence_search:
conflicting_labels[labels[i]] |= {iris[i - 1], iris[i]}
if len(conflicting_labels) > 0:
texts = (f'{label[0]}, language{label[1]}: '
texts = (f'{label[0]}, language {label[1]}: '
f'{", ".join(tuple(str(iri) for iri in iris))}'
for label, iris in conflicting_labels.items())
raise KeyError(f'The following labels are assigned to more than '
Expand Down