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

Error parsing linkml schema with schema annotator if linkml schema contains an Enum which used reachable_from attribute. #149

Open
proccaserra opened this issue Oct 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@proccaserra
Copy link

Describe the bug
Error parsing linkml schema with schema annotator if linkml schema contains an Enum which used reachable_from attribute.

To Reproduce
create a linkml schema with a dynamic enum using reachable_from, as in:

enums:
  NeuronTypeEnum:
    reachable_from:
      source_ontology: obo:cl

then, try invoking the enrich method over a schema_annotator instance, using a local ontology,
as in:

oi = get_adapter("sparql:../resources/my_favourite_ontology.owl")
sa = SchemaAnnotator(ontology_implementation=oi)

schema = sa.enrich("test_schema_with_dynamic_enum_reachable_from.yaml")

Expected behavior
loading the linkml schema should not fail, but currently getting the following error with linkml 1.8.3:

ValueError:  Unknown argument: ontology_source = 'local_resource:valueset'

stack trace:

File ~/venv/lib/python3.9/site-packages/linkml_runtime/linkml_model/meta.py:992, in EnumDefinition.__post_init__(self, *_, **kwargs)
    989 self.inherits = [v if isinstance(v, EnumDefinitionName) else EnumDefinitionName(v) for v in self.inherits]
    991 if self.reachable_from is not None and not isinstance(self.reachable_from, ReachabilityQuery):
--> 992     self.reachable_from = ReachabilityQuery(**as_dict(self.reachable_from))
    994 if self.matches is not None and not isinstance(self.matches, MatchQuery):
    995     self.matches = MatchQuery(**as_dict(self.matches))
File <string>:9, in __init__(self, source_ontology, source_nodes, relationship_types, is_direct, include_self, traverse_up, **_kwargs)

File ~/venv/lib/python3.9/site-packages/linkml_runtime/linkml_model/meta.py:1256, in ReachabilityQuery.__post_init__(self, *_, **kwargs)
   1253 if self.traverse_up is not None and not isinstance(self.traverse_up, Bool):
   1254     self.traverse_up = Bool(self.traverse_up)
-> 1256 super().__post_init__(**kwargs)

File ~/venv/lib/python3.9/site-packages/linkml_runtime/utils/yamlutils.py:56, in YAMLRoot.__post_init__(self, *args, **kwargs)
     54     v = repr(kwargs[k])[:40].replace('\n', '\\n')
     55     messages.append(f"{TypedNode.yaml_loc(k)} Unknown argument: {k} = {v}")
---> 56 raise ValueError('\n'.join(messages))
@proccaserra proccaserra added the bug Something isn't working label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant