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

_check_duplicate_labels in ontology parser raises Keyerror #607

Closed
MBueschelberger opened this issue Apr 13, 2021 · 2 comments · Fixed by #608
Closed

_check_duplicate_labels in ontology parser raises Keyerror #607

MBueschelberger opened this issue Apr 13, 2021 · 2 comments · Fixed by #608
Assignees
Labels

Comments

@MBueschelberger
Copy link
Member

MBueschelberger commented Apr 13, 2021

When installing an inferred EMMO-onology with osp-core v3.5.2 and this configuration file, I get the following traceback:

root@74b5473bc5ad:/shared/cfd-ontology/application/inferred-ontologies# pico install gmshwrapper.yml 
INFO 2021-04-13 10:56:04,465 [osp.core.ontology.installation]: Will install the following namespaces: ['emmo']
INFO 2021-04-13 10:56:04,471 [osp.core.ontology.parser]: Parsing gmshwrapper.yml
INFO 2021-04-13 10:56:04,471 [osp.core.ontology.parser]: Parsing gmshwrapper-inferred.owl
ERROR 2021-04-13 10:56:06,349 [osp.core.pico]: An Exception occurred during installation.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/osp/core/pico.py", line 63, in install_from_terminal
    ontology_installer.install(*args.files)
  File "/usr/local/lib/python3.6/site-packages/osp/core/ontology/installation.py", line 34, in install
    self._install(files, self._get_new_packages, False)
  File "/usr/local/lib/python3.6/site-packages/osp/core/ontology/installation.py", line 149, in _install
    parser.parse(file)
  File "/usr/local/lib/python3.6/site-packages/osp/core/ontology/parser.py", line 63, in parse
    file=f)
  File "/usr/local/lib/python3.6/site-packages/osp/core/ontology/parser.py", line 270, in _parse_rdf
    self._check_duplicate_labels(iri, identifier)
  File "/usr/local/lib/python3.6/site-packages/osp/core/ontology/parser.py", line 378, in _check_duplicate_labels
    conflicting_labels[labels[i]] |= {iris[i - 1], iris[i]}
KeyError: ('AbsorbedDose', 'en')
ERROR 2021-04-13 10:56:06,350 [osp.core.pico]: Consider running 'pico --log-level debug install ...'

The error obviously occurs in the _check_duplicate_labels of the osp.core.ontology.parser, even though AbsorbedDose only appears once as skos:prefLabel in the inferred-gmshwrapper.owl.

The error is obviously not related to the global SimPhoNy-graph, since it also appears if no other ontology is installed so far.

See the pico list:

root@74b5473bc5ad:/shared/cfd-ontology/application/inferred-ontologies# pico list
Packages:

Namespaces:
        - xml
        - rdf
        - rdfs
        - xsd
        - owl
        - cuba

While running the same command ("pico install --overwrite gmshwrapper.yml ") in the cli for osp-core v3.5.1, the installation works seamessly.

@kysrpex
Copy link
Contributor

kysrpex commented Apr 13, 2021

Note to self and other developers: this is NOT a duplicate of issue #593.

There indeed a bug in the code that makes it not show the actual traceback that should be shown when there are duplicate labels. I have created pull request #608 to fix this bug.

This does not mean that there are not any items with duplicate labels, just that the wrong error is being thrown. You can try to install the ontology again with the first commit of the pull request to find the offenders. Just clone the OSP-core repository, enter it and git fetch && git checkout 2da6b87 && pip uninstall -y osp-core && pip install ., then you will get the correct traceback listing the offenders.

@kysrpex
Copy link
Contributor

kysrpex commented Apr 13, 2021

As the changes on the pull request branch are working correctly, I am closing the issue.

@kysrpex kysrpex closed this as completed Apr 13, 2021
kysrpex added a commit that referenced this issue Apr 13, 2021
Fixes a bug that makes OSP-core fail before raising the actual intended exception when duplicate labels are found during the installation of an ontology (see issue #607).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants