Repository navigation
Description
#2009 gives JSON-LD one @graph classifier and one graph-name resolution order (classify_written_graph_name: a variable, a fromNamed alias, "default", "config", "txn-meta", then expansion against the @context), shared by templates and where. A few readers still resolve graph names on their own, and expansion only looks at part of the context. One item changes what existing documents expand to, so it needs a decision before code; I've marked it.
One classifier:
- JSON-LD
where: a compact IRI in["graph", …]is not expanded, so the pattern silently matches nothing #1993: the["graph", <name>, …]where form still takes its name as written, while the node-level"@graph"and both template forms expand it, so awhereand adeletethat both say["graph", "ex:g", …]are a silent no-op together. Aliases are matched first, so expanding there mostly changes compact IRIs that match nothing today. fix: JSON-LD graph scoping, config integrity and explicit-only SHACL #2009 may close it. - Datalog rule heads read
@graphwith their own parser (datalog_rules/parse.rs) instead of the shared classifier (graph_shape), so the two can drift. Route rule heads through the shared one. - The seam with fix: typed dataset and graph references: one grammar, one resolver #2007. fix: typed dataset and graph references: one grammar, one resolver #2007 adds its own
fluree-db-core/src/dataset_ref.rs, with a differentGraphIriandRefErrorfrom the subset fix: JSON-LD graph scoping, config integrity and explicit-only SHACL #2009 carries, so whichever lands second reconciles them. Then the JSON-LD graph-name classifier should hand an expanded IRI toTargetLedger::graph_positionbefore refusing a relative name, and the template-default anchor drop should key on "maps to the default graph".urn:defaultstays read-only.
Scoped contexts and keywords:
- Graph names resolve against the document's top-level
@contextonly, in templates andwhere; node-local and scoped (type- or property-scoped) contexts are ignored for@graphvalues. Expected: the context in effect at the node. - Type-scoped contexts propagate into nested nodes, and several types apply in the order written. JSON-LD 1.1 gives a type-scoped context
@propagate: falseby default, so it applies to the typed node's own properties and not to node objects nested in them; our expander keeps it for the nested nodes too. And a node with several types applies their scoped contexts in the order written, where the spec applies them in lexicographic order of the type terms. Fixing either changes what existing documents expand to. Needs a decision.The untyped nested{"@context": {"ex": "http://example.org/", "Person": {"@id": "ex:Person", "@context": {"name": "http://schema.org/name"}}, "Org": {"@id": "ex:Org", "@context": {"name": "http://org.example/name", "@vocab": "http://orgv/"}}}, "@graph": [{"@id": "ex:p", "@type": "Person", "name": "P", "ex:k": {"@id": "ex:o", "name": "inner-untyped"}}, {"@id": "ex:o", "@type": ["Org", "Person"], "name": "O", "x": 1}, {"@id": "ex:q", "@type": ["Person", "Org"], "name": "Q", "x": 1}]}ex:ounderex:pexpandsnametohttp://schema.org/name(Person's scope), where the spec leavesnameundefined there. Andex:qgetshttp://org.example/name, where the spec gives bothex:oandex:qPerson'sname, sincePersonsorts afterOrg. - A term defined only in a property-scoped context, used outside it, stays a bare key. Inside
authorbelow,nameandotherexpand as the scoped context says. The outernameis undefined in the outer context, which has no@vocab, so the spec drops it; the expander keeps the bare key"name", in strict expansion too, and a transaction would write a predicate namedname. Drop it as the spec does, or refuse it in strict expansion as an unresolvable key.{"@context": {"ex": "http://example.org/", "author": {"@id": "ex:author", "@context": {"name": "http://schema.org/name", "@vocab": "http://scoped/"}}}, "@id": "ex:a", "author": {"@id": "ex:b", "name": "Ann", "other": 1}, "name": "outer"} - Unknown
@keywords are a deviation, but the docs call expansion fully compliant. With fix: JSON-LD graph scoping, config integrity and explicit-only SHACL #2009, an unknown keyword-form key on a node is refused, where the JSON-LD 1.1 expansion algorithm drops it.docs/reference/compatibility.mdshould list that as a deviation.
The two expander items are pre-existing (identical before and after #2009, which doesn't touch context.rs or the scoped-context code); #2009 fixes the one that wrote wrong data silently, a scoped term's @id over an outer prefix staying compact.
Related existing issues: #1993 (above) and #1991, both of which #2009 may close.
From #2009 (Follow-ups: the ["graph", …] form; Datalog rule heads; the #2007 seam; graph names and the top-level @context; type-scoped propagation; property-scoped bare keys) and bplatz's review of #2009.
Activity
bplatz commentedon Nov 14, 2026
A decision on the item "A term defined only in a property-scoped context, used outside it, stays a bare key": the current behavior stays.
A key or
@typethat the context maps to no IRI is stored as a plain name by design. Cypher reads and writes the same plain names, so a JSON-LD write and a Cypher query agree with no context at all. This item is one case of that. #2396 documents it as a deviation indocs/reference/compatibility.md("Plain names, by design", under JSON-LD 1.1) and indocs/concepts/iri-and-context.md.So neither dropping the key nor refusing it in strict expansion is planned, and this item can be checked off.