turbomam/examples-first-cookiecutter

Some LinkML tools can't handle collections with elements that have only one slot populated

Opened this issue · 0 comments

One part of make test:

poetry run python -m unittest discover

Can't instantiate the following:

entries:
  - id: example:Thing001
  - id: example:Thing002

/Users/MAM/Documents/gitrepos/linkml-projects/identifiers-sandbox/tests/../src/data/examples/valid/NamedThingCollection-single-slot.yaml
E
======================================================================
ERROR: test_data (tests.test_valid_collections.TestData)
Date test.


Traceback (most recent call last):
File "/Users/MAM/Documents/gitrepos/linkml-projects/identifiers-sandbox/tests/test_valid_collections.py", line 27, in test_data
obj = yaml_loader.load(path, target_class=NamedThingCollection)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/loaders/loader_root.py", line 85, in load
results = self.load_any(*args, **kwargs)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/loaders/yaml_loader.py", line 32, in load_any
return self.load_source(source, loader, target_class, accept_header="text/yaml, application/yaml;q=0.9",
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/loaders/loader_root.py", line 66, in load_source
return target_class(**data_as_dict)
File "", line 4, in init
File "/Users/MAM/Documents/gitrepos/linkml-projects/identifiers-sandbox/src/identifiers_sandbox/datamodel/identifiers_sandbox.py", line 96, in post_init
self._normalize_inlined_as_list(slot_name="entries", slot_type=NamedThing, key_name="id", keyed=True)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/utils/yamlutils.py", line 97, in _normalize_inlined_as_list
self._normalize_inlined(slot_name, slot_type, key_name, keyed, True)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/utils/yamlutils.py", line 173, in _normalize_inlined
order_up(list_entry[lek], slot_type(list_entry))
File "", line 6, in init
File "/Users/MAM/Documents/gitrepos/linkml-projects/identifiers-sandbox/src/identifiers_sandbox/datamodel/identifiers_sandbox.py", line 70, in post_init
self.id = NamedThingId(self.id)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/identifiers-sandbox-c7uJR0Fx-py3.10/lib/python3.10/site-packages/linkml_runtime/utils/metamodelcore.py", line 100, in init
raise ValueError(f"{v} is not a valid URI or CURIE")
ValueError: JsonObj(id='example:Thing001') is not a valid URI or CURIE