Working with dynamic enumerations - a place for discussion and FAQ #2652
Replies: 1 comment
-
|
Initial PR to improve dynamic enum documentation is up here #3038 In the PR I note a few different metaslots for EnumExpression that were missing robust documentation. Probably makes sense to punt that conversation out to this discussion to see if folks can clarify usage or implementations that I can look at to understand how the following metaslots are intended to be used:
I'd be happy to fold further documentation into #3038 if any of the above pertain to dynamic enums. Alternatively, I can follow up with a second PR with some minimal documentation on the above metaslots. Would be great to have these metaslots well defined somewhere in the docs. If such documentation does exist, please point me to it! Otherwise I'm happy to dig around existing code, but I could use some suggestions on where to start looking :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
To seed the discussion, a question from slack:
Hi all! I'm having an issue with dynamic enums during code generation.
Here's my schema with a dynamic enum that follows the documentation pattern (https://linkml.io/linkml/schemas/enums.html#dynamic-enums):
The vskit expand command works fine, but when I try to convert my data to TTL:
I get this error:
The enum is being referenced in my CellType class:
Cory Levinson:
when you run linkml-convert there's no explicit reference to the expanded schema, and from the links you shared, the expanded schema is not listed as an import in the main schema.yaml. I'm not 100% certain how this is expected to work, but I have spent a bit of time with semantic enums so do have some ideas...
If you add the expanded schema as an import on the main one, does that fix things?
I spent some time working with your examples / files and I think I found the root cause of the problem – it's not possible to have a slot with identifier: true also have a enum as a range.
I see two paths forward:
In this case, you may still need some identifier for the CellType class in order to continue using your annotated_source slot as you currently do, since without an identifier slot for CellType you would need your Axiom class instances to have annotated_source values referenced inline in all examples (as opposed to reference by ID which is what your current example does)
Alternatively, you could change the range of annotated_source to be CellTypeEnum, and that should work fine as well.
Beta Was this translation helpful? Give feedback.
All reactions