biolink / biolinkml

DEPRECATED: replaced by linkml
https://github.com/linkml/linkml
Creative Commons Zero v1.0 Universal
23 stars 12 forks source link

gen-owl failing in 1.5.3 #214

Closed cmungall closed 4 years ago

cmungall commented 4 years ago

gen-owl is failing for all my schemas in 1.5.3

this replicates the error:

id: t
name: t

license: https://creativecommons.org/publicdomain/zero/1.0/
version: 0.0.1

prefixes:
  t: http://w3id.org/t
  biolinkml: https://w3id.org/biolink/biolinkml/

default_prefix: t
default_range: string

imports:
  - biolinkml:types

classes:
  a:
 gen-owl t.yaml
/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/__init__.py:158: UserWarning: Some URL processing will fail with python 3.7.5 or earlier.  Current version: sys.version_info(major=3, minor=7, micro=1, releaselevel='final', serial=0)
  warn(f"Some URL processing will fail with python 3.7.5 or earlier.  Current version: {sys.version_info}")
Traceback (most recent call last):
  File "/Users/cjm/repos/ontology-change-language/venv/bin/gen-owl", line 11, in <module>
    sys.exit(cli())
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/generators/owlgen.py", line 278, in cli
    print(OwlSchemaGenerator(yamlfile, **kwargs).serialize(**kwargs))
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/generators/owlgen.py", line 38, in __init__
    self.metamodel.resolve()
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/utils/schemaloader.py", line 124, in resolve
    self.raise_value_error(f'Class "{cls.name}" - unknown slot: "{slotname}"', slotname)
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/utils/schemaloader.py", line 557, in raise_value_error
    raise ValueError(f'{"" if loc_str is None or not getattr(loc_str, "loc") else (loc_str.loc() + " ")} {error}')
  File "/Users/cjm/repos/ontology-change-language/venv/lib/python3.7/site-packages/biolinkml/utils/yamlutils.py", line 112, in loc
    return f'File "{self._s.name}", line {self._s.line + 1}, col {self._s.column + 1}'
AttributeError: 'NoneType' object has no attribute 'name'

When I debug schemaloader, it appears to be failing here:

Class "extensible" - unknown slot: "e" e

unclear why this only manifests in gen-owl

also curious as to how this bug escaped - we have a pretty serious set of unit tests....

cmungall commented 4 years ago

OK, this appears to be fixed on master. However, the bug is present in https://github.com/biolink/biolinkml/releases/tag/v1.5.3

hsolbrig commented 4 years ago

I recollect that this bug was introduced in the last set of changes to the owlgen module but wasn't caught by any of the existing unit tests. I also recollect that we added a test for it once we found it and fixed it in the latest version.

Would welcome more find-grained owl unit tests -- at the moment they are mostly macro level -- generate biolinkml.owl, biolink-model.owl and a couple of others and compare the new output to the old. The issue with tests of that sort is that a lot of things can make the new output change and unless someone gives the changes a close look, bugs can slip by.

cmungall commented 4 years ago

We have test_issue_163.py, which is pretty good. I'm pretty confused about how my example at the top of this issue fails yet issue_163.yaml presumably succeeded.

It's quite possible I'm doing something dumb here...

hsolbrig commented 4 years ago

Seems that we've captured an unstable state in the 1.5.3 release -- will look at why it only impacts OWL.

hsolbrig commented 4 years ago

This only impacts OWL because OWL is the only generator parses a copy of 'https://w3id.org/biolink/biolinkml/meta.yaml' . Meta.yaml comes from the main branch of biolinkml and, in the process of adding the annotations, we started using a couple of aspects of the model that hadn't been completely debugged. The bug you are seeing is one we fixed while adding the annotations.

The short term solution is to release the 1.5.4 distro. The long term solution is to figure out why the OWL generator is parsing the meta.yaml model and either a) localize the source or b) figure out what it uses and make it static.

This does lead to a more foundational problem: I think we will need to support versioning on biolink models themselves. Will create a new issue for this. https://github.com/biolink/biolinkml/issues/217

hsolbrig commented 4 years ago

Issue #251 further addresses this problem. Closing and moving to there