mdld-parse 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +34 -1
  2. package/dist/.nojekyll +0 -0
  3. package/dist/CNAME +1 -0
  4. package/dist/README.md +425 -0
  5. package/dist/docs/API.md +397 -0
  6. package/dist/docs/Architecture.md +190 -0
  7. package/dist/docs/Guide.md +322 -0
  8. package/dist/docs/LLM-MDLD-Inducer.md +550 -0
  9. package/dist/docs/Parser.md +654 -0
  10. package/dist/docs/Performance.md +238 -0
  11. package/dist/docs/Spec-render.md +1439 -0
  12. package/dist/docs/Subject.md +180 -0
  13. package/dist/docs/Syntax.md +463 -0
  14. package/dist/docs/TodoList.md +215 -0
  15. package/dist/docs/Use-Cases.md +354 -0
  16. package/dist/docs/index.html +108 -0
  17. package/dist/docs/index.md +56 -0
  18. package/dist/docs/origin.md +459 -0
  19. package/dist/docs/polarity.md +586 -0
  20. package/dist/docs/primary-subject.md +199 -0
  21. package/dist/docs/statements.md +226 -0
  22. package/dist/docs/tokenization-performance-report.md +164 -0
  23. package/dist/examples/Cookbook.md +32 -0
  24. package/dist/examples/Status-SHACL.md +33 -0
  25. package/dist/examples/demo/index.md +35 -0
  26. package/dist/examples/demo/journal.md +18 -0
  27. package/dist/examples/demo/minimal.md +11 -0
  28. package/dist/examples/demo/project.md +15 -0
  29. package/dist/examples/demo/recipe.md +31 -0
  30. package/dist/examples/demo/research.md +46 -0
  31. package/dist/examples/demo/space-mission.md +48 -0
  32. package/dist/examples/dogfood.md +288 -0
  33. package/dist/examples/few-shot.md +309 -0
  34. package/dist/examples/graph/rdf-graph.html +473 -0
  35. package/dist/examples/graph/rdf_force_graph_web_component.html +506 -0
  36. package/dist/examples/index.md +45 -0
  37. package/dist/examples/llm-time-workflow.md +173 -0
  38. package/dist/examples/prov-o.md +2367 -0
  39. package/dist/examples/rdf.md +827 -0
  40. package/dist/examples/shacl.md +3399 -0
  41. package/dist/examples/statements.md +43 -0
  42. package/dist/examples/workflow.md +150 -0
  43. package/dist/index.html +2827 -0
  44. package/dist/index.js +1548 -0
  45. package/dist/logo.svg +7 -0
  46. package/dist/spec/Spec-compact.md +363 -0
  47. package/dist/spec/Spec-ultra.md +221 -0
  48. package/dist/spec/Spec.md +1068 -0
  49. package/dist/spec/index.md +46 -0
  50. package/package.json +13 -8
  51. package/src/constants.js +0 -31
  52. package/src/generate.js +0 -245
  53. package/src/index.js +0 -13
  54. package/src/locate.js +0 -23
  55. package/src/merge.js +0 -157
  56. package/src/parse.js +0 -765
  57. package/src/render.js +0 -576
  58. package/src/shared.js +0 -577
  59. package/src/utils.js +0 -430
