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

roll down inherited props recursively #11

Open
sneakers-the-rat opened this issue Sep 10, 2024 · 0 comments
Open

roll down inherited props recursively #11

sneakers-the-rat opened this issue Sep 10, 2024 · 0 comments

Comments

@sneakers-the-rat
Copy link
Contributor

See: NeurodataWithoutBorders/pynwb#1954

Need to add a method in the NamespacesAdapter to roll down and merge all inherited properties, recursively, from parent classes.

Currently this is handled in both linkml and pydantic models via standard inheritance methods, but NWB schema lang also inherits properties from within overridden props in children, see the example here: NeurodataWithoutBorders/pynwb#1954 (comment)

So the best approach would be to roll down all attrs, datasets, and groups after loading the initial schema but before linkml generation.

There is a somewhat obnoxious ordering problem here - the related method for completing imports requires the other imported namespaces to be loaded, but since nwb schema lang doesnt have a concrete mechanism for resolving imports ( see: NeurodataWithoutBorders/nwb-schema#540 ) they usually have to be added later after object instantiation, which makes for an awkward need to call a method manually afterwards to complete the schema.

We should add an induce or complete method that wraps any post-load steps that need to be taken, and a private attr like _completed that indicates whether it has been called already (and otherwise calls it at the start of build).

This gets us into a little bit of messy territory re: division of labor between nwb_schema_language and nwb_linkml, where the former is basically just the schema classes, but we probably want to have it contain all the steps that relate to loading and completing a schema, so nwb_linkml has only the linkml parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant