feat(contextgen): add @type: @vocab coercion for eligible enums#8
Open
feat(contextgen): add @type: @vocab coercion for eligible enums#8
Conversation
63c5dd9 to
5edfd2c
Compare
Co-authored-by: Patrick Kalita <pkalita@lbl.gov>
…rrides Co-authored-by: Kevin Schaper <kevinschaper@gmail.com>
fix(excelgen): move workbook.save outside loop
The error is explained in the comment - its spurious and annoying to wait rely on the PURL system being updated.
35af2a2 to
b33f469
Compare
Co-authored-by: Kevin Schaper <kevinschaper@gmail.com> Co-authored-by: Corey Cox <69321580+amc-corey-cox@users.noreply.github.com>
51cfa72 to
4e309f8
Compare
4e309f8 to
44515d5
Compare
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.
Summary
Adds JSON-LD 1.1
@type: @vocabcoercion for enum-ranged slots whose permissible values are eligible (all have meanings, single namespace, text matches local name).Problem
LinkML's
visit_enumis a no-op — enum permissible values are not emitted in the generated JSON-LD context. Slots with enum ranges only get a structuralENUM_CONTEXTmapping ({text: skos:notation, description: skos:prefLabel, meaning: @id}), which requires structured object values.In practice, JSON data files use bare string enum values (e.g.,
"DrivableAreaType": "RoadTypeMotorway"). Without context support, these remain plain strings and don't expand to IRIs.Upstream issue: linkml#2497
Approach
Uses JSON-LD 1.1 §4.2.3 (type coercion via
@vocab) combined with §4.1.8 (scoped contexts):This supports both value forms simultaneously:
"RoadTypeMotorway"→ expands to IRI via scoped@vocab{text, meaning}→ SKOS mappings still workEligibility Criteria
An enum qualifies only when ALL conditions are met:
meaningIRIIneligible enums fall back to the existing
ENUM_CONTEXTbehavior.Changes
jsonldcontextgen.py: Added_vocab_eligible_enum()method + modifiedvisit_slotenum branchtest_jsonldcontextgen.py: 7 new tests covering eligible/ineligible cases, pyld expansion verification, kitchen_sink fallbackTesting
References
@type: @vocab)