community.lexicon.annotation.annotation
1{
2 "lexicon": 1,
3 "id": "community.lexicon.annotation.annotation",
4 "defs": {
5 "main": {
6 "type": "record",
7 "description": "A web annotation. Core entity for highlighting, commenting on, and replying to web resources.",
8 "key": "tid",
9 "record": {
10 "type": "object",
11 "required": ["target", "createdAt"],
12 "properties": {
13 "target": {
14 "type": "array",
15 "items": {
16 "type": "ref",
17 "ref": "#target"
18 },
19 "minLength": 1,
20 "maxLength": 5,
21 "description": "The resource(s) being annotated (W3C: target property)"
22 },
23 "body": {
24 "type": "string",
25 "maxLength": 10000,
26 "maxGraphemes": 5000,
27 "description": "The annotation text content (comment, note, etc.)"
28 },
29 "tags": {
30 "type": "array",
31 "items": {
32 "type": "string",
33 "maxLength": 100
34 },
35 "maxLength": 50,
36 "description": "Tags for categorization"
37 },
38 "document": {
39 "type": "ref",
40 "ref": "#documentMetadata",
41 "description": "Metadata about the document being annotated"
42 },
43 "createdAt": {
44 "type": "string",
45 "format": "datetime"
46 }
47 }
48 }
49 },
50 "target": {
51 "type": "object",
52 "description": "W3C SpecificResource: what is being annotated",
53 "required": ["source"],
54 "properties": {
55 "source": {
56 "type": "string",
57 "format": "uri",
58 "maxLength": 8000,
59 "description": "URI of the resource being annotated"
60 },
61 "selector": {
62 "type": "array",
63 "items": {
64 "type": "union",
65 "refs": [
66 "#textQuoteSelector",
67 "#textPositionSelector",
68 "#rangeSelector",
69 "#fragmentSelector",
70 "#cssSelector",
71 "#xpathSelector"
72 ]
73 },
74 "maxLength": 5,
75 "description": "How to locate the specific segment (multiple for fallback)"
76 }
77 }
78 },
79 "textQuoteSelector": {
80 "type": "object",
81 "description": "W3C TextQuoteSelector: identifies text by quoting with context",
82 "required": ["$type", "exact"],
83 "properties": {
84 "$type": {
85 "type": "string",
86 "const": "community.lexicon.annotation.annotation#textQuoteSelector"
87 },
88 "exact": {
89 "type": "string",
90 "maxLength": 5000,
91 "description": "The exact text being selected"
92 },
93 "prefix": {
94 "type": "string",
95 "maxLength": 500,
96 "description": "Text immediately before for disambiguation"
97 },
98 "suffix": {
99 "type": "string",
100 "maxLength": 500,
101 "description": "Text immediately after for disambiguation"
102 }
103 }
104 },
105 "textPositionSelector": {
106 "type": "object",
107 "description": "W3C TextPositionSelector: character position offsets",
108 "required": ["$type", "start", "end"],
109 "properties": {
110 "$type": {
111 "type": "string",
112 "const": "community.lexicon.annotation.annotation#textPositionSelector"
113 },
114 "start": {
115 "type": "integer",
116 "minimum": 0,
117 "description": "Starting character position (inclusive)"
118 },
119 "end": {
120 "type": "integer",
121 "minimum": 0,
122 "description": "Ending character position (exclusive)"
123 }
124 }
125 },
126 "rangeSelector": {
127 "type": "object",
128 "description": "W3C RangeSelector: defines a range using start/end selectors",
129 "required": ["$type", "startSelector", "endSelector"],
130 "properties": {
131 "$type": {
132 "type": "string",
133 "const": "community.lexicon.annotation.annotation#rangeSelector"
134 },
135 "startSelector": {
136 "type": "union",
137 "refs": ["#xpathSelector", "#cssSelector", "#textPositionSelector"]
138 },
139 "endSelector": {
140 "type": "union",
141 "refs": ["#xpathSelector", "#cssSelector", "#textPositionSelector"]
142 }
143 }
144 },
145 "fragmentSelector": {
146 "type": "object",
147 "description": "W3C FragmentSelector: uses URI fragment identifiers",
148 "required": ["$type", "value"],
149 "properties": {
150 "$type": {
151 "type": "string",
152 "const": "community.lexicon.annotation.annotation#fragmentSelector"
153 },
154 "value": {
155 "type": "string",
156 "maxLength": 2000,
157 "description": "Fragment identifier (e.g., 't=30,60', 'section-2')"
158 },
159 "conformsTo": {
160 "type": "string",
161 "format": "uri",
162 "description": "IRI of the fragment syntax specification"
163 }
164 }
165 },
166 "cssSelector": {
167 "type": "object",
168 "description": "W3C CssSelector: uses CSS selectors for DOM elements",
169 "required": ["$type", "value"],
170 "properties": {
171 "$type": {
172 "type": "string",
173 "const": "community.lexicon.annotation.annotation#cssSelector"
174 },
175 "value": {
176 "type": "string",
177 "maxLength": 2000,
178 "description": "CSS selector string"
179 }
180 }
181 },
182 "xpathSelector": {
183 "type": "object",
184 "description": "W3C XPathSelector: uses XPath for XML/HTML elements",
185 "required": ["$type", "value"],
186 "properties": {
187 "$type": {
188 "type": "string",
189 "const": "community.lexicon.annotation.annotation#xpathSelector"
190 },
191 "value": {
192 "type": "string",
193 "maxLength": 2000,
194 "description": "XPath expression"
195 }
196 }
197 },
198 "documentMetadata": {
199 "type": "object",
200 "description": "Metadata about the document being annotated",
201 "properties": {
202 "title": {
203 "type": "string",
204 "maxLength": 1000,
205 "description": "Document title"
206 },
207 "doi": {
208 "type": "string",
209 "maxLength": 500,
210 "description": "Digital Object Identifier"
211 },
212 "canonicalUri": {
213 "type": "string",
214 "format": "uri",
215 "description": "Canonical URI for this document"
216 }
217 }
218 }
219 }
220}