# pub.chive.annotation.entityLink

> Published by [chive.pub](https://lexicon.garden/identity/did:plc:7natp5xae72bddaqlkef2t4e)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.annotation.entityLink)
- [Documentation](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.annotation.entityLink/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.annotation.entityLink/examples)

## Definitions

### `pub.chive.annotation.entityLink`

**Type**: `record`

Link from a text span in an eprint to a knowledge graph entity

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `target` | `ref` → `#textSpanTarget` | Yes | Text span being linked to an entity |
| `createdAt` | `string` (datetime) | Yes |  |
| `eprintUri` | `string` (at-uri) | Yes | AT-URI of the eprint containing the linked text |
| `confidence` | `integer` | No | Confidence score for the link (scaled by 1000 for 0.0-1.0 range) |
| `linkedEntity` | `union` | Yes | The entity being linked to |
| `schemaRevision` | `integer` | No | Schema revision this record was created with. Absent means revision 1. |

### `pub.chive.annotation.entityLink#authorLink`

**Type**: `object`

Link to an ATProto author

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes | Author's DID |
| `type` | `string` | Yes |  |
| `orcid` | `string` | No | Author's ORCID (if available) |
| `handle` | `string` (handle) | No | Author's handle |
| `displayName` | `string` | Yes | Author's display name |

### `pub.chive.annotation.entityLink#eprintLink`

**Type**: `object`

Link to another eprint/preprint

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `doi` | `string` | No | DOI if available |
| `uri` | `string` (at-uri) | Yes | AT-URI of the eprint |
| `type` | `string` | Yes |  |
| `title` | `string` | Yes | Eprint title |

### `pub.chive.annotation.entityLink#boundingRect`

**Type**: `object`

Bounding rectangle coordinates for highlight positioning. All values stored as strings to preserve floating-point precision since ATProto only supports integer type.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `x1` | `string` | Yes | Left edge coordinate (as string to preserve float precision) |
| `x2` | `string` | Yes | Right edge coordinate (as string to preserve float precision) |
| `y1` | `string` | Yes | Top edge coordinate (as string to preserve float precision) |
| `y2` | `string` | Yes | Bottom edge coordinate (as string to preserve float precision) |
| `width` | `string` | Yes | Page width reference (as string to preserve float precision) |
| `height` | `string` | Yes | Page height reference (as string to preserve float precision) |
| `pageNumber` | `integer` | Yes | 1-indexed page number for the bounding rectangle |

### `pub.chive.annotation.entityLink#graphNodeLink`

**Type**: `object`

Link to a knowledge graph node (type or object, with optional subkind)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` | No | Node UUID identifier |
| `uri` | `string` (at-uri) | Yes | AT-URI of the graph node |
| `kind` | `string` | Yes | Node kind: 'type' for classifications, 'object' for instances |
| `slug` | `string` | No | Human-readable slug (e.g., 'computer-science') |
| `type` | `string` | Yes |  |
| `label` | `string` | Yes | Display label for the node |
| `subkind` | `string` | No | Subkind slug (e.g., 'field', 'facet', 'institution', 'contribution-type') |
| `subkindUri` | `string` (at-uri) | No | AT-URI of the subkind type node |

### `pub.chive.annotation.entityLink#externalIdLink`

**Type**: `object`

Link to an external identifier (Wikidata, ROR, ORCID, etc.)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (uri) | No | Full URI for the external entity |
| `type` | `string` | Yes |  |
| `label` | `string` | Yes | Display label for the entity |
| `system` | `string` | Yes | External identifier system |
| `identifier` | `string` | Yes | Identifier value (e.g., Q42 for Wikidata) |

### `pub.chive.annotation.entityLink#textSpanTarget`

**Type**: `object`

W3C Web Annotation target for text spans

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `source` | `string` (at-uri) | Yes | AT-URI of the source document |
| `selector` | `ref` → `#textQuoteSelector` | Yes | Primary selector for resilient text matching |
| `refinedBy` | `ref` → `#textPositionSelector` | No | Optional position selector for precise targeting |

### `pub.chive.annotation.entityLink#textQuoteSelector`

**Type**: `object`

W3C TextQuoteSelector for resilient text matching

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `exact` | `string` | Yes | The exact text to match |
| `prefix` | `string` | No | Text immediately before the match |
| `suffix` | `string` | No | Text immediately after the match |

### `pub.chive.annotation.entityLink#textPositionSelector`

**Type**: `object`

W3C TextPositionSelector for character-based targeting

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `end` | `integer` | Yes | End character offset |
| `type` | `string` | Yes |  |
| `start` | `integer` | Yes | Start character offset |
| `pageNumber` | `integer` | Yes | 0-indexed page number in the document |
| `boundingRect` | `ref` → `#boundingRect` | No | Bounding rectangle for visual positioning |

## Raw Schema

```json
{
  "id": "pub.chive.annotation.entityLink",
  "defs": {
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "eprintUri",
          "target",
          "linkedEntity",
          "createdAt"
        ],
        "properties": {
          "target": {
            "ref": "#textSpanTarget",
            "type": "ref",
            "description": "Text span being linked to an entity"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime"
          },
          "eprintUri": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the eprint containing the linked text"
          },
          "confidence": {
            "type": "integer",
            "maximum": 1000,
            "minimum": 0,
            "description": "Confidence score for the link (scaled by 1000 for 0.0-1.0 range)"
          },
          "linkedEntity": {
            "refs": [
              "#graphNodeLink",
              "#externalIdLink",
              "#authorLink",
              "#eprintLink"
            ],
            "type": "union",
            "description": "The entity being linked to"
          },
          "schemaRevision": {
            "type": "integer",
            "minimum": 1,
            "description": "Schema revision this record was created with. Absent means revision 1."
          }
        }
      },
      "description": "Link from a text span in an eprint to a knowledge graph entity"
    },
    "authorLink": {
      "type": "object",
      "required": [
        "type",
        "did",
        "displayName"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did",
          "description": "Author's DID"
        },
        "type": {
          "type": "string",
          "const": "author"
        },
        "orcid": {
          "type": "string",
          "description": "Author's ORCID (if available)"
        },
        "handle": {
          "type": "string",
          "format": "handle",
          "description": "Author's handle"
        },
        "displayName": {
          "type": "string",
          "description": "Author's display name"
        }
      },
      "description": "Link to an ATProto author"
    },
    "eprintLink": {
      "type": "object",
      "required": [
        "type",
        "uri",
        "title"
      ],
      "properties": {
        "doi": {
          "type": "string",
          "description": "DOI if available"
        },
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the eprint"
        },
        "type": {
          "type": "string",
          "const": "eprint"
        },
        "title": {
          "type": "string",
          "description": "Eprint title"
        }
      },
      "description": "Link to another eprint/preprint"
    },
    "boundingRect": {
      "type": "object",
      "required": [
        "x1",
        "y1",
        "x2",
        "y2",
        "width",
        "height",
        "pageNumber"
      ],
      "properties": {
        "x1": {
          "type": "string",
          "description": "Left edge coordinate (as string to preserve float precision)"
        },
        "x2": {
          "type": "string",
          "description": "Right edge coordinate (as string to preserve float precision)"
        },
        "y1": {
          "type": "string",
          "description": "Top edge coordinate (as string to preserve float precision)"
        },
        "y2": {
          "type": "string",
          "description": "Bottom edge coordinate (as string to preserve float precision)"
        },
        "width": {
          "type": "string",
          "description": "Page width reference (as string to preserve float precision)"
        },
        "height": {
          "type": "string",
          "description": "Page height reference (as string to preserve float precision)"
        },
        "pageNumber": {
          "type": "integer",
          "minimum": 1,
          "description": "1-indexed page number for the bounding rectangle"
        }
      },
      "description": "Bounding rectangle coordinates for highlight positioning. All values stored as strings to preserve floating-point precision since ATProto only supports integer type."
    },
    "graphNodeLink": {
      "type": "object",
      "required": [
        "type",
        "uri",
        "label",
        "kind"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Node UUID identifier"
        },
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the graph node"
        },
        "kind": {
          "type": "string",
          "description": "Node kind: 'type' for classifications, 'object' for instances",
          "knownValues": [
            "type",
            "object"
          ]
        },
        "slug": {
          "type": "string",
          "description": "Human-readable slug (e.g., 'computer-science')"
        },
        "type": {
          "type": "string",
          "const": "graphNode"
        },
        "label": {
          "type": "string",
          "description": "Display label for the node"
        },
        "subkind": {
          "type": "string",
          "description": "Subkind slug (e.g., 'field', 'facet', 'institution', 'contribution-type')"
        },
        "subkindUri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the subkind type node"
        }
      },
      "description": "Link to a knowledge graph node (type or object, with optional subkind)"
    },
    "externalIdLink": {
      "type": "object",
      "required": [
        "type",
        "system",
        "identifier",
        "label"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "Full URI for the external entity"
        },
        "type": {
          "type": "string",
          "const": "externalId"
        },
        "label": {
          "type": "string",
          "description": "Display label for the entity"
        },
        "system": {
          "type": "string",
          "description": "External identifier system",
          "knownValues": [
            "wikidata",
            "ror",
            "orcid",
            "isni",
            "viaf",
            "lcsh",
            "fast",
            "credit",
            "spdx",
            "fundref",
            "mesh",
            "aat",
            "gnd",
            "anzsrc",
            "arxiv",
            "doi",
            "pmid",
            "pmcid"
          ]
        },
        "identifier": {
          "type": "string",
          "description": "Identifier value (e.g., Q42 for Wikidata)"
        }
      },
      "description": "Link to an external identifier (Wikidata, ROR, ORCID, etc.)"
    },
    "textSpanTarget": {
      "type": "object",
      "required": [
        "source",
        "selector"
      ],
      "properties": {
        "source": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the source document"
        },
        "selector": {
          "ref": "#textQuoteSelector",
          "type": "ref",
          "description": "Primary selector for resilient text matching"
        },
        "refinedBy": {
          "ref": "#textPositionSelector",
          "type": "ref",
          "description": "Optional position selector for precise targeting"
        }
      },
      "description": "W3C Web Annotation target for text spans"
    },
    "textQuoteSelector": {
      "type": "object",
      "required": [
        "type",
        "exact"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "TextQuoteSelector"
        },
        "exact": {
          "type": "string",
          "description": "The exact text to match"
        },
        "prefix": {
          "type": "string",
          "maxLength": 32,
          "description": "Text immediately before the match"
        },
        "suffix": {
          "type": "string",
          "maxLength": 32,
          "description": "Text immediately after the match"
        }
      },
      "description": "W3C TextQuoteSelector for resilient text matching"
    },
    "textPositionSelector": {
      "type": "object",
      "required": [
        "type",
        "start",
        "end",
        "pageNumber"
      ],
      "properties": {
        "end": {
          "type": "integer",
          "minimum": 0,
          "description": "End character offset"
        },
        "type": {
          "type": "string",
          "const": "TextPositionSelector"
        },
        "start": {
          "type": "integer",
          "minimum": 0,
          "description": "Start character offset"
        },
        "pageNumber": {
          "type": "integer",
          "minimum": 0,
          "description": "0-indexed page number in the document"
        },
        "boundingRect": {
          "ref": "#boundingRect",
          "type": "ref",
          "description": "Bounding rectangle for visual positioning"
        }
      },
      "description": "W3C TextPositionSelector for character-based targeting"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "revision": 1
}
```
