Skip to content

Generate @context JSON-LD objects from ResourceShapes #1

@knoan

Description

@knoan

challenge / use case

ResourceShapes already encode JSON-LD semantics — property IRIs (forward/reverse), @id/@type mappings, namespace prefixes, and language maps — but there's no built-in way to produce a JSON-LD @context object from a shape. Consumers needing JSON-LD interoperability must manually reconstruct context mappings, duplicating information already captured in the shape definition.

proposal

Add a function (e.g., context(shape: ResourceShape): object) that derives a JSON-LD 1.1 @context object from a ResourceShape, mapping:

  • Property names to their forward/reverse IRIs
  • @id and @type entries
  • Namespace prefixes
  • Language maps (@container: @language)
  • Index maps (@container: @index) for unions

alternatives

  • Manual @context construction alongside each shape definition (error-prone, duplicates information)
  • External tooling to generate contexts from shape metadata (adds build complexity)

notes

The shape system already references JSON-LD 1.1 specs (§ 3.2, 3.3, 3.5, 4.6.1, 4.8, 9.8), so the mapping is well-defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions