Skip to content

Proposal: Replace nested metadata with JSON-LD style @context and namespaced fields #58

Description

@mindpower

Background

Currently in the ai-catalog specification, we handle extensibility and vendor-specific fields via a nested metadata object, recommending reverse-DNS key naming (e.g., "com.example.confidenceScore": 0.9).

Following discussions in the Discord channel with @darrelmiller , @rvguha, @evalstate and others, we are proposing an alternative, JSON-LD inspired approach: flattening the schema by replacing the metadata envelope with top-level namespaced fields and a @context declaration.

The Proposal

Instead of hiding custom attributes in a metadata object, a catalog or entry MAY declare namespace prefixes using @context. Extension fields then sit as peers to core fields (like identifier and tags) using a prefix:term format.

Key Design Rules:

  • Unprefixed keys are strictly reserved for the closed core set (identifier, type, url, displayName, description, tags, capabilities).
  • Any unprefixed key outside the core set is invalid.
  • Extension fields MUST use a prefixed key (e.g., okf:type), where the prefix is mapped to an absolute IRI in the @context.
  • Note this can also support domain/company specific prefix as well which covers the reverse-DNS key naming currently.

Example:

{  
  "specVersion": "1.0",  
  "@context": {  
    "okf": "https://openknowledgeformat.org/ns#"  
  },  
  "entries": [  
    {  
      "identifier": "urn:air:treasury.gov:okf:fiscaldata",  
      "type": "text/vnd.okf+markdown",  
      "tags": ["finance", "treasury"],  
      "okf:type": "Financial Dataset",  
      "okf:taxonomy": "us-gaap" 
    }  
  ]  
}

Why this is an improvement:

  1. Flattens the Hierarchy: It makes parsing and indexing easier for downstream discovery systems by avoiding deep nesting.
  2. Schema Resolution: Unlike reverse-DNS strings, @context maps to an actual IRI, allowing consumers to look up the definition of the extension terms if they choose.
  3. Pragmatic & Lightweight: It brings the benefits of Semantic Web/JSON-LD for extensibility without requiring consumers to run a full JSON-LD processor.

Next Steps / Meeting Discussion

I will bring this up in our weekly meeting for discussion. If we agree this is the better path forward for extensibility, I will draft an ADR and open a PR to update the spec and add an ADR and also related doc like namespace-extension.md.

Full Proposal Details

Click to expand the full namespace proposal text

ai-catalog entries have a fixed set of core fields. To let new artifact types define their own typed, queryable attributes without colliding with core fields or with each other, a catalog MAY declare namespace prefixes using @context.

This is JSON-LD-inspired, but intentionally limited. ai-catalog processors are not required to process catalogs as JSON-LD. Here, @context only binds prefixes for extension keys such as okf:type or canvas:artifactKind.

@context maps prefixes to absolute namespace IRIs. It MAY appear at catalog level and/or entry level. Entry-level context MAY add prefixes, but MUST NOT redefine a prefix already declared at catalog level.

Core terms are namespace-free. There is no @vocab. Unprefixed keys such as identifier, type, url, displayName, description, tags, and capabilities are the closed, reserved core set. An unprefixed key outside the core set is invalid.

Extension fields MUST use a prefixed key of the form prefix:term, where the prefix is declared in the in-scope @context. Extension values MAY be any JSON value unless constrained by the namespace’s schema.

ARD search queries that reference namespaced fields MUST also declare the prefixes they use in an in-scope @context, unless the query profile defines them out of band.

A namespace SHOULD publish documentation or a schema for its terms. Consumers MUST NOT reject an entry solely because it contains an extension field with an unrecognized prefix. Systems that transform or republish entries SHOULD preserve unrecognized extension fields unless explicitly configured otherwise.

Entries with no @context and no extension fields are valid and unchanged.

Example: OKF dataset

OKF has its own type field, which would collide with the ai-catalog core type. The namespace resolves the collision.

{  
  "specVersion": "1.0",  
  "@context": {  
    "okf": "https://openknowledgeformat.org/ns#"  
  },  
  "entries": [  
    {  
      "identifier": "urn:air:treasury.gov:okf:fiscaldata",  
      "type": "text/vnd.okf+markdown",  
      "url": "https://example.org/sources/treasury-fiscaldata.md",  
      "displayName": "US Treasury — FiscalData",  
      "tags": [  
        "finance",  
        "treasury"  
      ],  
      "okf:type": "Financial Dataset",  
      "okf:taxonomy": "us-gaap",  
      "okf:periodType": "instant"  
    }  
  ]  
}

An ARD search query can refer to namespaced fields by their serialized key, but must declare the namespace prefix it uses:

{ "@context": { "okf": "https://openknowledgeformat.org/ns#" },   
  "query": "official fiscal data",   
  "filter": { "okf:type": ["Financial Dataset"], "okf:taxonomy": "us-gaap" }   
}

Discovery services MAY additionally expand prefixed keys to namespace IRIs for internal indexing, but clients MUST NOT rely on such normalization unless advertised by the service.

Example: Copilot Canvas extension

Github Copilot Canvas reuses core capabilities and namespaces only Canvas-specific fields.

{ "specVersion": "1.0",   
  "@context": { "canvas": "https://github.com/copilot/ns/canvas#" },   
  "entries": [{ "identifier": "urn:air:github.com:canvas:triage-board",   
                "type":   "application/vnd.github.canvas-extension",   
                "url": "https://github.com/acme/.github/extensions/triage-board",   
                "displayName": "Issue Triage Board",   
                "capabilities": ["get_board", "add_card", "move_card"],   
                "canvas:scope": "project",   
                "canvas:artifactKind": "kanban" }]   
}

Namespacing keeps the ai-catalog core small while allowing communities to define their own queryable attributes without central coordination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions