mapping-commons/sssom-py

get_prefixes_used_in_metadata breaks when using URIs in the *_source columns

Closed this issue · 0 comments

From a discussion with @cthoyt on the sssom Slack channel:

https://github.com/mapping-commons/sssom-py/blob/fda75658f687171cc2de439fae9faa64620e7a97/src/sssom/util.py#L1119C1-L1130C20 breaks when you use URIs in the subject_source and object_source columns.

version: sssom, version 0.3.41

Steps needed to reproduce the issue:

Download the files:

And run:
sssom parse ENMO_mappings.tsv -m ENMO_mapping_set.YAML -o enmo.sssom.tsv

WARNING:root:https is used in the SSSOM mapping set but it does not exist in the prefix map
WARNING:root:http is used in the SSSOM mapping set but it does not exist in the prefix map
Traceback (most recent call last):
  File "/home/javier/miniconda3/bin/sssom", line 8, in <module>
    sys.exit(main())
  File "/home/javier/miniconda3/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/javier/miniconda3/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/javier/miniconda3/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/javier/miniconda3/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/javier/miniconda3/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/javier/miniconda3/lib/python3.9/site-packages/sssom/cli.py", line 215, in parse
    parse_file(
  File "/home/javier/miniconda3/lib/python3.9/site-packages/sssom/io.py", line 112, in parse_file
    doc.clean_prefix_map(strict=strict_clean_prefixes)
  File "/home/javier/miniconda3/lib/python3.9/site-packages/sssom/util.py", line 185, in clean_prefix_map
    raise ValueError(
ValueError: ['https', 'http'] are used in the SSSOM mapping set but it does not exist in the prefix map