{ "lexicon": 1, "id": "community.lexicon.annotation.annotation", "defs": { "main": { "type": "record", "description": "A web annotation. Core entity for highlighting, commenting on, and replying to web resources.", "key": "tid", "record": { "type": "object", "required": ["target", "createdAt"], "properties": { "target": { "type": "array", "items": { "type": "ref", "ref": "#target" }, "minLength": 1, "maxLength": 5, "description": "The resource(s) being annotated (W3C: target property)" }, "body": { "type": "string", "maxLength": 10000, "maxGraphemes": 5000, "description": "The annotation text content (comment, note, etc.)" }, "tags": { "type": "array", "items": { "type": "string", "maxLength": 100 }, "maxLength": 50, "description": "Tags for categorization" }, "document": { "type": "ref", "ref": "#documentMetadata", "description": "Metadata about the document being annotated" }, "createdAt": { "type": "string", "format": "datetime" } } } }, "target": { "type": "object", "description": "W3C SpecificResource: what is being annotated", "required": ["source"], "properties": { "source": { "type": "string", "format": "uri", "maxLength": 8000, "description": "URI of the resource being annotated" }, "selector": { "type": "array", "items": { "type": "union", "refs": [ "#textQuoteSelector", "#textPositionSelector", "#rangeSelector", "#fragmentSelector", "#cssSelector", "#xpathSelector" ] }, "maxLength": 5, "description": "How to locate the specific segment (multiple for fallback)" } } }, "textQuoteSelector": { "type": "object", "description": "W3C TextQuoteSelector: identifies text by quoting with context", "required": ["$type", "exact"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#textQuoteSelector" }, "exact": { "type": "string", "maxLength": 5000, "description": "The exact text being selected" }, "prefix": { "type": "string", "maxLength": 500, "description": "Text immediately before for disambiguation" }, "suffix": { "type": "string", "maxLength": 500, "description": "Text immediately after for disambiguation" } } }, "textPositionSelector": { "type": "object", "description": "W3C TextPositionSelector: character position offsets", "required": ["$type", "start", "end"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#textPositionSelector" }, "start": { "type": "integer", "minimum": 0, "description": "Starting character position (inclusive)" }, "end": { "type": "integer", "minimum": 0, "description": "Ending character position (exclusive)" } } }, "rangeSelector": { "type": "object", "description": "W3C RangeSelector: defines a range using start/end selectors", "required": ["$type", "startSelector", "endSelector"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#rangeSelector" }, "startSelector": { "type": "union", "refs": ["#xpathSelector", "#cssSelector", "#textPositionSelector"] }, "endSelector": { "type": "union", "refs": ["#xpathSelector", "#cssSelector", "#textPositionSelector"] } } }, "fragmentSelector": { "type": "object", "description": "W3C FragmentSelector: uses URI fragment identifiers", "required": ["$type", "value"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#fragmentSelector" }, "value": { "type": "string", "maxLength": 2000, "description": "Fragment identifier (e.g., 't=30,60', 'section-2')" }, "conformsTo": { "type": "string", "format": "uri", "description": "IRI of the fragment syntax specification" } } }, "cssSelector": { "type": "object", "description": "W3C CssSelector: uses CSS selectors for DOM elements", "required": ["$type", "value"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#cssSelector" }, "value": { "type": "string", "maxLength": 2000, "description": "CSS selector string" } } }, "xpathSelector": { "type": "object", "description": "W3C XPathSelector: uses XPath for XML/HTML elements", "required": ["$type", "value"], "properties": { "$type": { "type": "string", "const": "community.lexicon.annotation.annotation#xpathSelector" }, "value": { "type": "string", "maxLength": 2000, "description": "XPath expression" } } }, "documentMetadata": { "type": "object", "description": "Metadata about the document being annotated", "properties": { "title": { "type": "string", "maxLength": 1000, "description": "Document title" }, "doi": { "type": "string", "maxLength": 500, "description": "Digital Object Identifier" }, "canonicalUri": { "type": "string", "format": "uri", "description": "Canonical URI for this document" } } } } }