Closed joeflack4 closed 6 months ago
This is a confusing problem of linkml for me.. The type is really EntityReference
, not uri_or_curie in the sense of "use one or the other". The correct way to express it would be: If its SSSOM TSV, or SSSOM JSON, it MUST be curie. If it is SSSOM RDF, it must be uri.
I guess this will have to be documented much much better.
Ah, that is not what I expected. That kind of conditional type def is tricky to express, but it also comes off like a code smell. Perhaps we could make EntityReference
an abstract class and then subclass it, using different sub-types for JSON / TSV or RDF serialization, but IDK how that'd end up looking in the docs either.
Maybe can just update the description on it in the documentation to say exactly what you said:
If its SSSOM TSV, or SSSOM JSON, it MUST be curie. If it is SSSOM RDF, it must be uri.
I made a PR about this: https://github.com/mapping-commons/sssom/pull/358
We cant do anything else right now, so I will close this issue here, but I expect the PR to raise some eyebrows and subsequent dialogues.
Overview
I'm running
sssom validate
and was getting an error that mycreator_id
was invalid. The docs forcreator_id
show that it is of typeEntityReference
,typeof: uriorcurie
.However, when I have a URI,
creator_id: https://orcid.org/0000-0002-2906-7319
, validation fails with:If I change it to a CURIE, validation passes.
Suggested solution
a. Update the docs for
EntityReference
:typeof: curie
. b. Updateget_all_prefixes()
so that it ignores metadata slots where the typedef is not simply 'curie'. Or, if it's UriOrCurie, check to make sure at least one is valid.Additional info
Example files
FYI: docstring issue
The docstring for
get_all_prefixes()
shows:raises ValidationError: If slot is wrong.
twice.