COS v0.2 Draft ChaptersSingle pageJSON Schema

Context Object Specification (COS)

Version: 0.2
Chapter: 235 — Association
Status: Informative — Supporting
Category: Core Model


1. Purpose

This chapter defines association guidance for COS v0.2.

In the lean core object, association is not a separate top-level field.

Association is represented as:


2. First Principle

Association exists to answer:

What deterministic source relationship makes this selected text meaningful?

Examples:

Association MUST be source-grounded.

Association MUST NOT guess user intent.


3. Relation Model

interface ContextRelation {
  type: ContextRelationType;
  label?: string;
  value?: string;
  targetId?: string;
}
type ContextRelationType =
  | "container"
  | "section"
  | "row_header"
  | "column_header"
  | "label"
  | "list_item";

This relation model is intentionally small.

Producers SHOULD omit relationships that cannot be derived deterministically.


4. Top-Level vs Segment-Level Relations

Use context.relations when the relationship applies to the whole Selection.

Use context.segments[].relations when the relationship applies only to one segment.

Example:

{
  "context": {
    "scope": "multi-container",
    "segments": [
      {
        "id": "cell-1",
        "type": "table",
        "text": "$19",
        "selectedText": "$19",
        "relations": [
          { "type": "column_header", "label": "Base price" },
          { "type": "row_header", "label": "Starter" }
        ]
      },
      {
        "id": "cell-2",
        "type": "table",
        "text": "8%",
        "selectedText": "8%",
        "relations": [
          { "type": "column_header", "label": "Tax rate" },
          { "type": "row_header", "label": "Starter" }
        ]
      }
    ],
    "relations": [
      { "type": "section", "label": "Quarterly Pricing Snapshot" }
    ]
  }
}

5. Deterministic Signals

Valid signals include:

Invalid signals include:


6. Relation Types

6.1 container

The segment is contained by a logical content unit.

6.2 section

The segment or Selection appears under a deterministic section heading.

6.3 row_header

The segment is a table cell associated with a row header.

6.4 column_header

The segment is a table cell associated with a column header.

6.5 label

The segment is associated with a deterministic label.

6.6 list_item

The segment appears in a list item.


7. Summary

Association is a relation vocabulary, not a separate object domain.

Its job is to make context segments usable without forcing Consumers to understand every source format.