Repository navigation
Conversation
jdsika
force-pushed
the
feat/contextgen-jsonld-version
branch
from
October 15, 2026 16:46
8998d8f to
6fc20fd
Compare
jdsika
force-pushed
the
feat/contextgen-jsonld-version
branch
2 times, most recently
from
October 23, 2026 14:36
ca8dd1d to
8928db4
Compare
A generated context can use JSON-LD 1.1 constructs: scoped contexts on enum slots and on class-level range overrides, and @Prefix. A JSON-LD 1.0 processor ignores them silently, so datatype coercions are lost. A context that uses one now starts with "@Version": 1.1. It makes a JSON-LD 1.0 processor stop (JSON-LD 1.1 section 1.7), and a JSON-LD 1.1 processor then requires 1.1 processing (JSON-LD 1.1 API section 4.1.2). The generator marks the three places where it emits such a construct, so no keyword table is needed, and the declaration follows what the context actually contains: with --no-model the scoped contexts are left out, with --no-prefixes the @Prefix entries. A context without a 1.1 construct stays loadable by a JSON-LD 1.0 processor. gen-jsonld embeds the declaration with the generated context. Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
jdsika
force-pushed
the
feat/contextgen-jsonld-version
branch
from
October 23, 2026 14:37
8928db4 to
26b05d8
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.
Mirror of linkml#4144, same head. Review there; this PR tracks the fork stack.
Summary
A generated JSON-LD context that uses a JSON-LD 1.1 construct now starts with
"@version": 1.1.{"@context": {"@version": 1.1, "xsd": "http://www.w3.org/2001/XMLSchema#", ...}}gen-jsonld-context emits JSON-LD 1.1 constructs at three points: a scoped
@contexton enum slots (ENUM_CONTEXT, the@vocabcoercion of linkml#3447), type-scoped contexts for class-level range overrides (linkml#3336), and@prefix: truefor a namespace that ends in neither/nor#.floatoverride as"1.5"^^xsd:double.@versionis the declaration for this: "The use of1.1for the value of@versionis intended to cause a JSON-LD 1.0 processor to stop processing" (JSON-LD 1.1 §1.7). A 1.1 processor set tojson-ld-1.0reports a processing mode conflict (1.1 API §4.1.2, step 5.5.2).The generator marks those three points, so there is no keyword table, and the declaration follows what the output contains.
--no-modelleaves out the scoped contexts and--no-prefixesthe@prefixentries; without them the context is plain JSON-LD 1.0 and has no version line. gen-jsonld embeds the generated context under the same rule. gen-prefix-map emits a plain prefix map, not a JSON-LD context.linkml#1995 (for linkml#1993) sets
version="1.1"where LinkML itself parses JSON-LD, and linkml#25 proposed@versionbut was closed without it. The declaration covers every other consumer of a published context.Closes #55
How was this tested?
test_version_is_declared_exactly_when_a_json_ld_1_1_construct_is_used: a scoped context, an enum and@prefixeach declare the version; a plain schema,--no-modeland--no-prefixesdon't.test_context_with_a_json_ld_1_1_construct_declares_it: the value is the number1.1, first in the context.test_embedded_context_follows_the_same_rule: gen-jsonld's embedded context.test_type_scoped_coercion_survives_json_ld_1_0_processing: data parsed by rdflib withversion=1.0keeps thexsd:floatof a class-level override. It fails without this change (xsd:double).@prefixor a scoped context does; tutorial 4's context uses neither and is unchanged.test_datadict_personinfo, which fails onmaintoo in this environment); slow suite (--with-slow --with-biolink -m "slow and not kroki") 67 passed.Areas of uncertainty
@prefix, so they gain the line when they are next generated.Checklist
AI Assistance
If you used AI tools while preparing this PR, you are still the author and responsible for understanding, verifying, and defending your submission. Please engage with reviewers personally rather than through your agent during feedback and revisions. See our AI Covenant for details.