mdld-parse 0.9.9 → 1.0.1
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.
- package/README.md +263 -326
- package/dist/index.js +1860 -1337
- package/package.json +4 -4
- package/dist/.nojekyll +0 -0
- package/dist/CNAME +0 -1
- package/dist/README.md +0 -500
- package/dist/docs/API.md +0 -435
- package/dist/docs/Architecture.md +0 -190
- package/dist/docs/Guide.md +0 -816
- package/dist/docs/LLM-MDLD-Inducer.md +0 -550
- package/dist/docs/LiterateRDF.md +0 -472
- package/dist/docs/Parser.md +0 -720
- package/dist/docs/Performance.md +0 -238
- package/dist/docs/Spec-render.md +0 -1439
- package/dist/docs/Subject.md +0 -180
- package/dist/docs/Syntax.md +0 -463
- package/dist/docs/TodoList.md +0 -215
- package/dist/docs/Use-Cases.md +0 -354
- package/dist/docs/guide-m.md +0 -56
- package/dist/docs/index.html +0 -108
- package/dist/docs/index.md +0 -56
- package/dist/docs/one-page.md +0 -322
- package/dist/docs/origin.md +0 -460
- package/dist/docs/polarity.md +0 -586
- package/dist/docs/primary-subject.md +0 -326
- package/dist/docs/statements.md +0 -226
- package/dist/docs/tokenization-performance-report.md +0 -164
- package/dist/examples/Cookbook.md +0 -32
- package/dist/examples/Status-SHACL.md +0 -31
- package/dist/examples/demo/index.md +0 -35
- package/dist/examples/demo/journal.md +0 -58
- package/dist/examples/demo/minimal.md +0 -23
- package/dist/examples/demo/project.md +0 -84
- package/dist/examples/demo/prov.md +0 -107
- package/dist/examples/demo/rdf.md +0 -69
- package/dist/examples/demo/recipe.md +0 -50
- package/dist/examples/demo/research.md +0 -84
- package/dist/examples/demo/shacl.md +0 -161
- package/dist/examples/demo/space-mission.md +0 -58
- package/dist/examples/demo/tasks.md +0 -175
- package/dist/examples/demo/xsd.md +0 -91
- package/dist/examples/dogfood.md +0 -288
- package/dist/examples/few-shot.md +0 -309
- package/dist/examples/graph/rdf-graph.html +0 -473
- package/dist/examples/graph/rdf_force_graph_web_component.html +0 -506
- package/dist/examples/index.md +0 -45
- package/dist/examples/llm-time-workflow.md +0 -173
- package/dist/examples/statements.md +0 -43
- package/dist/examples/workflow.md +0 -150
- package/dist/index.html +0 -3049
- package/dist/logo.svg +0 -7
- package/dist/spec/Spec-compact.md +0 -368
- package/dist/spec/Spec-ultra.md +0 -232
- package/dist/spec/Spec.md +0 -1116
- package/dist/spec/index.md +0 -46
package/dist/docs/Subject.md
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
# From a Heading to a Global IRI
|
|
2
|
-
|
|
3
|
-
*A single person’s research, made semantic over time*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Start with plain Markdown (no semantics yet)
|
|
8
|
-
|
|
9
|
-
Alice begins like anyone else: a quick note.
|
|
10
|
-
|
|
11
|
-
```md
|
|
12
|
-
# Highest Buildings
|
|
13
|
-
|
|
14
|
-
- Burj Khalifa — ~830 m
|
|
15
|
-
- Shanghai Tower — ~630 m
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
This is **just text**.
|
|
19
|
-
No RDF. Nothing queryable. No subject exists.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## 2. Acknowledge the list as a thing
|
|
24
|
-
|
|
25
|
-
She realizes this list itself is meaningful.
|
|
26
|
-
She mints a personal IRI space with a `tag` namespace (RFC 4151) gives the heading an explicit subject.
|
|
27
|
-
|
|
28
|
-
```md
|
|
29
|
-
[alice] <tag:alice@example.com,2026:>
|
|
30
|
-
|
|
31
|
-
# Highest Buildings {=alice:hb .Container label}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Now, and only now, RDF exists:
|
|
35
|
-
|
|
36
|
-
```turtle
|
|
37
|
-
tag:alice@example.com,2026:hb a rdfs:Container ;
|
|
38
|
-
rdfs:label "Highest Buildings" .
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Key idea:
|
|
42
|
-
|
|
43
|
-
> A subject without predicates emits nothing.
|
|
44
|
-
> A predicate without a subject emits nothing.
|
|
45
|
-
> No guessing, ever.
|
|
46
|
-
|
|
47
|
-
Her knowledge base agents can now *see* this collection.
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 3. Make items addressable (still personal)
|
|
52
|
-
|
|
53
|
-
She wants to add facts per building.
|
|
54
|
-
Each building must have its **own subject**.
|
|
55
|
-
|
|
56
|
-
She keeps everything personal and local for now.
|
|
57
|
-
|
|
58
|
-
```md
|
|
59
|
-
[alice] <tag:alice@example.com,2026:>
|
|
60
|
-
|
|
61
|
-
## Burj Khalifa {=alice:burj-khalifa label}
|
|
62
|
-
|
|
63
|
-
[828] {alice:height ^^xsd:integer}
|
|
64
|
-
|
|
65
|
-
## Shanghai Tower {=alice:shanghai-tower label}
|
|
66
|
-
|
|
67
|
-
[632] {alice:height ^^xsd:integer}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Now the data is:
|
|
71
|
-
|
|
72
|
-
* explicit
|
|
73
|
-
* stable
|
|
74
|
-
* SPARQL-queryable
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 4. Reduce repetition with fragment IRIs
|
|
79
|
-
|
|
80
|
-
She notices all buildings belong to the same topic.
|
|
81
|
-
Fragments let her keep a clean hierarchy.
|
|
82
|
-
|
|
83
|
-
```md
|
|
84
|
-
[alice] <tag:alice@example.com,2026:>
|
|
85
|
-
|
|
86
|
-
# Highest Buildings {=alice:hb .Container label}
|
|
87
|
-
|
|
88
|
-
## Burj Khalifa {=#burj-khalifa label}
|
|
89
|
-
|
|
90
|
-
[828] {alice:height ^^xsd:integer}
|
|
91
|
-
|
|
92
|
-
## Shanghai Tower {=#shanghai-tower label}
|
|
93
|
-
|
|
94
|
-
[632] {alice:height ^^xsd:integer}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
This expands to:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
tag:alice@example.com,2026:hb#burj-khalifa
|
|
101
|
-
tag:alice@example.com,2026:hb#shanghai-tower
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Fragments are:
|
|
105
|
-
|
|
106
|
-
* deterministic
|
|
107
|
-
* relative
|
|
108
|
-
* replaceable later
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## 5. Validate facts, keep ownership
|
|
113
|
-
|
|
114
|
-
After checking Wikipedia, she cleans heights and adds types.
|
|
115
|
-
|
|
116
|
-
```md
|
|
117
|
-
**Burj Khalifa** {=#burj-khalifa .alice:Skyscraper label} is the highest building at [828] {alice:height ^^xsd:integer} meters is located in [Dubai] {alice:location}
|
|
118
|
-
|
|
119
|
-
**Shanghai Tower** {=#shanghai-tower .alice:Skyscraper label} - [632] {alice:height ^^xsd:integer} is located in [Shanghai] {alice:location}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## 6. Switch to a globally unique base (no publishing required)
|
|
125
|
-
|
|
126
|
-
She decides these IRIs should be globally valid.
|
|
127
|
-
She changes **one line**.
|
|
128
|
-
|
|
129
|
-
```md
|
|
130
|
-
[alice] <tag:alice@example.com,2026:>
|
|
131
|
-
```
|
|
132
|
-
Becomes:
|
|
133
|
-
```md
|
|
134
|
-
[alice] <https://alice-blog.example.com/hb/>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Nothing else changes.
|
|
138
|
-
|
|
139
|
-
Now all subjects are globally unique IRIs, even if the document stays private.
|
|
140
|
-
|
|
141
|
-
This is **IRI alignment**, not migration.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## 7. Align with global datasets (optional, explicit)
|
|
146
|
-
|
|
147
|
-
She wants to validate Burj Khalifa against Wikidata.
|
|
148
|
-
|
|
149
|
-
She chooses to **align**, not replace.
|
|
150
|
-
|
|
151
|
-
```md
|
|
152
|
-
### Burj Khalifa {=wd:Q134164 .alice:Skyscraper label !seeAlso}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
This emits:
|
|
156
|
-
|
|
157
|
-
```turtle
|
|
158
|
-
wd:Q134164 a alice:Skyscraper ;
|
|
159
|
-
rdfs:label "Burj Khalifa" ;
|
|
160
|
-
rdfs:seeAlso tag:alice@example.com,2026:hb#burj-khalifa .
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Now agents can:
|
|
164
|
-
|
|
165
|
-
* query Wikidata
|
|
166
|
-
* enrich her data
|
|
167
|
-
* never overwrite her intent
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## 8. The philosophy, in plain terms
|
|
172
|
-
|
|
173
|
-
* Markdown stays Markdown
|
|
174
|
-
* Semantics are **opt-in**
|
|
175
|
-
* Every triple is **authored**
|
|
176
|
-
* Subjects are **chosen, not inferred**
|
|
177
|
-
* Alignment is **explicit, reversible, local**
|
|
178
|
-
|
|
179
|
-
MD-LD does not turn notes into data.
|
|
180
|
-
It lets people **decide when text becomes knowledge**.
|
package/dist/docs/Syntax.md
DELETED
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
# MD-LD Syntax Guide
|
|
2
|
-
|
|
3
|
-
Add semantic annotations to Markdown using `{...}` blocks.
|
|
4
|
-
|
|
5
|
-
## Basic Annotation
|
|
6
|
-
|
|
7
|
-
```md
|
|
8
|
-
# Apollo 11 {=wd:Q43653 .SpaceMission}
|
|
9
|
-
Launched in [1969] {launchYear ^^xsd:gYear} with crew {?crew .Person name}.
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Value Carriers
|
|
13
|
-
|
|
14
|
-
**Inline**: `[text]` `*text*` `**text**` `_text_` `__text__` `` `text` ``
|
|
15
|
-
**Block**: `# Heading` `- list item` `> blockquote`
|
|
16
|
-
**Links**: `[label](url)` `` `<url>`
|
|
17
|
-
|
|
18
|
-
```md
|
|
19
|
-
[*Important*] {mission:status} mission using **Saturn V** {mission:rocket} rocket.
|
|
20
|
-
> Longer text description. {quote}
|
|
21
|
-
[Photo of the moon](moon.jpg) {?image .Image label}
|
|
22
|
-
<https://nasa.gov> {?website .Organization}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Subject Chaining
|
|
26
|
-
|
|
27
|
-
```md
|
|
28
|
-
# Document {=ex:doc}
|
|
29
|
-
## Section 1 {=#section1}
|
|
30
|
-
[Content] {name}
|
|
31
|
-
|
|
32
|
-
## Section 2 {=#section2}
|
|
33
|
-
[More content] {name}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Creates: `ex:doc#section1`, `ex:doc#section2`
|
|
37
|
-
|
|
38
|
-
## Predicate Forms
|
|
39
|
-
|
|
40
|
-
| Syntax | Direction | Example |
|
|
41
|
-
|--------|-----------|---------|
|
|
42
|
-
| `p` | S → L | `[1969] {year}` |
|
|
43
|
-
| `?p` | S → O | `[NASA] {?operator}` |
|
|
44
|
-
| `!p` | O → S | `[Mission] {!hasPart}` |
|
|
45
|
-
|
|
46
|
-
## Lists
|
|
47
|
-
|
|
48
|
-
Lists are pure Markdown structure with **no semantic scope**. Each list item requires explicit annotations.
|
|
49
|
-
|
|
50
|
-
```md
|
|
51
|
-
[@vocab] <http://www.w3.org/2000/01/rdf-schema#>
|
|
52
|
-
|
|
53
|
-
## Analysis Project {=prj:project .Project label}
|
|
54
|
-
Analysis steps:
|
|
55
|
-
|
|
56
|
-
- **Sample preparation** {+prj:step1 ?member .prj:Task label}
|
|
57
|
-
- **Data collection** {+prj:step2 ?member .prj:Task label}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**Key Rules:**
|
|
61
|
-
- No semantic propagation from list scope
|
|
62
|
-
- Each item must have explicit annotations
|
|
63
|
-
- Use `+IRI` to maintain subject chaining for repeated object properties
|
|
64
|
-
- Nested lists have no inheritance
|
|
65
|
-
|
|
66
|
-
## List Item Requirements
|
|
67
|
-
|
|
68
|
-
**✅ CORRECT**
|
|
69
|
-
```md
|
|
70
|
-
- **Flour** {=ex:flour} # Subject declaration
|
|
71
|
-
- **Walnuts** {+ex:walnuts} # Subject chaining
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
**Rule**: List items must have explicit subject (`{=iri}` or `{+iri}`) to emit semantics.
|
|
76
|
-
|
|
77
|
-
## Temporary Objects
|
|
78
|
-
|
|
79
|
-
```md
|
|
80
|
-
[Related] {+ex:related ?schema:isRelatedTo .Entity name}
|
|
81
|
-
[Parent] {+ex:parent !schema:hasPart .Organization name}
|
|
82
|
-
[Section] {+#subsection name ?hasPart}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Soft Object IRI (`{+iri}`)** - Temporary object for `?` and `!` predicates without changing current subject
|
|
86
|
-
|
|
87
|
-
**Soft Fragment (`{+#fragment}`)** - Temporary fragment relative to current subject base
|
|
88
|
-
|
|
89
|
-
The soft IRI only exists within the current annotation block.
|
|
90
|
-
|
|
91
|
-
## Literals
|
|
92
|
-
|
|
93
|
-
```md
|
|
94
|
-
[1969] {year ^^xsd:gYear}
|
|
95
|
-
[July] {month @en}
|
|
96
|
-
[Juillet] {month @fr}
|
|
97
|
-
[5.2] {rating ^^xsd:decimal}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Code Blocks
|
|
101
|
-
|
|
102
|
-
```md
|
|
103
|
-
```js {=ex:code .SoftwareSourceCode text}
|
|
104
|
-
console.log("hello")
|
|
105
|
-
```
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Context
|
|
109
|
-
|
|
110
|
-
```md
|
|
111
|
-
[ex] <http://example.org/>
|
|
112
|
-
[wd] <https://www.wikidata.org/entity/>
|
|
113
|
-
[@vocab] <http://schema.org/>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Prefix Folding
|
|
117
|
-
|
|
118
|
-
Build namespace hierarchies by referencing previously declared prefixes:
|
|
119
|
-
|
|
120
|
-
```md
|
|
121
|
-
# Domain authority
|
|
122
|
-
[my] <tag:mymail@domain.com,2026:>
|
|
123
|
-
|
|
124
|
-
# Hierarchical prefixes
|
|
125
|
-
[j] <my:journal:>
|
|
126
|
-
[p] <my:property:>
|
|
127
|
-
[c] <my:class:>
|
|
128
|
-
[person] <my:people:>
|
|
129
|
-
|
|
130
|
-
# Multi-level nesting
|
|
131
|
-
[org] <https://org.example.com/>
|
|
132
|
-
[person] <org:person/>
|
|
133
|
-
[emp] <person:employee/>
|
|
134
|
-
[dev] <emp:developer/>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Resolution Rules:**
|
|
138
|
-
- Prefixes must be declared before they can be referenced (forward-reference only)
|
|
139
|
-
- Circular references are treated as literal strings
|
|
140
|
-
- Later declarations override earlier ones
|
|
141
|
-
|
|
142
|
-
**Examples:**
|
|
143
|
-
- `j:2026-01-27` → `tag:mymail@domain.com,2026:journal:2026-01-27`
|
|
144
|
-
- `emp:harry` → `https://org.example.com/person/employee/harry`
|
|
145
|
-
- `dev:john` → `https://org.example.com/person/employee/developer/john`
|
|
146
|
-
|
|
147
|
-
## Quick Reference
|
|
148
|
-
|
|
149
|
-
- `{=IRI}` - Set subject
|
|
150
|
-
- `{=#frag}` - Fragment subject
|
|
151
|
-
- `{+IRI}` - Temporary object
|
|
152
|
-
- `.Class` - Type declaration
|
|
153
|
-
- `p` - Literal predicate
|
|
154
|
-
- `?p` - Object predicate
|
|
155
|
-
- `!p` - Reverse predicate
|
|
156
|
-
- `^^type` - Datatype
|
|
157
|
-
- `@lang` - Language
|
|
158
|
-
|
|
159
|
-
## Detailed Syntax Reference
|
|
160
|
-
|
|
161
|
-
### Subject Declaration
|
|
162
|
-
|
|
163
|
-
Set current subject (emits no quads):
|
|
164
|
-
|
|
165
|
-
```markdown
|
|
166
|
-
## Apollo 11 {=ex:apollo11}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Fragment Syntax
|
|
170
|
-
|
|
171
|
-
Create fragment IRIs relative to current subject:
|
|
172
|
-
|
|
173
|
-
```markdown
|
|
174
|
-
# Document {=ex:document}
|
|
175
|
-
{=#summary}
|
|
176
|
-
[Content] {label}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
```turtle
|
|
180
|
-
ex:document#summary rdfs:label "Content" .
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Fragments replace any existing fragment and require a current subject.
|
|
184
|
-
|
|
185
|
-
Subject remains in scope until reset with `{=}` or new subject declared.
|
|
186
|
-
|
|
187
|
-
### Type Declaration
|
|
188
|
-
|
|
189
|
-
Emit `rdf:type` triple:
|
|
190
|
-
|
|
191
|
-
```markdown
|
|
192
|
-
## Apollo 11 {=ex:apollo11 .ex:SpaceMission .ex:Event}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
```turtle
|
|
196
|
-
ex:apollo11 a ex:SpaceMission, ex:Event .
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Literal Properties
|
|
200
|
-
|
|
201
|
-
Inline value carriers emit literal properties:
|
|
202
|
-
|
|
203
|
-
```markdown
|
|
204
|
-
# Mission {=ex:apollo11}
|
|
205
|
-
|
|
206
|
-
[Neil Armstrong] {ex:commander}
|
|
207
|
-
[1969] {ex:year ^^xsd:gYear}
|
|
208
|
-
[Historic mission] {ex:description @en}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
```turtle
|
|
212
|
-
ex:apollo11 ex:commander "Neil Armstrong" ;
|
|
213
|
-
ex:year "1969"^^xsd:gYear ;
|
|
214
|
-
ex:description "Historic mission"@en .
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Object Properties
|
|
218
|
-
|
|
219
|
-
Links create relationships (use `?` prefix):
|
|
220
|
-
|
|
221
|
-
```markdown
|
|
222
|
-
# Mission {=ex:apollo11}
|
|
223
|
-
|
|
224
|
-
[NASA] {=ex:nasa ?ex:organizer}
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
```turtle
|
|
228
|
-
ex:apollo11 ex:organizer ex:nasa .
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Resource Declaration
|
|
232
|
-
|
|
233
|
-
Declare resources inline with `{=iri}`:
|
|
234
|
-
|
|
235
|
-
```markdown
|
|
236
|
-
# Mission {=ex:apollo11}
|
|
237
|
-
|
|
238
|
-
[Neil Armstrong] {=ex:armstrong ?ex:commander .prov:Person}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
```turtle
|
|
242
|
-
ex:apollo11 ex:commander ex:armstrong .
|
|
243
|
-
ex:armstrong a prov:Person .
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Lists
|
|
247
|
-
|
|
248
|
-
Lists are pure Markdown structure. Each list item requires explicit annotations:
|
|
249
|
-
|
|
250
|
-
```markdown
|
|
251
|
-
# Recipe {=ex:recipe}
|
|
252
|
-
|
|
253
|
-
Ingredients:
|
|
254
|
-
|
|
255
|
-
- **Flour** {+ex:flour ?ex:ingredient .ex:Ingredient label}
|
|
256
|
-
- **Water** {+ex:water ?ex:ingredient .ex:Ingredient label}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
```turtle
|
|
260
|
-
ex:recipe ex:ingredient ex:flour, ex:water .
|
|
261
|
-
ex:flour a ex:Ingredient ; rdfs:label "Flour" .
|
|
262
|
-
ex:water a ex:Ingredient ; rdfs:label "Water" .
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Key Rules:**
|
|
266
|
-
- No semantic propagation from list scope
|
|
267
|
-
- Each item must have explicit annotations
|
|
268
|
-
- Use `+IRI` to maintain subject chaining for repeated object properties
|
|
269
|
-
|
|
270
|
-
### Code Blocks
|
|
271
|
-
|
|
272
|
-
Code blocks are value carriers:
|
|
273
|
-
|
|
274
|
-
```markdown
|
|
275
|
-
# Example {=ex:example}
|
|
276
|
-
|
|
277
|
-
```javascript {=ex:code .ex:SoftwareSourceCode ex:text}
|
|
278
|
-
console.log("hello");
|
|
279
|
-
```
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
```turtle
|
|
283
|
-
ex:code a ex:SoftwareSourceCode ;
|
|
284
|
-
ex:text "console.log(\"hello\")" .
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Blockquotes
|
|
288
|
-
|
|
289
|
-
```markdown
|
|
290
|
-
# Article {=ex:article}
|
|
291
|
-
|
|
292
|
-
> MD-LD bridges Markdown and RDF. {comment}
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
```turtle
|
|
296
|
-
ex:article rdfs:comment "MD-LD bridges Markdown and RDF." .
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### Reverse Relations
|
|
300
|
-
|
|
301
|
-
Reverse relationship direction:
|
|
302
|
-
|
|
303
|
-
```markdown
|
|
304
|
-
# Part {=ex:part}
|
|
305
|
-
|
|
306
|
-
Part of: {!ex:hasPart}
|
|
307
|
-
|
|
308
|
-
- Book {=ex:book}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
```turtle
|
|
312
|
-
ex:book ex:hasPart ex:part .
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### Prefix Declarations
|
|
316
|
-
|
|
317
|
-
```markdown
|
|
318
|
-
[ex] <http://example.org/>
|
|
319
|
-
[foaf] <http://xmlns.com/foaf/0.1/>
|
|
320
|
-
|
|
321
|
-
# Person {=ex:alice .foaf:Person}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Prefix Folding: Lightweight IRI Authoring
|
|
325
|
-
|
|
326
|
-
Build hierarchical namespaces by referencing previously defined prefixes:
|
|
327
|
-
|
|
328
|
-
```markdown
|
|
329
|
-
# Create your domain authority
|
|
330
|
-
[my] <tag:mymail@domain.com,2026:>
|
|
331
|
-
|
|
332
|
-
# Build namespace hierarchy
|
|
333
|
-
[j] <my:journal:>
|
|
334
|
-
[p] <my:property:>
|
|
335
|
-
[c] <my:class:>
|
|
336
|
-
[person] <my:people:>
|
|
337
|
-
|
|
338
|
-
# Use in content
|
|
339
|
-
# 2026-01-27 {=j:2026-01-27 .c:Event p:date ^^xsd:date}
|
|
340
|
-
|
|
341
|
-
## Harry {=person:harry p:name}
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
**Resolves to absolute IRIs:**
|
|
345
|
-
- `j:2026-01-27` → `tag:mymail@domain.com,2026:journal:2026-01-27`
|
|
346
|
-
- `c:Event` → `tag:mymail@domain.com,2026:class:Event`
|
|
347
|
-
- `p:date` → `tag:mymail@domain.com,2026:property:date`
|
|
348
|
-
- `person:harry` → `tag:mymail@domain.com,2026:people:harry`
|
|
349
|
-
|
|
350
|
-
**Benefits:**
|
|
351
|
-
- **Lightweight**: No external ontology dependencies
|
|
352
|
-
- **Domain authority**: Use `tag:` URIs for personal namespaces
|
|
353
|
-
- **Hierarchical**: Build deep namespace structures
|
|
354
|
-
- **Streaming-safe**: Forward-reference only, single-pass parsing
|
|
355
|
-
|
|
356
|
-
### Value Carriers
|
|
357
|
-
|
|
358
|
-
### Inline Elements
|
|
359
|
-
- `[text] {...}` — span with annotation
|
|
360
|
-
- `[text](url) {...}` — link to external resource
|
|
361
|
-
- `[text] {...}` — inline resource declaration
|
|
362
|
-
- ` {...}` — embedding with annotation
|
|
363
|
-
|
|
364
|
-
### Block Elements
|
|
365
|
-
- `# Title` — headings
|
|
366
|
-
- `- item` — list items (pure Markdown structure)
|
|
367
|
-
- `> quote` — blockquotes
|
|
368
|
-
- ```lang code``` — code blocks
|
|
369
|
-
|
|
370
|
-
### Links and Media
|
|
371
|
-
- **Links:** [MD-LD Website](https://mdld.js.org) creates relationships
|
|
372
|
-
- **Images:**  creates object resources
|
|
373
|
-
|
|
374
|
-
### Predicate Forms
|
|
375
|
-
|
|
376
|
-
| Form | Edge | Example | Meaning |
|
|
377
|
-
|-------|---------|------------------------------|------------------|
|
|
378
|
-
| `p` | S → L | `[Alice] {name}` | literal property |
|
|
379
|
-
| `?p` | S → O | `[NASA] {=ex:nasa ?org}` | object property |
|
|
380
|
-
| `!p` | O → S | `[Parent] {=ex:p !hasPart}` | reverse object |
|
|
381
|
-
|
|
382
|
-
### Type Declarations
|
|
383
|
-
|
|
384
|
-
### Single Types
|
|
385
|
-
```markdown
|
|
386
|
-
[Single type example] {=mdld:single .Class label}
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### Multiple Types
|
|
390
|
-
```markdown
|
|
391
|
-
[Multiple types example] {=mdld:multiple .Class .mdld:Class1 label}
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Literal Modifiers
|
|
395
|
-
|
|
396
|
-
### Typed Literals
|
|
397
|
-
```markdown
|
|
398
|
-
[2024] {+mdld:year ^^xsd:gYear}
|
|
399
|
-
[3.14159] {+mdld:pi ^^xsd:decimal}
|
|
400
|
-
[true] {+mdld:bool ^^xsd:boolean}
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### Language-Tagged Literals
|
|
404
|
-
```markdown
|
|
405
|
-
[Hello] {+mdld:english @en}
|
|
406
|
-
[Bonjour] {+mdld:french @fr}
|
|
407
|
-
[Hola] {+mdld:spanish @es}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Datatypes and Language
|
|
411
|
-
|
|
412
|
-
MD-LD supports standard XML Schema datatypes and language tags:
|
|
413
|
-
|
|
414
|
-
- **`^^xsd:string`** (default) - Plain text
|
|
415
|
-
- **`^^xsd:integer`** - Whole numbers
|
|
416
|
-
- **`^^xsd:decimal`** - Decimal numbers
|
|
417
|
-
- **`^^xsd:boolean`** - True/false values
|
|
418
|
-
- **`^^xsd:date`** - Date values
|
|
419
|
-
- **`^^xsd:dateTime`** - Date and time
|
|
420
|
-
- **`@en`**, **`@fr`**, etc. - Language tags
|
|
421
|
-
|
|
422
|
-
### Context Management
|
|
423
|
-
|
|
424
|
-
### Subject Context
|
|
425
|
-
Subject persists until:
|
|
426
|
-
- New subject declaration: `{=new-subject}`
|
|
427
|
-
- Subject reset: `{=}`
|
|
428
|
-
- End of document
|
|
429
|
-
|
|
430
|
-
### Prefix Context
|
|
431
|
-
Prefixes persist for the entire document:
|
|
432
|
-
```markdown
|
|
433
|
-
[ex] <http://example.org/>
|
|
434
|
-
[foaf] <http://xmlns.com/foaf/0.1/>
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Forbidden Constructs
|
|
438
|
-
|
|
439
|
-
MD-LD explicitly forbids to ensure deterministic parsing:
|
|
440
|
-
|
|
441
|
-
- ❌ Implicit semantics or structural inference
|
|
442
|
-
- ❌ Auto-generated subjects or blank nodes
|
|
443
|
-
- ❌ Predicate guessing from context
|
|
444
|
-
- ❌ Multi-pass or backtracking parsers
|
|
445
|
-
|
|
446
|
-
### Processing Pipeline
|
|
447
|
-
|
|
448
|
-
Document processing follows this pipeline:
|
|
449
|
-
|
|
450
|
-
1. **Line-by-line scanning** - Sequential token creation
|
|
451
|
-
2. **Context resolution** - Prefix and vocabulary expansion
|
|
452
|
-
3. **Subject tracking** - Current subject management
|
|
453
|
-
4. **Annotation processing** - Semantic block evaluation
|
|
454
|
-
5. **Quad emission** - RDF triple generation
|
|
455
|
-
|
|
456
|
-
### Core Principles
|
|
457
|
-
|
|
458
|
-
- **Markdown-preserving** - Remove `{...}` → valid Markdown
|
|
459
|
-
- **Explicit only** - No implicit semantics or guessing
|
|
460
|
-
- **Single-pass** - Streaming-friendly processing
|
|
461
|
-
- **Deterministic** - Same input → same output
|
|
462
|
-
- **Traceable** - Every fact traces to its source
|
|
463
|
-
- `@lang` - Language
|