Skip to content

JSON-LD: read @direction from a context and from a term definition #2360

Open

Description

@bplatz

JSON-LD 1.1 gives a string a base direction in three places: @direction on a value object, a default @direction in a context, and @direction on a term definition. #2284 reads the first. The other two are ignored, so the direction is lost without an error:

{
  "@context": {"@language": "ar", "@direction": "rtl", "title": "http://example.org/title"},
  "@id": "http://example.org/s",
  "title": "مرحبا"
}

stores "مرحبا"@ar. Expected "مرحبا"@ar--rtl, the form a value object's @direction is stored in. The context form is how the spec's own examples mark whole documents of Arabic or Hebrew text.

Where

  • fluree-graph-json-ld/src/context.rs: a context-level @direction falls into the unknown-keyword arm, and a term definition's @direction is not read. Both need a field (ParsedContext, ContextEntry), with null on a term clearing the default, as @language does.
  • fluree-graph-json-ld/src/expand.rs: the plain-string arm of parse_node_value applies the term or default language; the direction joins the tag there, the way base_direction joins it for a value object.
  • fluree-db-query/src/parse/node_map.rs: the where parser reads @direction on its own and needs the same, so a pattern matches what an insert wrote.

docs/reference/compatibility.md lists both forms as not read; drop that line when this lands.

Raised in review of #2284.

Activity

  1. added
    enhancement
    P3
    area:sparql
    on Nov 11, 2026
  2. added this to the 5.0.0 milestone on Nov 12, 2026
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

    P3area:sparqlenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions