Set explicit uri and base on NonRelativeURI type#545
Merged
Conversation
Fixes shaclgen "No URI for type" and sqltablegen "Unknown range base" errors. Workaround for LinkML generators not traversing `typeof`.
gouttegd
reviewed
May 8, 2026
Contributor
gouttegd
left a comment
There was a problem hiding this comment.
Thanks for the detailed explanations.
I cannot test right now, but this looks good to me.
I would feel better if you could test the change against SSSOM-Py (as explained here), though. I understand that the change should not affect the Python generator (which was already doing the correct thing) and therefore should not affect SSSOM-Py, but well, we have a test suite, better use it.
Collaborator
Author
|
Tested against SSSOM-Py per As expected — the change only affects |
gouttegd
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes shaclgen "No URI for type" and sqltablegen "Unknown range base" errors. Workaround for LinkML generators not traversing
typeof.Workaround for linkml/linkml#3491.
make allproduced a clean build but two streams of generator errors. Both stem from the same upstream LinkML behaviour:gen-shaclandgen-sqltabledo not walktypeofto resolve type attributes. The fix is to redeclare onNonRelativeURIwhat it would otherwise inherit from its parenturitype.Changes
Two attributes added to the
NonRelativeURItype definition insrc/sssom_schema/schema/sssom_schema.yaml:1.
uri: xsd:anyURI— silencesgen-shaclWithout this,
shaclgenemits:once per slot whose range is
NonRelativeURI(15 occurrences). The SHACL generator reads the type'suridirectly to populatesh:datatypeand does not fall back to the parent type.xsd:anyURIis the URI declared on the LinkML built-inuritype — semantically aNonRelativeURIis anxsd:anyURIwith an extra (prose-only) restriction, so this is the correct value rather than a mintedsssom:NonRelativeURI(which no SHACL processor would understand).2.
base: URI— silencesgen-sqltableWithout this,
sqltablegenemits:The SQL generator uses
baseto pick a SQL column type and, like shaclgen, doesn't traversetypeof.URImatches the parent type'sbase.This is a workaround
The real bug is upstream:
typeofis documented as inheritance, butSchemaView.get_type()returns child types as-declared and individual generators reimplement (or skip) the walk. Other generators in the same build (gen-python,gen-jsonld,gen-jsonschema,gen-graphql,gen-shex) handle the same schema fine, which makes the inconsistency a generator-side problem rather than a schema-author responsibility. Filed upstream — see linkml/linkml#3491.Until that lands, redeclaring inherited attributes on every custom type is the established LinkML convention (cf.
EntityReferencein the same file, which setsbase: stranduri: rdfs:Resourcefor the same reason).Verification
make all -Bafter the change: noshaclgenorsqltablegenerrors. Remaining output is GraphQL warnings about enum values like1:1,n:nand imported class names likeowl class(other problem)docs/have been added/updated if necessarymake testhas been run locallytests have been added/updated (if applicable)CHANGELOG.md has been updated.If you are proposing a change to the SSSOM metadata model, you must
examples/see_alsofield of the linkml modelsee_alsofield of the linkml modelsrc/docs/spec-models.md) accordingly