@@ -0,0 +1,397 @@
1
+ # MD-LD API Reference
2
+
3
+ Complete API documentation for MD-LD parser with tested examples.
4
+
5
+ ## Core Functions
6
+
7
+ ### `parse({ text, context, dataFactory, graph })`
8
+
9
+ Parse MD-LD markdown and return RDF quads.
10
+
11
+ **Parameters (named object):**
12
+ - `text` (string, required) — MD-LD formatted text
13
+ - `context` (object, optional) — Prefix mappings (default: `{}`)
14
+ - `dataFactory` (object, optional) — Custom RDF/JS DataFactory
15
+ - `graph` (string, optional) — Named graph IRI
16
+
17
+ **Returns:** `{ quads, context, primarySubject, origin, remove, statements }`
18
+
19
+ - `quads` — Array of RDF/JS Quads (final resolved graph state)
20
+ - `remove` — Array of RDF/JS Quads (external retractions targeting prior state)
21
+ - `origin` — Lean origin tracking object with quadIndex for UI navigation
22
+ - `context` — Final context used (includes prefixes)
23
+ - `primarySubject` — String IRI or null (first non-fragment subject declaration)
24
+
25
+ > Legacy: `parse(text, options)` supported for backward compatibility (deprecated)
26
+
27
+ #### Basic Example
28
+
29
+ ```javascript
30
+ import { parse } from 'mdld-parse';
31
+
32
+ const result = parse(`
33
+ [ex] <http://example.org/>
34
+
35
+ # Document {=ex:doc .ex:Article}
36
+ [Alice] {?ex:author =ex:alice .prov:Person ex:firstName label}
37
+ [Smith] {ex:lastName}`);
38
+
39
+ console.log(result.quads);
40
+ // [
41
+ // {
42
+ // subject: { termType: 'NamedNode', value: 'http://example.org/doc' },
43
+ // predicate: { termType: 'NamedNode', value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' },
44
+ // object: { termType: 'NamedNode', value: 'http://example.org/Article' }
45
+ // },
46
+ // {
47
+ // subject: { termType: 'NamedNode', value: 'http://example.org/doc' },
48
+ // predicate: { termType: 'NamedNode', value: 'http://example.org/author' },
49
+ // object: { termType: 'NamedNode', value: 'http://example.org/alice' }
50
+ // },
51
+ // {
52
+ // subject: { termType: 'NamedNode', value: 'http://example.org/alice' },
53
+ // predicate: { termType: 'NamedNode', value: 'http://www.w3.org/2000/01/rdf-schema#label' },
54
+ // object: { termType: 'Literal', value: 'Alice' }
55
+ // },
56
+ // {
57
+ // subject: { termType: 'NamedNode', value: 'http://example.org/alice' },
58
+ // predicate: { termType: 'NamedNode', value: 'http://example.org/firstName' },
59
+ // object: { termType: 'Literal', value: 'Alice' }
60
+ // },
61
+ // {
62
+ // subject: { termType: 'NamedNode', value: 'http://example.org/alice' },
63
+ // predicate: { termType: 'NamedNode', value: 'http://example.org/lastName' },
64
+ // object: { termType: 'Literal', value: 'Smith' }
65
+ // }
66
+ // ]
67
+ ```
68
+
69
+ #### Polarity Example
70
+
71
+ ```javascript
72
+ const result = parse({
73
+ text: `# Article {=ex:article .ex:Article}
74
+
75
+ [Bob] {+ex:bob -?ex:author} is not an author of this article, it's [Alice] {+ex:alice ?ex:author}.
76
+ `, // Remove previous author
77
+ context: { ex: 'http://example.org/' }
78
+ });
79
+
80
+ console.log(result.quads);
81
+ // [
82
+ // {
83
+ // subject: { termType: 'NamedNode', value: 'http://example.org/article' },
84
+ // predicate: { termType: 'NamedNode', value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' },
85
+ // object: { termType: 'NamedNode', value: 'http://example.org/Article' }
86
+ // },
87
+ // {
88
+ // subject: { termType: 'NamedNode', value: 'http://example.org/article' },
89
+ // predicate: { termType: 'NamedNode', value: 'http://example.org/author' },
90
+ // object: { termType: 'NamedNode', value: 'http://example.org/alice' }
91
+ // }
92
+ // ]
93
+
94
+ console.log(result.remove);
95
+ // [] - Empty because Alice author was cancelled in-stream
96
+ ```
97
+
98
+ #### External Retraction Example
99
+
100
+ ```javascript
101
+ const result2 = parse({ text:
102
+ `# Article {=ex:article}
103
+ [Alice] {+ex:alice -?ex:author}`, // External retract (Alice not in current state)
104
+ context: { ex: 'http://example.org/' } }
105
+ );
106
+
107
+ console.log(result2.remove);
108
+ // [
109
+ // {
110
+ // subject: { termType: 'NamedNode', value: 'http://example.org/article' },
111
+ // predicate: { termType: 'NamedNode', value: 'http://example.org/author' },
112
+ // object: { termType: 'NamedNode', value: 'http://example.org/alice' }
113
+ // }
114
+ // ]
115
+ ```
116
+
117
+ ### `merge(docs, options)`
118
+
119
+ Merge multiple MDLD documents with diff polarity resolution.
120
+
121
+ **Parameters:**
122
+ - `docs` (array) — Array of markdown strings or ParseResult objects
123
+ - `options` (object, optional):
124
+ - `context` (object) — Prefix mappings (merged with DEFAULT_CONTEXT)
125
+
126
+ **Returns:** `{ quads, remove, origin, context }`
127
+
128
+ - `quads` — Merged array of RDF/JS Quads
129
+ - `remove` — Array of retractions from merge process
130
+ - `origin` — Merge origin with document chain:
131
+ - `documents` — Array of document metadata
132
+ - `quadIndex` — Combined quad index from all documents
133
+ - `context` — Final merged context
134
+
135
+ #### Basic Merge Example
136
+
137
+ ```javascript
138
+ import { merge } from 'mdld-parse';
139
+
140
+ const merged = merge([
141
+ `# Article {=ex:article}
142
+ [Bob] {author}`,
143
+ `# Article {=ex:article}
144
+ [Bob] {-author}
145
+ [Charlie] {author}`
146
+ ], { context: { ex: 'http://example.org/' } });
147
+
148
+ console.log(merged.quads.length); // 2 (type + Charlie author)
149
+ console.log(merged.remove.length); // 1 (Bob author removal)
150
+ ```
151
+
152
+ #### Version Control Example
153
+
154
+ ```javascript
155
+ const v1 = `# Article {=ex:article .ex:Article}
156
+ [Alice] {author}
157
+ [Draft] {status}`;
158
+
159
+ const v2 = `# Article {=ex:article}
160
+ [Alice] {-author} // Retract original
161
+ [Bob] {author} // Add new author
162
+ [Draft] {-status} // Retract draft status
163
+ [Published] {status} // Add published status`;
164
+
165
+ const merged = merge([v1, v2]);
166
+ console.log(merged.quads.map(q => `${q.subject.value.split('/').pop()} ${q.predicate.value} ${q.object.value}`));
167
+ // ['article rdf:type Article', 'article author Bob', 'article status Published']
168
+ ```
169
+
170
+ ### `generate({ quads, context, primarySubject })`
171
+
172
+ Generate deterministic MDLD from RDF quads with visual styling.
173
+
174
+ **Parameters (named object):**
175
+ - `quads` (array, required) — Array of RDF/JS Quads to convert
176
+ - `context` (object, optional) — Prefix mappings (default: `{}`)
177
+ - `primarySubject` (string, optional) — IRI to place first in output (ensures round-trip safety)
178
+
179
+ **Returns:** `{ text, context }`
180
+
181
+ - `text` — Generated MDLD markdown
182
+ - `context` — Final context used (includes defaults)
183
+
184
+ #### Generate Example
185
+
186
+ ```javascript
187
+ import { generate } from 'mdld-parse';
188
+
189
+ const quads = [
190
+ {
191
+ subject: { termType: 'NamedNode', value: 'http://example.org/article' },
192
+ predicate: { termType: 'NamedNode', value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' },
193
+ object: { termType: 'NamedNode', value: 'http://example.org/Article' }
194
+ },
195
+ {
196
+ subject: { termType: 'NamedNode', value: 'http://example.org/article' },
197
+ predicate: { termType: 'NamedNode', value: 'http://example.org/author' },
198
+ object: { termType: 'NamedNode', value: 'http://example.org/alice' }
199
+ }
200
+ ];
201
+
202
+ const result = generate({
203
+ quads,
204
+ context: { ex: 'http://example.org/' }
205
+ });
206
+
207
+ console.log(result.text);
208
+ // # Article {=ex:article .ex:Article}
209
+ //
210
+ // > alice {+ex:alice ?ex:author}
211
+ ```
212
+
213
+ ### `locate(quad, origin)`
214
+
215
+ Locate the origin entry for a quad using the lean origin system.
216
+
217
+ **Parameters:**
218
+ - `quad` (object) — The quad to locate (subject, predicate, object)
219
+ - `origin` (object) — Origin object containing quadIndex
220
+
221
+ **Returns:** `{ blockId, range, carrierType, subject, predicate, context, value, polarity }` or `null`
222
+
223
+ - `blockId` — ID of the containing block
224
+ - `range` — Character range of the carrier in the source text
225
+ - `carrierType` — Type of carrier (heading, blockquote, span)
226
+ - `subject` — Subject IRI of the quad
227
+ - `predicate` — Predicate IRI of the quad
228
+ - `context` — Context object inherited from parsing
229
+ - `value` — Raw carrier text content
230
+ - `polarity` — '+' for assertions, '-' for retractions
231
+
232
+ #### Locate Example
233
+
234
+ ```javascript
235
+ import { parse, locate } from 'mdld-parse';
236
+
237
+ const result = parse({ text: mdldText, context: { ex: 'http://example.org/' } });
238
+ const quad = result.quads[0]; // Find a quad to locate
239
+
240
+ const location = locate(quad, result.origin);
241
+
242
+ console.log(location.range); // { start: 38, end: 44 }
243
+ console.log(location.value); // "Alice"
244
+ console.log(location.carrierType); // "blockquote"
245
+ ```
246
+
247
+ ### `render(quads, options)`
248
+
249
+ Render RDF quads as HTML+RDFa for web display.
250
+
251
+ **Parameters:**
252
+ - `quads` (array) — Array of RDF/JS Quads to render
253
+ - `options` (object, optional):
254
+ - `context` (object) — Prefix mappings for CURIE shortening
255
+ - `baseIRI` (string) — Base IRI for resolving relative references
256
+
257
+ **Returns:** `{ html, context }`
258
+
259
+ - `html` — HTML string with RDFa annotations
260
+ - `context` — Context used for rendering
261
+
262
+ #### Render Example
263
+
264
+ ```javascript
265
+ import { parse, render } from 'mdld-parse';
266
+
267
+ const result = parse({ text: mdldText});
268
+ const rendered = render(result.quads, { ex: 'http://example.org/' });
269
+
270
+ console.log(rendered.html);
271
+ // <div typeof="ex:Article">
272
+ // <span property="ex:author">Alice</span>
273
+ // </div>
274
+ ```
275
+
276
+ ## Utility Functions
277
+
278
+ ```javascript
279
+ import {
280
+ DEFAULT_CONTEXT, // Default prefix mappings
281
+ DataFactory, // RDF/JS DataFactory instance
282
+ hash, // String hashing function
283
+ expandIRI, // IRI expansion with context
284
+ shortenIRI, // IRI shortening with context
285
+ parseSemanticBlock // Parse semantic block syntax
286
+ } from 'mdld-parse';
287
+ ```
288
+
289
+ ### DEFAULT_CONTEXT
290
+
291
+ ```javascript
292
+ {
293
+ '@vocab': 'http://www.w3.org/2000/01/rdf-schema#',
294
+ 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
295
+ 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
296
+ 'xsd': 'http://www.w3.org/2001/XMLSchema#',
297
+ 'sh': 'http://www.w3.org/ns/shacl#',
298
+ 'prov': 'http://www.w3.org/ns/prov#'
299
+ }
300
+ ```
301
+
302
+ ### DataFactory
303
+
304
+ RDF/JS DataFactory instance for creating RDF terms:
305
+
306
+ ```javascript
307
+ DataFactory.namedNode('http://example.org/subject')
308
+ DataFactory.literal('value')
309
+ DataFactory.quad(subject, predicate, object, graph)
310
+ ```
311
+
312
+ ### Hash Function
313
+
314
+ Generate consistent hashes for identifiers:
315
+
316
+ ```javascript
317
+ hash('content') // Returns: '5f4dcc3b5aa765d61d8327deb882cf99'
318
+ ```
319
+
320
+ ### IRI Expansion/Shortening
321
+
322
+ Context-aware IRI manipulation:
323
+
324
+ ```javascript
325
+ const context = { ex: 'http://example.org/' };
326
+
327
+ expandIRI('ex:term', context) // 'http://example.org/term'
328
+ shortenIRI('http://example.org/term', context) // 'ex:term'
329
+ ```
330
+
331
+ ### Semantic Block Parser
332
+
333
+ Parse individual annotation blocks:
334
+
335
+ ```javascript
336
+ parseSemanticBlock('{author}', context) // Returns parsed annotation object
337
+ ```
338
+
339
+ ## Error Handling
340
+
341
+ ### Common Errors
342
+
343
+ - **Invalid syntax** - Malformed annotations or prefixes
344
+ - **Missing context** - Undefined prefixes in IRI expansion
345
+ - **Type errors** - Invalid datatype or language combinations
346
+
347
+ ### Error Messages
348
+
349
+ The parser provides clear error messages with line numbers:
350
+
351
+ ```javascript
352
+ try {
353
+ const result = parse({text:invalidMarkdown});
354
+ } catch (error) {
355
+ console.error(error.message); // "Invalid annotation at line 5: ..."
356
+ }
357
+ ```
358
+
359
+ ## Performance Characteristics
360
+
361
+ - **O(n) parsing** - Single pass, linear time complexity
362
+ - **Memory efficient** - Streaming-friendly, minimal state
363
+ - **Deterministic** - Same input always produces same output
364
+ - **Zero dependencies** - Pure JavaScript implementation
365
+
366
+ ## RDF/JS Compatibility
367
+
368
+ Generated quads are standard RDF/JS Quad objects compatible with:
369
+
370
+ - **n3.js** - Turtle/N-Triples serialization
371
+ - **rdflib.js** - RDF store and reasoning
372
+ - **sparqljs** - SPARQL queries and updates
373
+ - **rdf-ext** - Extended RDF utilities
374
+
375
+ ## Browser Support
376
+
377
+ MD-LD works in modern browsers with ES module support:
378
+
379
+ ```html
380
+ <script type="module">
381
+ import { parse } from 'https://cdn.jsdelivr.net/npm/mdld-parse/+esm';
382
+
383
+ const result = parse('# Hello {=ex:hello label}');
384
+ </script>
385
+ ```
386
+
387
+ ## Node.js Support
388
+
389
+ Full Node.js support with CommonJS and ES modules:
390
+
391
+ ```javascript
392
+ // ES Modules
393
+ import { parse } from 'mdld-parse';
394
+
395
+ // CommonJS
396
+ const { parse } = require('mdld-parse');
397
+ ```
@@ -0,0 +1,190 @@
1
+ # MDLD Architecture
2
+
3
+ ## Design Principles
4
+
5
+ MDLD follows strict engineering principles for reliability and performance:
6
+
7
+ - **Zero dependencies** — Pure JavaScript, ~15KB minified
8
+ - **Streaming-first** — Single-pass parsing, O(n) complexity
9
+ - **Character-based tokenization** — 20-28% faster than regex-based approaches
10
+ - **Memory-efficient** — ~640 bytes per quad retained after GC
11
+ - **Standards-compliant** — RDF/JS data model
12
+ - **Origin tracking** — Full round-trip support with source maps
13
+ - **Explicit semantics** — No guessing, inference, or heuristics
14
+
15
+ ## Processing Pipeline
16
+
17
+ Document processing follows this pipeline:
18
+
19
+ 1. **Line-by-line scanning** — Sequential token creation
20
+ 2. **Context resolution** — Prefix and vocabulary expansion
21
+ 3. **Subject tracking** — Current subject management
22
+ 4. **Annotation processing** — Semantic block evaluation
23
+ 5. **Quad emission** — RDF triple generation
24
+
25
+ ## Core Parser Structures
26
+
27
+ ### Token Processing Pipeline
28
+
29
+ The parser uses character-based tokenizers for optimal performance:
30
+
31
+ ```javascript
32
+ const PROCESSORS = [
33
+ { type: 'fence', test: line => detectFence(line.trim()), process: handleFence },
34
+ { type: 'content', test: () => codeBlock, process: line => codeBlock.content.push(line) },
35
+ { type: 'prefix', test: line => detectPrefix(line), process: handlePrefix },
36
+ { type: 'standalone', test: line => detectStandaloneSubject(line), process: handleStandaloneSubject },
37
+ { type: 'heading', test: line => detectHeading(line), process: handleHeading },
38
+ { type: 'list', test: line => detectList(line), process: handleList },
39
+ { type: 'blockquote', test: line => detectBlockquote(line), process: handleBlockquote },
40
+ { type: 'para', test: line => line.trim(), process: handlePara }
41
+ ];
42
+ ```
43
+
44
+ ### Character-Based Tokenization
45
+
46
+ Character-based tokenizers replace regex patterns for performance:
47
+
48
+ - **detectFence()** — Code block fence detection
49
+ - **detectPrefix()** — Namespace prefix declarations
50
+ - **detectHeading()** — Markdown heading detection
51
+ - **detectList()** — List item detection
52
+ - **detectBlockquote()** — Blockquote detection
53
+ - **detectStandaloneSubject()** — Subject annotation detection
54
+
55
+ ### Semantic Block Processing
56
+
57
+ The parser processes semantic annotations in context:
58
+
59
+ ```javascript
60
+ // Subject declaration
61
+ [entity] {=ex:Entity .rdfs:Class label}
62
+
63
+ // Object introduction
64
+ [related] {+ex:related ?rdfs:subClassOf}
65
+
66
+ // Property assertion
67
+ has [property] {+ex:property ?ex:hasProperty}
68
+ ```
69
+
70
+ ### Data Structures
71
+
72
+ **Parser State:**
73
+ ```javascript
74
+ {
75
+ prefixes: Map<string, string>, // prefix → IRI mappings
76
+ currentSubject: NamedNode|null, // active subject
77
+ codeBlock: CodeBlock|null, // fenced content
78
+ quads: Quad[], // emitted triples
79
+ origins: Origin[] // source tracking
80
+ }
81
+ ```
82
+
83
+ **Quad Generation:**
84
+ ```javascript
85
+ {
86
+ subject: NamedNode,
87
+ predicate: NamedNode,
88
+ object: Literal|NamedNode,
89
+ graph: NamedNode
90
+ }
91
+ ```
92
+
93
+ ## Performance Architecture
94
+
95
+ ### Memory Management
96
+
97
+ - **Streaming parsing** — Full document never in memory
98
+ - **Lazy evaluation** — Context computed on demand
99
+ - **Efficient indexing** — O(1) subject/object/predicate lookup
100
+ - **Garbage collection** — Minimal retained state
101
+
102
+ ### Character-Based Optimization
103
+
104
+ Character-based tokenizers provide:
105
+ - **20-28% faster** parsing than regex-based approaches
106
+ - **Predictable performance** — O(n) complexity
107
+ - **Memory efficiency** — No regex engine overhead
108
+ - **Maintainability** — Clear character logic
109
+
110
+ ### Scaling Architecture
111
+
112
+ **Real-time Applications (60fps):**
113
+ - Maximum: 4,527 quads per frame
114
+ - Use case: Interactive knowledge graphs
115
+ - Pattern: Incremental updates only
116
+
117
+ **Batch Processing (1-second):**
118
+ - Maximum: 225,059 quads per second
119
+ - Use case: Background reindexing, imports
120
+ - Pattern: Worker thread, chunked processing
121
+
122
+ **Enterprise Scale:**
123
+ - Small (<4K quads): Real-time updates
124
+ - Medium (4-225K quads): Batch reindexing
125
+ - Large (>225K quads): Streaming architecture
126
+
127
+ ## Extensibility
128
+
129
+ ### Plugin Architecture
130
+
131
+ The parser supports extensions through:
132
+
133
+ - **Custom tokenizers** — Add new block types
134
+ - **Semantic processors** — Custom annotation handling
135
+ - **Output formats** — Alternative serialization
136
+ - **Validation hooks** — Custom constraint checking
137
+
138
+ ### Integration Points
139
+
140
+ - **Parse hooks** — Pre/post processing
141
+ - **Context injection** — Dynamic prefix resolution
142
+ - **Error handling** — Custom error strategies
143
+ - **Performance monitoring** — Built-in profiling
144
+
145
+ ## Standards Compliance
146
+
147
+ ### RDF/JS Data Model
148
+
149
+ MDLD implements the RDF/JS data model specification:
150
+ - **NamedNode** — IRIs and CURIEs
151
+ - **Literal** — Typed and language-tagged values
152
+ - **Quad** — RDF triples with graph context
153
+ - **Dataset** — Quad collections with indexing
154
+
155
+ ### W3C Standards
156
+
157
+ - **RDF 1.1** — Core RDF concepts
158
+ - **RDFS** — Schema vocabulary
159
+ - **PROV-O** — Provenance ontology
160
+ - **SHACL** — Constraint validation
161
+ - **CURIE 1.0** — Compact URI syntax
162
+
163
+ ## Implementation Notes
164
+
165
+ ### Single-Pass Design
166
+
167
+ The parser processes documents in a single forward pass:
168
+ - No backtracking or look-ahead beyond current line
169
+ - Streaming-friendly for large documents
170
+ - Predictable memory usage
171
+ - Linear time complexity
172
+
173
+ ### Error Handling
174
+
175
+ - **Graceful degradation** — Continue parsing on errors
176
+ - **Context preservation** — Maintain parser state
177
+ - **Detailed reporting** — Line/column information
178
+ - **Recovery strategies** — Skip invalid content
179
+
180
+ ### Testing Strategy
181
+
182
+ - **Unit tests** — Individual tokenizer validation
183
+ - **Integration tests** — End-to-end parsing
184
+ - **Performance tests** — Benchmarking at scale
185
+ - **Real-world tests** — Actual ontology validation
186
+
187
+ ---
188
+
189
+ For detailed parser internals, see **[Parser Documentation](./Parser.md)**.
190
+ For performance metrics and testing methods, see **[Performance Documentation](./Performance.md)**.