biolink / biolink-model

Schema and generated objects for biolink data model and upper ontology
https://biolink.github.io/biolink-model/
Other
169 stars 71 forks source link

BMT bug when intializing toolkit against v2.4.2-alpha-qualifiers release #1044

Closed YaphetKG closed 1 year ago

YaphetKG commented 2 years ago

Describe the bug When using the v2.4.2-alpha-qualifiers release, biolink model toolkit (v0.8.4) seems to fail. In the model in that release (biolink-model.yaml) there are a couple of imports that are not downloaded to local by bmt. To Reproduce

tk = Toolkit('https://raw.githubusercontent.com/biolink/biolink-model/v2.4.2-alpha-qualifiers/biolink-model.yaml')
Traceback (most recent call last):
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\IPython\core\interactiveshell.py", line 3398, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-0dd0f25e04d0>", line 1, in <cell line: 1>
    tk = Toolkit('https://raw.githubusercontent.com/biolink/biolink-model/v2.4.2-alpha-qualifiers/biolink-model.yaml')
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\bmt\toolkit.py", line 43, in __init__
    self.generator = ToolkitGenerator(schema)
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\bmt\toolkit_generator.py", line 32, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml\utils\generator.py", line 95, in __init__
    loader.resolve()
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml\utils\schemaloader.py", line 102, in resolve
    load_raw_schema(sname + '.yaml',
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml\utils\rawloader.py", line 69, in load_raw_schema
    schema = yaml_loader.load(copy.deepcopy(data) if isinstance(data, dict) else data,
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml_runtime\loaders\loader_root.py", line 85, in load
    results = self.load_any(*args, **kwargs)
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml_runtime\loaders\yaml_loader.py", line 25, in load_any
    return self.load_source(source, loader, target_class, accept_header="text/yaml, application/yaml;q=0.9",
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\linkml_runtime\loaders\loader_root.py", line 58, in load_source
    data = hbread(source, metadata, metadata.base_path, accept_header)
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\hbreader\__init__.py", line 260, in hbread
    with hbopen(source, open_info, base_path, accept_header, is_actual_data, read_codec) as f:
  File "C:\Users\kebedey\projects\venvs\bl_lookup\lib\site-packages\hbreader\__init__.py", line 206, in hbopen
    f = open(fname, encoding=read_codec if read_codec else 'utf-8')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\kebedey\\projects\\translator\\sri\\bl_lookup\\enums.yaml'

Expected behavior BMT toolkit should be able to startup from this version.

What working group (or team) did this request originate from? SRI

Note: This is relevant for members of NCATS Translator.

sierra-moxon commented 1 year ago

I think this was a result of me breaking up the model into pieces. I reverted that change for now and I'm working on a solution that allows me to break up the schema file into modules, and then recreate the one file as a build artifact. I tested BMT on the 3.0 release (3.0 release has the actual model changes from that branch, albeit not the technical breaking up of model files). closing for now; please reopen if you want this specific branch to work. https://github.com/sierra-moxon/biolink-model-doc has the experiments in breaking up the file.