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

lint vs. validate conflict: linter-recommended EDAM.TOPIC prefix fails validation but linter-disapproved EDAM_TOPIC works: #1512

Open
cpauvert opened this issue Jun 27, 2023 · 4 comments
Assignees
Labels
bug Something that should work but isn't, with an example and a test case. community-generated linkml-validate linting

Comments

@cpauvert
Copy link

Describe the bug
Hello!
I have an issue with the prefix for the EDAM ontology when using meaning in an enum. I followed the the convention in biolink with EDAM_TOPIC but this raised issue with validation (details below)

TL;DR:

  • with prefix EDAM_TOPIC: linkml-lint FAIL ; linkml-validate PASS
  • with prefix EDAM.TOPIC: linkml-lint PASS ; linkml-validate FAIL

The linter has a default configuration with regards to prefixmaps.

Should I follow the convention in biolink with EDAM_TOPIC and ignore the lint?
because it seems that EDAM.TOPIC is converted to the python:

meaning=EDAM-TOPIC["3524"]

which causes a NameError: name 'EDAM' is not defined.

Best regards,

Details:

See more with prefix `EDAM_TOPIC`: linkml-lint FAIL ; linkml-validate PASS

https://github.com/FAIR-MI/miiid-schema/blob/410aeb29afd3e81961ecc45a534f59077b651222/src/miiid_schema/schema/miiid_schema.yaml#LL17

Linting

$ make lint
poetry run linkml-lint src/miiid_schema/schema/miiid_schema.yaml
/home/cpauvert/projects/linkml-projects/miiid-schema/src/miiid_schema/schema/miiid_schema.yaml
  warning  Schema maps prefix 'EDAM_TOPIC' to namespace 'http://edamontology.org/topic_' instead of using prefix 'EDAM.TOPIC'  (canonical_prefixes)

✖ Found 1 problem in 1 schema
make: *** [Makefile:119: lint] Error 1

Validation

linkml-validate -s src/miiid_schema/schema/miiid_schema.yaml -C IntermicrobialInteraction \
  src/data/examples/valid/IntermicrobialInteraction-pairwise.yaml 
# None
See more with prefix `EDAM.TOPIC`: linkml-lint PASS ; linkml-validate FAIL

https://github.com/FAIR-MI/miiid-schema/blob/26460cd64769ddb87ac4a2f471ef7bb2c0f07fdd/src/miiid_schema/schema/miiid_schema.yaml#L17

Linting

$ make lint
poetry run linkml-lint src/miiid_schema/schema/miiid_schema.yaml
✓ No problems found

Validation

linkml-validate -s src/miiid_schema/schema/miiid_schema.yaml -C IntermicrobialInteraction \
  src/data/examples/valid/IntermicrobialInteraction-pairwise.yaml 
ERROR:root:Error compiling generated python code: name 'EDAM' is not defined
Traceback (most recent call last):
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/bin/linkml-validate", line 8, in <module>
    sys.exit(cli())
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/linkml/validators/jsonschemavalidator.py", line 135, in cli
    python_module = PythonGenerator(schema).compile_module()
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/linkml/generators/pythongen.py", line 81, in compile_module
    raise e
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/linkml/generators/pythongen.py", line 77, in compile_module
    return compile_python(pycode)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/linkml_runtime/utils/compile_python.py", line 47, in compile_python
    exec(spec, module.__dict__)
  File "test", line 169, in <module>
  File "test", line 176, in MethodType
NameError: name 'EDAM' is not defined

with one of the faulty line being probably:

simulation = PermissibleValue( text="simulation",                                                                                                                        
        description="Any type of biological computational model experiments", meaning=EDAM-TOPIC["3524"])     
@cpauvert cpauvert added the bug Something that should work but isn't, with an example and a test case. label Jun 27, 2023
@cpauvert
Copy link
Author

This issues happened with linkml v1.5.5 and remains despite updating to 1.5.6.

@sierra-moxon sierra-moxon self-assigned this Jul 26, 2023
@sierra-moxon
Copy link
Member

Hi Charlie - thanks for the detailed issue; I’ll take a look.

@sierra-moxon
Copy link
Member

@cpauvert - short answer, Biolink should be updated to use the edam.topic prefix following the conventions in bioregistry.io. but, this does mean linkml-validate will fail as you have demonstrated. I'm working on a couple of PRs to fix this behavior (see above).

@cpauvert
Copy link
Author

cpauvert commented Aug 9, 2023

Thanks @sierra-moxon for the heads-up, let me know how and when I should try out your edits!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that should work but isn't, with an example and a test case. community-generated linkml-validate linting
Projects
None yet
Development

No branches or pull requests

3 participants