bridge2ai / standards-schemas

Data schema for Bridge2AI Standards.
https://bridge2ai.github.io/standards-schemas/
MIT License
2 stars 2 forks source link

Set up example data #5

Closed caufieldjh closed 1 year ago

caufieldjh commented 1 year ago

Example data doesn't quite parse yet - when hitting the multivalued relevance_to_dgps slot, it hits a snag:

Traceback (most recent call last):
  File "/home/harry/standards-schemas/tests/test_data.py", line 20, in test_data
    obj = yaml_loader.load(path, target_class=UseCase)
  File "/home/harry/standards-schemas/.venv/lib/python3.9/site-packages/linkml_runtime/loaders/loader_root.py", line 85, in load
    results = self.load_any(*args, **kwargs)
  File "/home/harry/standards-schemas/.venv/lib/python3.9/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 "/home/harry/standards-schemas/.venv/lib/python3.9/site-packages/linkml_runtime/loaders/loader_root.py", line 66, in load_source
    return target_class(**data_as_dict)
  File "<string>", line 18, in __init__
  File "/home/harry/standards-schemas/src/standards_schemas/datamodel/standards_usecase_schema.py", line 124, in __post_init__
    self.relevance_to_dgps = DataGeneratingProject(self.relevance_to_dgps)
  File "/home/harry/standards-schemas/.venv/lib/python3.9/site-packages/linkml_runtime/utils/enumerations.py", line 46, in __init__
    if key not in self.__class__ and self._defn.code_set:
  File "/home/harry/standards-schemas/.venv/lib/python3.9/site-packages/linkml_runtime/utils/enumerations.py", line 28, in __contains__
    return item in cls.__dict__
TypeError: unhashable type: 'list'

This could be due to the DGPs being modeled as an enum rather than specific entities, so there may be a solution involving inlining.

This slot definitely needs to be multivalued, though - and that seems to be the core of the error, as self.relevance_to_dgps = DataGeneratingProject(self.relevance_to_dgps) doesn't seem like it would allow for that.

cmungall commented 1 year ago

removing the is_a to node property will fix, because node property is not multivalued

caufieldjh commented 1 year ago

Removing the is_a: node property here leads to the same TypeError: unhashable type: 'list' Possibly an issue with how the yaml_loader works, as linkml-validate is much more helpful, as long as it's told about the target class of the data:

linkml-validate -s src/standards_schemas/schema/standards_usecase_schema.yaml -C UseCase src/data/examples/UseCase.yaml
caufieldjh commented 1 year ago

DataSubstrate schema example doesn't validate yet because the schema doesn't accept a string as valid. The metadata_storage slot will need to accept something other than a URI.

(probably need to define with any_of and an enum; see https://linkml.io/linkml/schemas/advanced.html)

caufieldjh commented 1 year ago

The DataStandardOrTool example isn't validating because:

Unknown StandardsCollectionTag enumeration code: Data Model

It needs to be datamodel.

After that fix, the validation errors are:

Unknown argument: concerns data topic = ['STANDARDSDATATOPIC:4']
Unknown argument: has relevant organization = ['STANDARDSORGANIZATION:76']

(fixed)