Skip to content

add simple_dict annotations to extensions#213

Open
cmungall wants to merge 1 commit intomainfrom
extensions-simple-dict
Open

add simple_dict annotations to extensions#213
cmungall wants to merge 1 commit intomainfrom
extensions-simple-dict

Conversation

@cmungall
Copy link
Copy Markdown
Member

@cmungall cmungall commented Jan 31, 2025

Summary

Adds explicit simple_dict_value: true annotation to the extension_value slot in extensions.yaml, aligning the source schema with what's already present in derived artifacts (meta.jsonld, meta.owl.ttl).

Motivation

The extension class has three slots: extension_tag (key), extension_value (required), and extensions (recursive self-reference, not required). Generators need to know which non-key slot holds the dict value to serialize extensions as simple {tag: value} dicts.

Currently this works via heuristic inference in get_range_associated_slots()extension_value is the only non-key required slot, so it gets picked automatically. This annotation makes that intent explicit rather than relying on the fallback heuristic.

Notes

  • No functional change — generators already handle this correctly via inference
  • The derived artifacts (meta.jsonld, meta.owl.ttl) already contain this annotation from a prior manual edit; this brings the source YAML into sync

EDIT: @matentzn added this PR description in the hope that it reflects @cmungall original intend.

Copy link
Copy Markdown
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmungall please add some basic text to the PR to understand the motivation and possible ramifications of this change.

Copy link
Copy Markdown
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds simple_dict_value: true to extension_value in extensions.yaml. The extension class has three slots: extension_tag (key), extension_value (required), and extensions (recursive, not required). The thing is, get_range_associated_slots() in helpers.py already correctly identifies extension_value as the simple dict value slot via fallback heuristic #3: it's the only non-key required slot. So generators already handle this correctly without the annotation.

The simple_dict_value annotation in the derived artifacts (meta.jsonld, meta.owl.ttl) was likely added manually at some point — there's no code in linkml that auto-generates it during schema compilation. It's a stale/orphaned artifact, not evidence that the source YAML needs updating.

So this PR is purely defensive: making implicit behavior explicit. That's fine, but it's not fixing anything broken. The real question is whether we want to treat simple_dict_value annotations as required documentation or whether the heuristic-based inference is good enough. If we're going to annotate, we should probably do it consistently across all simple dict patterns, not just extensions.

@matentzn matentzn requested a review from amc-corey-cox April 8, 2026 14:31
Copy link
Copy Markdown
Contributor

@amc-corey-cox amc-corey-cox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to me to be a simple low-risk change. I'm inclined to approve.

But it does beg the question: should we make this change everywhere that could use this as well? What makes extensions special in this case? As things stand this slot can be in-lined as a simple dict without this change based on how linkml allows simple dict in-lining and this PR makes no functional change.

@amc-corey-cox
Copy link
Copy Markdown
Contributor

@cmungall Can you give a response to my and @matentzn reviews before we decide to merge this? I see nothing blocking this but I'm not sure if we actually need or want it.

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

Successfully merging this pull request may close these issues.

3 participants