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

Add missing values controlled vocabularies as union of ranges #9

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cpauvert
Copy link
Contributor

@cpauvert cpauvert commented Jun 27, 2023

This should is related to #4 but there is an issue with the validation of the data.

linkml-validate \
   -s src/miiid_schema/schema/miiid_schema.yaml \
   -C IntermicrobialInteraction\
    src/data/examples/valid/IntermicrobialInteraction-pairwise-with-missing-data.yaml

fails with:

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 167, in cli
    results = validator.validate_object(obj, target_class=py_target_class)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/linkml/validators/jsonschemavalidator.py", line 68, in validate_object
    return jsonschema.validate(inst_dict, schema=jsonschema_obj, format_checker=jsonschema.Draft7Validator.FORMAT_CHECKER)
  File "/home/cpauvert/.cache/pypoetry/virtualenvs/miiid-schema-6-7ZvLG3-py3.9/lib/python3.9/site-packages/jsonschema/validators.py", line 1121, in validate
    raise error
jsonschema.exceptions.ValidationError: '1236' is not one of ['NOT_APPLICABLE', 'NOT_COLLECTED', 'NOT_PROVIDED', 'RESTRICTED_ACCESS']

Failed validating 'enum' in schema[1]:
    {'description': 'List of missing values reporting terms according '
                    'based on the International Nucleotide Sequence '
                    'Database Collaboration (INSDC )',
     'enum': ['NOT_APPLICABLE',
              'NOT_COLLECTED',
              'NOT_PROVIDED',
              'RESTRICTED_ACCESS'],
     'title': 'MissingValue',
     'type': 'string'}

On instance:
    '1236'

This could be due to the fact that the any_of is applied to an enum : MissingValue and a custom type NCBITaxId.

tax_id:
required: true
any_of:
- range: NCBITaxId
- range: MissingValue
multivalued: true
description: NCBI Taxonomy identifiers at the relevant taxonomic level.
comments: For novel taxa lacking identifiers, please use the controlled vocabulary NOT_PROVIDED.

@cpauvert cpauvert self-assigned this Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant