mdld-parse 0.9.9 → 1.0.0

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 (55) hide show
  1. package/README.md +242 -330
  2. package/dist/index.js +1793 -1336
  3. package/package.json +4 -4
  4. package/dist/.nojekyll +0 -0
  5. package/dist/CNAME +0 -1
  6. package/dist/README.md +0 -500
  7. package/dist/docs/API.md +0 -435
  8. package/dist/docs/Architecture.md +0 -190
  9. package/dist/docs/Guide.md +0 -816
  10. package/dist/docs/LLM-MDLD-Inducer.md +0 -550
  11. package/dist/docs/LiterateRDF.md +0 -472
  12. package/dist/docs/Parser.md +0 -720
  13. package/dist/docs/Performance.md +0 -238
  14. package/dist/docs/Spec-render.md +0 -1439
  15. package/dist/docs/Subject.md +0 -180
  16. package/dist/docs/Syntax.md +0 -463
  17. package/dist/docs/TodoList.md +0 -215
  18. package/dist/docs/Use-Cases.md +0 -354
  19. package/dist/docs/guide-m.md +0 -56
  20. package/dist/docs/index.html +0 -108
  21. package/dist/docs/index.md +0 -56
  22. package/dist/docs/one-page.md +0 -322
  23. package/dist/docs/origin.md +0 -460
  24. package/dist/docs/polarity.md +0 -586
  25. package/dist/docs/primary-subject.md +0 -326
  26. package/dist/docs/statements.md +0 -226
  27. package/dist/docs/tokenization-performance-report.md +0 -164
  28. package/dist/examples/Cookbook.md +0 -32
  29. package/dist/examples/Status-SHACL.md +0 -31
  30. package/dist/examples/demo/index.md +0 -35
  31. package/dist/examples/demo/journal.md +0 -58
  32. package/dist/examples/demo/minimal.md +0 -23
  33. package/dist/examples/demo/project.md +0 -84
  34. package/dist/examples/demo/prov.md +0 -107
  35. package/dist/examples/demo/rdf.md +0 -69
  36. package/dist/examples/demo/recipe.md +0 -50
  37. package/dist/examples/demo/research.md +0 -84
  38. package/dist/examples/demo/shacl.md +0 -161
  39. package/dist/examples/demo/space-mission.md +0 -58
  40. package/dist/examples/demo/tasks.md +0 -175
  41. package/dist/examples/demo/xsd.md +0 -91
  42. package/dist/examples/dogfood.md +0 -288
  43. package/dist/examples/few-shot.md +0 -309
  44. package/dist/examples/graph/rdf-graph.html +0 -473
  45. package/dist/examples/graph/rdf_force_graph_web_component.html +0 -506
  46. package/dist/examples/index.md +0 -45
  47. package/dist/examples/llm-time-workflow.md +0 -173
  48. package/dist/examples/statements.md +0 -43
  49. package/dist/examples/workflow.md +0 -150
  50. package/dist/index.html +0 -3049
  51. package/dist/logo.svg +0 -7
  52. package/dist/spec/Spec-compact.md +0 -368
  53. package/dist/spec/Spec-ultra.md +0 -232
  54. package/dist/spec/Spec.md +0 -1116
  55. package/dist/spec/index.md +0 -46
@@ -1,550 +0,0 @@
1
- # LLM MDLD Pattern Inducer
2
-
3
- **Pattern-first grounding for semantic MDLD authoring**
4
-
5
- ---
6
-
7
- ## Default Prefixes (Always Available)
8
-
9
- ```
10
- [@vocab] <http://www.w3.org/2000/01/rdf-schema#>
11
-
12
- [rdfs] <http://www.w3.org/2000/01/rdf-schema#>
13
- [xsd] <http://www.w3.org/2001/XMLSchema#>
14
- [sh] <http://www.w3.org/ns/shacl#>
15
- [prov] <http://www.w3.org/ns/prov#>
16
- ```
17
-
18
- Add custom prefixes: `[prefix] <IRI>`
19
-
20
- ---
21
-
22
- ## Pattern 1: Simple Entity with Literal Properties
23
-
24
- ```md
25
- [my] <tag:myemail@example.com,2026:>
26
-
27
- # Document Title {=my:document .my:Document label}
28
-
29
- This document has a [title] {my:title} and was created on [2026-01-15] {my:created ^^xsd:date}.
30
- The author is [Alice] {my:author}.
31
- ```
32
-
33
- **Emits:**
34
- - `my:document rdf:type my:Document`
35
- - `my:document rdfs:label "Document Title"`
36
- - `my:document my:title "title"`
37
- - `my:document my:created "2026-01-15"^^xsd:date`
38
- - `my:document my:author "Alice"`
39
-
40
- ---
41
-
42
- ## Pattern 2: Entity with Object Properties (Subject Chaining)
43
-
44
- ```md
45
- [my] <tag:myemail@example.com,2026:>
46
-
47
- # Project {=my:project .my:Project label}
48
-
49
- The project is led by [Alice] {+my:alice ?my:lead .my:Person label} and includes [Bob] {+my:bob ?my:member .my:Person label}.
50
- ```
51
-
52
- **Emits:**
53
- - `my:project rdf:type my:Project`
54
- - `my:project rdfs:label "Project"`
55
- - `my:project my:lead my:alice`
56
- - `my:alice rdf:type my:Person`
57
- - `my:alice rdfs:label "Alice"`
58
- - `my:project my:member my:bob`
59
- - `my:bob rdf:type my:Person`
60
- - `my:bob rdfs:label "Bob"`
61
-
62
- **Key:** `{+IRI}` introduces temporary object, subject remains `my:project`
63
-
64
- ---
65
-
66
- ## Pattern 3: Fragment Subjects for Related Entities
67
-
68
- ```md
69
- [ex] <http://example.org/>
70
-
71
- # Report {=ex:report .ex:Report label}
72
-
73
- Contains sections:
74
- - Introduction {+#intro ?ex:hasSection .ex:Section label}
75
- - Analysis {+#analysis ?ex:hasSection .ex:Section label}
76
- - Conclusion {+#conclusion ?ex:hasSection .ex:Section label}
77
- ```
78
-
79
- **Emits:**
80
- - `ex:report rdf:type ex:Report`
81
- - `ex:report ex:hasSection ex:report#intro`
82
- - `ex:report#intro rdf:type ex:Section`
83
- - `ex:report#intro rdfs:label "Introduction"`
84
- - `ex:report ex:hasSection ex:report#analysis`
85
- - `ex:report#analysis rdf:type ex:Section`
86
- - `ex:report#analysis rdfs:label "Analysis"`
87
- - `ex:report ex:hasSection ex:report#conclusion`
88
- - `ex:report#conclusion rdf:type ex:Section`
89
- - `ex:report#conclusion rdfs:label "Conclusion"`
90
-
91
- **Key:** `{=#fragment}` creates `currentSubjectBase#fragment`
92
-
93
- ---
94
-
95
- ## Pattern 4: Lists (No Semantic Scope - Explicit Annotations Required)
96
-
97
- ```md
98
- [ex] <http://example.org/>
99
-
100
- # Team {=ex:team .ex:Team label}
101
-
102
- Members:
103
- - **Alice** {+ex:alice ?ex:member .ex:Person label}
104
- - **Bob** {+ex:bob ?ex:member .ex:Person label}
105
- - **Carol** {+ex:carol ?ex:member .ex:Person label}
106
- ```
107
-
108
- **Emits:**
109
- - `ex:team rdf:type ex:Team`
110
- - `ex:team ex:member ex:alice`
111
- - `ex:alice rdf:type ex:Person`
112
- - `ex:alice rdfs:label "Alice"`
113
- - `ex:team ex:member ex:bob`
114
- - `ex:bob rdf:type ex:Person`
115
- - `ex:bob rdfs:label "Bob"`
116
- - `ex:team ex:member ex:carol`
117
- - `ex:carol rdf:type ex:Person`
118
- - `ex:carol rdfs:label "Carol"`
119
-
120
- **Critical:** Each list item needs explicit `{+IRI ?predicate}` - no inheritance
121
-
122
- ---
123
-
124
- ## Pattern 5: Reverse Relationships with !
125
-
126
- ```md
127
- [ex] <http://example.org/>
128
-
129
- # Recipe {=ex:recipe .ex:Recipe label}
130
-
131
- Ingredients used in this recipe:
132
- - Flour {+ex:Flour !hasIngredient}
133
- - Sugar {+ex:Sugar !hasIngredient}
134
- - Eggs {+ex:Eggs !hasIngredient}
135
- ```
136
-
137
- **Emits:**
138
- - `ex:recipe rdf:type ex:Recipe`
139
- - `ex:Flour ex:hasIngredient ex:recipe`
140
- - `ex:Sugar ex:hasIngredient ex:recipe`
141
- - `ex:Eggs ex:hasIngredient ex:recipe`
142
-
143
- **Key:** `!predicate` flips direction: Object → Subject
144
-
145
- ---
146
-
147
- ## Pattern 6: PROV Entity with Provenance
148
-
149
- ```md
150
- [prov] <http://www.w3.org/ns/prov#>
151
- [ex] <tag:example.org,2026:>
152
-
153
- # Dataset {=ex:dataset .prov:Entity label}
154
-
155
- Created at [2026-01-15T10:00:00Z] {prov:generatedAtTime ^^xsd:dateTime} by [Alice] {+ex:alice .prov:Agent ?prov:wasAttributedTo} during the [Data Collection] {+ex:collection .prov:Activity ?prov:wasGeneratedBy}.
156
- ```
157
-
158
- **Emits:**
159
- - `ex:dataset rdf:type prov:Entity`
160
- - `ex:dataset prov:generatedAtTime "2026-01-15T10:00:00Z"^^xsd:dateTime`
161
- - `ex:dataset prov:wasAttributedTo ex:alice`
162
- - `ex:alice rdf:type prov:Agent`
163
- - `ex:dataset prov:wasGeneratedBy ex:collection`
164
- - `ex:collection rdf:type prov:Activity`
165
-
166
- ---
167
-
168
- ## Pattern 7: PROV Activity with Temporal and Agent
169
-
170
- ```md
171
- [prov] <http://www.w3.org/ns/prov#>
172
- [ex] <tag:example.org,2026:>
173
-
174
- # Data Processing {=ex:processing .prov:Activity label}
175
-
176
- Started at [2026-01-15T09:00:00Z] {prov:startedAtTime ^^xsd:dateTime} and ended at [2026-01-15T11:00:00Z] {prov:endedAtTime ^^xsd:dateTime}.
177
- Performed by [Alice] {+ex:alice .prov:Agent ?prov:wasAssociatedWith}.
178
- Used the [Raw Data] {+ex:rawData .prov:Entity ?prov:used}.
179
- ```
180
-
181
- **Emits:**
182
- - `ex:processing rdf:type prov:Activity`
183
- - `ex:processing prov:startedAtTime "2026-01-15T09:00:00Z"^^xsd:dateTime`
184
- - `ex:processing prov:endedAtTime "2026-01-15T11:00:00Z"^^xsd:dateTime`
185
- - `ex:processing prov:wasAssociatedWith ex:alice`
186
- - `ex:alice rdf:type prov:Agent`
187
- - `ex:processing prov:used ex:rawData`
188
- - `ex:rawData rdf:type prov:Entity`
189
-
190
- ---
191
-
192
- ## Pattern 8: PROV Complete Workflow (Entity → Activity → Entity)
193
-
194
- ```md
195
- [prov] <http://www.w3.org/ns/prov#>
196
- [ex] <tag:example.org,2026:>
197
-
198
- # User Request {=ex:request .prov:Entity label}
199
- Received at [2026-03-10T14:51:05Z] {prov:generatedAtTime ^^xsd:dateTime} from [User] {+ex:user .prov:Agent ?prov:wasAttributedTo}.
200
-
201
- ~~~~~~ {prov:value}
202
- What time is it?
203
- ~~~~~~
204
-
205
- # Time Query Activity {=ex:activity .prov:Activity}
206
- Started at [2026-03-10T14:51:10Z] {prov:startedAtTime ^^xsd:dateTime}, ended at [2026-03-10T14:51:12Z] {prov:endedAtTime ^^xsd:dateTime}.
207
- Led by [LLM Agent] {+ex:agent .prov:SoftwareAgent ?prov:wasAssociatedWith}.
208
- Used the [request] {+ex:request ?prov:used}.
209
-
210
- # Time Response {=ex:response .prov:Entity ?prov:generated label}
211
- Generated at [2026-03-10T14:51:15Z] {prov:generatedAtTime ^^xsd:dateTime}.
212
- Derived from [request] {+ex:request ?prov:wasDerivedFrom}.
213
- Attributed to [agent] {+ex:agent ?prov:wasAttributedTo}.
214
- ```
215
-
216
- **Emits:**
217
- - `ex:request rdf:type prov:Entity`
218
- - `ex:request prov:generatedAtTime "2026-03-10T14:51:05Z"^^xsd:dateTime`
219
- - `ex:request prov:wasAttributedTo ex:user`
220
- - `ex:user rdf:type prov:Agent`
221
- - `ex:request prov:value "What time is it?"`
222
- - `ex:activity rdf:type prov:Activity`
223
- - `ex:activity prov:startedAtTime "2026-03-10T14:51:10Z"^^xsd:dateTime`
224
- - `ex:activity prov:endedAtTime "2026-03-10T14:51:12Z"^^xsd:dateTime`
225
- - `ex:activity prov:wasAssociatedWith ex:agent`
226
- - `ex:agent rdf:type prov:SoftwareAgent`
227
- - `ex:activity prov:used ex:request`
228
- - `ex:response rdf:type prov:Entity`
229
- - `ex:response prov:generatedAtTime "2026-03-10T14:51:15Z"^^xsd:dateTime`
230
- - `ex:response prov:wasDerivedFrom ex:request`
231
- - `ex:response prov:wasAttributedTo ex:agent`
232
-
233
- ---
234
-
235
- ## Pattern 9: SHACL Node Shape with Property Constraints
236
-
237
- ```md
238
- [sh] <http://www.w3.org/ns/shacl#>
239
- [ex] <tag:example.org,2026:>
240
-
241
- **User Validation Shape** {=ex:UserShape .sh:NodeShape label}
242
- Targets all [User] {+ex:User ?sh:targetClass} instances to have [username] {+#username ?sh:property sh:name} and [email] {+#email ?sh:property sh:name}.
243
-
244
- **Username is required** {=#username .sh:PropertyShape sh:message}
245
- Requires [username] {+ex:username ?sh:path} to have exactly [1] {sh:minCount sh:maxCount ^^xsd:integer} value.
246
-
247
- **Email is required** {=#email .sh:PropertyShape sh:message}
248
- Requires [email] {+ex:email ?sh:path} to be a valid email pattern [^.+@.+\..+] {sh:pattern}.
249
- ```
250
-
251
- **Emits:**
252
- - `ex:UserShape rdf:type sh:NodeShape`
253
- - `ex:UserShape rdfs:label "User Validation Shape"`
254
- - `ex:UserShape sh:targetClass ex:User`
255
- - `ex:UserShape sh:property ex:UserShape#username`
256
- - `ex:UserShape#username rdfs:label "username"`
257
- - `ex:UserShape sh:property ex:UserShape#email`
258
- - `ex:UserShape#email rdfs:label "email"`
259
- - `ex:UserShape#username rdf:type sh:PropertyShape`
260
- - `ex:UserShape#username sh:message "Username is required"`
261
- - `ex:UserShape#username sh:path ex:username`
262
- - `ex:UserShape#username sh:minCount 1^^xsd:integer`
263
- - `ex:UserShape#username sh:maxCount 1^^xsd:integer`
264
- - `ex:UserShape#email rdf:type sh:PropertyShape`
265
- - `ex:UserShape#email sh:message "Email is required"`
266
- - `ex:UserShape#email sh:path ex:email`
267
- - `ex:UserShape#email sh:pattern ".+@.+\..+"`
268
-
269
-
270
- ---
271
-
272
- ## Pattern 10: SHACL Shape with Test Data
273
-
274
- ```md
275
- [sh] <http://www.w3.org/ns/shacl#>
276
- [ex] <tag:example.org,2026:>
277
-
278
- **User Validation Shape** {=ex:UserShape .sh:NodeShape label}
279
- Targets all [User] {+ex:User ?sh:targetClass} instances to have [username] {+#username ?sh:property sh:name}.
280
-
281
- **Username is required** {=#username .sh:PropertyShape sh:message}
282
- Requires [username] {+ex:username ?sh:path} to have exactly [1] {sh:minCount ^^xsd:integer} value.
283
-
284
- {=}
285
-
286
- # Test Data
287
-
288
- ## Valid User {=ex:user1 .ex:User}
289
- Username: [alice] {ex:username}
290
-
291
- ## Invalid User {=ex:user2 .ex:User}
292
- Missing username - should fail validation.
293
- ```
294
-
295
- **Emits:**
296
- - Shape definition quads (from Pattern 9)
297
- - `ex:user1 rdf:type ex:User`
298
- - `ex:user1 ex:username "alice"`
299
- - `ex:user2 rdf:type ex:User`
300
-
301
- **Key:** `{=} resets subject before test data section
302
-
303
- ---
304
-
305
- ## Pattern 11: RDF Reification (Statement about Statement)
306
-
307
- ```md
308
- [ex] <tag:example.org,2026:>
309
-
310
- # Observation {=ex:obs1 .rdf:Statement label}
311
-
312
- I observed that [the sensor] {+ex:sensor ?rdf:subject} [reported] {+ex:reported ?rdf:predicate} a [temperature] {+ex:temp ?rdf:object} of [25] {ex:value ^^xsd:decimal}.
313
- ```
314
-
315
- **Emits:**
316
- - `ex:obs1 rdf:type rdf:Statement`
317
- - `ex:obs1 rdfs:label "Observation"`
318
- - `ex:obs1 rdf:subject ex:sensor`
319
- - `ex:obs1 rdf:predicate ex:reported`
320
- - `ex:obs1 rdf:object ex:temp`
321
- - `ex:obs1 ex:value 25^^xsd:decimal`
322
-
323
- ---
324
-
325
- ## Pattern 12: RDF List Construction
326
-
327
- ```md
328
- [ex] <tag:example.org,2026:>
329
-
330
- # Ordered List {=ex:list .rdf:List label}
331
-
332
- [head] {=ex:l1 ?rdf:first .rdf:List}
333
- [first item] {+ex:item1 ?rdf:first}
334
- [rest] {=ex:l2 ?rdf:rest}
335
- [second item] {+ex:item2 ?rdf:first}
336
- [nil] {+rdf:nil ?rdf:rest}
337
- ```
338
-
339
- **Emits:**
340
- - `ex:list rdf:type rdf:List`
341
- - `ex:list rdf:first ex:l1`
342
- - `ex:l1 rdf:first ex:item1`
343
- - `ex:l1 rdf:rest ex:l2`
344
- - `ex:l2 rdf:first ex:item2`
345
- - `ex:l2 rdf:rest rdf:nil`
346
-
347
- ---
348
-
349
- ## Pattern 13: RDFS Class Hierarchy
350
-
351
- ```md
352
- [rdfs] <http://www.w3.org/2000/01/rdf-schema#>
353
- [ex] <tag:example.org,2026:>
354
-
355
- # Person {=ex:Person .rdfs:Class label}
356
-
357
- [Employee] {=ex:Employee .rdfs:Class label} is a subclass of [Person] {+ex:Person ?rdfs:subClassOf}.
358
-
359
- [Manager] {=ex:Manager .rdfs:Class label} is a subclass of [Employee] {+ex:Employee ?rdfs:subClassOf}.
360
- ```
361
-
362
- **Emits:**
363
- - `ex:Person rdf:type rdfs:Class`
364
- - `ex:Person rdfs:label "Person"`
365
- - `ex:Employee rdf:type rdfs:Class`
366
- - `ex:Employee rdfs:subClassOf ex:Person`
367
- - `ex:Manager rdf:type rdfs:Class`
368
- - `ex:Manager rdfs:subClassOf ex:Employee`
369
-
370
- ---
371
-
372
- ## Pattern 14: RDFS Property Schema
373
-
374
- ```md
375
- [rdfs] <http://www.w3.org/2000/01/rdf-schema#>
376
- [ex] <tag:example.org,2026:>
377
-
378
- # Author Property {=ex:author .rdf:Property label}
379
-
380
- Domain is [Document] {+ex:Document ?rdfs:domain}.
381
- Range is [Person] {+ex:Person ?rdfs:range}.
382
- ```
383
-
384
- **Emits:**
385
- - `ex:author rdf:type rdf:Property`
386
- - `ex:author rdfs:label "Author Property"`
387
- - `ex:author rdfs:domain ex:Document`
388
- - `ex:author rdfs:range ex:Person`
389
-
390
- ---
391
-
392
- ## Pattern 15: Language-Tagged Literals
393
-
394
- ```md
395
- [ex] <tag:example.org,2026:>
396
-
397
- # Document {=ex:doc .ex:Document label}
398
-
399
- Title in English: [Hello World] {ex:title @en}.
400
- Title in French: [Bonjour le monde] {ex:title @fr}.
401
- Title in German: [Hallo Welt] {ex:title @de}.
402
- ```
403
-
404
- **Emits:**
405
- - `ex:doc rdf:type ex:Document`
406
- - `ex:doc ex:title "Hello World"@en`
407
- - `ex:doc ex:title "Bonjour le monde"@fr`
408
- - `ex:doc ex:title "Hallo Welt"@de`
409
-
410
- ---
411
-
412
- ## Pattern 16: Code Block as Value Carrier
413
-
414
- ```md
415
- [ex] <tag:example.org,2026:>
416
-
417
- ~~~~~~js {=ex:code .ex:SourceCode text}
418
- console.log("Hello, MDLD!");
419
- ~~~~~~
420
- ```
421
-
422
- **Emits:**
423
- - `ex:code rdf:type ex:SourceCode`
424
- - `ex:code schema:text "console.log(\"Hello, MDLD!\");"`
425
-
426
- ---
427
-
428
- ## Pattern 17: Link with URL as Object
429
-
430
- ```md
431
- [ex] <tag:example.org,2026:>
432
-
433
- # Document {=ex:doc .ex:Document label}
434
-
435
- See the [specification](https://example.org/spec) {?ex:references name}.
436
- ```
437
-
438
- **Emits:**
439
- - `ex:doc rdf:type ex:Document`
440
- - `ex:doc ex:references <https://example.org/spec>`
441
- - `<https://example.org/spec> schema:name "specification"`
442
-
443
- ---
444
-
445
- ## Pattern 18: Subject Reset for Context Switch
446
-
447
- ```md
448
- [ex] <tag:example.org,2026:>
449
-
450
- # First Document {=ex:doc1 .ex:Document label}
451
- Has title [Doc 1] {ex:title}.
452
-
453
- {=}
454
-
455
- # Second Document {=ex:doc2 .ex:Document ?member label}
456
- Has title [Doc 2] {ex:title}.
457
- ```
458
-
459
- **Emits:**
460
- - `ex:doc1 rdf:type ex:Document`
461
- - `ex:doc1 ex:title "Doc 1"`
462
- - `ex:doc2 rdf:type ex:Document`
463
- - `ex:doc2 ex:title "Doc 2"`
464
-
465
- **Key:** Note that this triple is not generated: `ex:doc2 rdfs:member ex:doc1` - {=} clears current subject before new context to avoid accidental chaining.
466
-
467
- ---
468
-
469
- ## Pattern 19: Related Entities with Fragment Subjects
470
-
471
- ```md
472
- [ex] <tag:example.org,2026:>
473
-
474
- # Organization {=ex:org .ex:Organization label}
475
-
476
- Has 2 departments: **Engineering** {+#eng ?ex:hasDepartment} and **Marketing** {+#mkt ?ex:hasDepartment}.
477
-
478
- # Engineering Department {=ex:org#eng .ex:Department label}
479
- Led by [Alice] {+ex:alice ?ex:head .ex:Person label}.
480
-
481
- # Marketing Department {=ex:org#mkt .ex:Department label}
482
- Led by [Bob] {+ex:bob ?ex:head .ex:Person label}.
483
- ```
484
-
485
- **Emits:**
486
- - `ex:org rdf:type ex:Organization`
487
- - `ex:org ex:hasDepartment ex:org#eng`
488
- - `ex:org#eng rdf:type ex:Department`
489
- - `ex:org#eng rdfs:label "Engineering"`
490
- - `ex:org ex:hasDepartment ex:org#mkt`
491
- - `ex:org#mkt rdf:type ex:Department`
492
- - `ex:org#mkt rdfs:label "Marketing"`
493
- - `ex:org#eng rdf:type ex:Department`
494
- - `ex:org#eng ex:head ex:alice`
495
- - `ex:alice rdf:type ex:Person`
496
- - `ex:alice rdfs:label "Alice"`
497
- - `ex:org#mkt rdf:type ex:Department`
498
- - `ex:org#mkt ex:head ex:bob`
499
- - `ex:bob rdf:type ex:Person`
500
- - `ex:bob rdfs:label "Bob"`
501
-
502
- **Key:** Lists have no semantic scope - use fragment subjects and explicit subject resets to model nested relationships
503
-
504
- ---
505
-
506
- ## Pattern 20: Diff Polarity (Remove Facts)
507
-
508
- ```md
509
- [ex] <tag:example.org,2026:>
510
-
511
- **Document** {=ex:doc} originally had [draft] {-ex:status} status, now it's [published] {ex:status}.
512
- ```
513
-
514
- **Emits:**
515
- - `ex:doc rdf:type ex:Document`
516
- - `ex:doc ex:status "draft"`
517
- - Remove: `ex:doc ex:status "draft"`
518
- - `ex:doc ex:status ex:published`
519
-
520
- **Key:** `-predicate` removes existing fact, `+IRI ?predicate` adds new
521
-
522
- ---
523
-
524
- ## Quick Reference
525
-
526
- | Symbol | Meaning | Example |
527
- |--------|---------|---------|
528
- | `{=IRI}` | Set subject (persists) | `{=ex:doc .ex:Document label}` |
529
- | `{=#frag}` | Fragment subject | `{=#intro ?ex:hasSection}` |
530
- | `{=} | Reset subject | `{=} |
531
- | `{+IRI}` | Temporary object | `{+ex:alice ?ex:author}` |
532
- | `p` | Literal property | `{ex:title}` |
533
- | `?p` | Object property | `{?ex:author}` |
534
- | `!p` | Reverse property | `{!ex:hasIngredient}` |
535
- | `-p` | Remove literal | `{-ex:status}` |
536
- | `.Class` | Type declaration | `{.ex:Person}` |
537
- | `^^type` | Datatype | `{^^xsd:integer}` |
538
- | `@lang` | Language tag | `{@en}` |
539
-
540
- ---
541
-
542
- ## Critical Rules
543
-
544
- 1. **Every triple from annotation** - No implicit semantics
545
- 2. **Literals from value carriers** - Text must be attached
546
- 3. **Subject chaining** - Use `{+IRI}` for temporary objects
547
- 4. **Lists have no scope** - Each item needs explicit annotation
548
- 5. **No blank nodes** - Every entity needs IRI
549
- 6. **Subject reset** - Use `{=} when switching contexts
550
- 7. **Attachment rule** - `{...}` must follow carrier immediately