Skip to content

JSON-LD: explicit value objects take the default @language and the term's datatype #2356

Closed

Description

@bplatz

The JSON-LD expander treats an explicit value object like a bare value: it gives it the context's default @language, and the datatype of the term it sits under. JSON-LD 1.1 applies both only to bare strings and scalars (value expansion); a value object is taken as written.

Default language

{
  "@context": {"@language": "en", "ex": "http://example.org/"},
  "@id": "ex:s",
  "ex:t": ["plain", {"@value": "obj"}]
}

Both values are stored tagged @en. Expected: plain tagged @en, obj an untagged xsd:string. {"@value": "..."} is the standard way to opt one string out of the default language, and it does not work. A term's "@language": null does not reach value objects either.

Term datatype

{
  "@context": {"ex": "http://example.org/", "n": {"@id": "ex:n", "@type": "http://www.w3.org/2001/XMLSchema#integer"}},
  "@id": "ex:s",
  "n": {"@value": "5"}
}

5 is stored as an xsd:integer. Expected: the string "5".

Where

parse_value_object in fluree-graph-json-ld/src/expand.rs: the None arms that fall back to entry.type_ and to context.language. The test value_object_language_overrides_the_term_datatype assumes the current datatype behavior.

The two halves should change together, so value objects are consistently taken as written.

Why 5.0

Documents that work today would write different values (plain strings where they wrote language-tagged ones, strings where they wrote typed values), and data already stored would stop matching the same document on delete or upsert. It needs a Behavior changes entry and a repair note in docs/reference/compatibility.md.

Found in review of #2283.

Activity

  1. added this to the 5.0.0 milestone on Nov 11, 2026
  2. added
    bug
    breaking-change
    P2
    area:sparql
    on Nov 11, 2026
  3. bplatz commented on Nov 22, 2026

    @bplatz
    ContributorAuthor

    Fixed on next by #2393 (merged 2026-11-15, e448092). A value object now takes neither the default @language nor its term's @type, in transactions, imports and JSON-LD queries alike. A PR into next doesn't close the issues it fixes, so this one is closed by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:sparqlbreaking-changebug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions