Skip to content

Commit 0460559

Browse files
committed
Diagrams to show reference implementation.
1 parent 3e97235 commit 0460559

File tree

5 files changed

+423
-18
lines changed

5 files changed

+423
-18
lines changed

packages/database/doc/concept_example.md

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ Documents:
3535

3636
Content:
3737

38-
| id | source_local_id | page_id | scale | represents_id | text |
39-
|----|-------------|-------------|----------|---------------|----------------------------------------------|
40-
| 5 | nt1pgid | 1 | document | 16 | discourse-graphs/nodes/Claim |
41-
| 6 | nt2pgid | 2 | document | 17 | discourse-graphs/nodes/Hypothesis |
42-
| 7 | et1bkid | 3 | document | 18 | discourse-graphs/edges/OpposedBy |
43-
| 8 | somepgid | 4 | document | | Some page |
44-
| 24 | hyp1pgid | 22 | document | 20 | [HYP] Some hypothesis |
45-
| 25 | clm1pgid | 23 | document | 19 | [HYP] Some claim |
46-
| 9 | hyp1refbkid | 4 | block | | a block referring to [[HYP] Some hypothesis] |
47-
| 10 | opp1bkid | 4 | block | 21 | OpposedBy |
48-
| 11 | clm1refbkid | 4 | block | | a block referring to [[CLM] Some claim] |
49-
| 13 | et1r1bkid | 3 | block | | source |
50-
| 14 | et1r2bkid | 3 | block | | destination |
38+
| id | source_local_id | page_id | scale | represents_id | part_of | text | metadata |
39+
|----|-------------|-------------|----------|---------------| ------- |----------------------------------------------|----------------------|
40+
| 5 | nt1pgid | 1 | document | 16 | | discourse-graphs/nodes/Claim | |
41+
| 6 | nt2pgid | 2 | document | 17 | | discourse-graphs/nodes/Hypothesis | |
42+
| 7 | et1bkid | 3 | document | 18 | | discourse-graphs/edges/OpposedBy | |
43+
| 8 | somepgid | 4 | document | | | Some page | |
44+
| 24 | hyp1pgid | 22 | document | 20 | | [HYP] Some hypothesis | |
45+
| 25 | clm1pgid | 23 | document | 19 | | [CLM] Some claim | |
46+
| 9 | hyp1refbkid | 4 | block | | | a block referring to [[HYP] Some hypothesis] | |
47+
| 10 | opp1bkid | 4 | block | 21 | | OpposedBy | |
48+
| 11 | clm1refbkid | 4 | block | | | a block referring to [[CLM] Some claim] | |
49+
| 13 | et1r1bkid | 3 | block | | | source | |
50+
| 14 | et1r2bkid | 3 | block | | | destination | |
51+
| 26 | | 4 | quote | | 11 | [[CLM] Some claim] | {start: 21, end: 43} |
52+
| 27 | | 4 | quote | | 9 | [[HYP] Some hypothesis] | {start: 21, end: 38} |
5153

5254
Concept:
5355

@@ -67,10 +69,36 @@ ContentLink
6769

6870
| source | destination |
6971
|--------|-------------|
70-
| 9 | 24 |
71-
| 11 | 25 |
72+
| 27 | 24 |
73+
| 26 | 25 |
7274

73-
Note: I would probably create a sub-Content for the link text and use this as source.
74-
OR use a char_start, char_end.
75+
Occurence
7576

76-
Missing: Ontology
77+
| source | destination |
78+
|--------|-------------|
79+
| 27 | 20 |
80+
| 26 | 19 |
81+
82+
83+
This expresses how a single reference is modeled:
84+
85+
![Diagram showing the claim reference.](./reference_diagram_anchor.svg)
86+
87+
Note: It would be possible, but not necessarily desirable, to skip the quote sub-contents (26, 27) and directly put the content/occurence links to the enclosing block. We would probably want to give anchor information in the link in that case.
88+
89+
ContentLink
90+
91+
| source | destination | metadata |
92+
|--------|-------------|----------------------|
93+
| 9 | 24 | {start: 21, end: 43} |
94+
| 11 | 25 | {start: 21, end: 38} |
95+
96+
Occurence
97+
98+
| source | destination | metadata |
99+
|--------|-------------|----------------------|
100+
| 9 | 20 | {start: 21, end: 43} |
101+
| 11 | 19 | {start: 21, end: 38} |
102+
103+
104+
![Diagram showing the claim reference without materialized anchors.](./reference_diagram_no_anchor.svg)
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
@startuml
2+
3+
package "Roam" {
4+
5+
map "Claim definition" as nt1pgid << page >> {
6+
id=>nt1pgid
7+
title=>discourse-graphs/nodes/Claim
8+
}
9+
10+
11+
map "Some claim instance" as clm1pgid << page >> {
12+
id=>clm1pgid
13+
title=>[CLM] Some claim
14+
}
15+
16+
map "Some page" as somepgid << page >> {
17+
id=>somepgid
18+
title=>Some page
19+
}
20+
21+
nt1pgid <-[hidden] clm1pgid
22+
clm1pgid <-[hidden] somepgid
23+
24+
map "claim ref" as clm1refbkid << block >> {
25+
| id => clm1refbkid
26+
title=> a block referring to [[HYP] Some hypothesis]
27+
}
28+
somepgid o- clm1refbkid
29+
30+
}
31+
package "Supabase" {
32+
together {
33+
34+
class Document {
35+
{field} id : integer
36+
{field} source_local_id : string
37+
{field} created : datetime
38+
{field} metadata : JSON
39+
{field} last_modified : datetime
40+
{field} url : string
41+
{field} contents : blob
42+
}
43+
class Content {
44+
{field} id : integer
45+
{field} source_local_id : string
46+
{field} created : datetime
47+
{field} text : string
48+
{field} metadata : JSON
49+
{field} scale : Scale
50+
{field} last_modified : datetime
51+
}
52+
class Concept {
53+
{field} id : integer
54+
{field} epistemic_status : EpistemicStatus
55+
{field} name : string
56+
{field} description : string
57+
{field} created : datetime
58+
{field} last_modified : datetime
59+
{field} arity : integer
60+
{field} reference_content : JSON
61+
{field} literal_content : JSON
62+
{field} is_schema : boolean
63+
}
64+
Document "1" <-- Content : document
65+
Content "0..1" <-- Concept : represented_by
66+
67+
Content --> Content : references
68+
' Content -> Concept : interpretation'
69+
}
70+
together {
71+
72+
map "Claim Definition page" as d1 {
73+
id=>1
74+
source_local_id=>nt1pgid
75+
}
76+
77+
Document <|. d1
78+
79+
map "Some claim instance page" as d23 {
80+
id=>23
81+
source_local_id=>clm1pgid
82+
}
83+
84+
Document <|. d23
85+
86+
map "Some page" as d4 {
87+
id=>4
88+
source_local_id=>somepgid
89+
}
90+
91+
Document <|. d4
92+
93+
}
94+
95+
together {
96+
97+
map "Claim definition block" as c5 {
98+
id=> 5
99+
source_local_id=> nt1pgid
100+
page_id=> 1
101+
scale=> document
102+
represents_id=> 16
103+
text=> discourse-graphs/nodes/Claim
104+
}
105+
Content <|. c5
106+
d1 *-- c5
107+
108+
map "Some claim instance block" as c25 {
109+
id=> 25
110+
source_local_id=> clm1pgid
111+
page_id=> 4
112+
scale=> document
113+
represents_id=> 19
114+
text=> [CLM] Some claim
115+
}
116+
Content <|. c25
117+
d23 *-- c25
118+
119+
map "Some page block" as c8 {
120+
id=> 8
121+
source_local_id=> somepgid
122+
page_id=> 4
123+
scale=> document
124+
text=> Some page
125+
}
126+
Content <|. c8
127+
d4 *-- c8
128+
129+
}
130+
131+
together {
132+
map "Claim reference block" as c11 {
133+
id=> 11
134+
source_local_id=> clm1refbkid
135+
page_id=> 4
136+
scale=> block
137+
title=> "a block referring to [[CLM] Some claim]"
138+
}
139+
140+
Content <|. c11
141+
142+
map "Claim reference anchor" as c26 #lightblue {
143+
id=> 26
144+
page_id=> 4
145+
part_of=>11
146+
scale=> quote
147+
title=> "[[CLM] Some claim]"
148+
}
149+
Content <|. c26
150+
c11 o-[#blue]-- c26 : part
151+
}
152+
c8 o-- c11 : part
153+
154+
together {
155+
map "Claim definition concept" as c16 {
156+
id=>16
157+
is_schema=> true
158+
name=> Claim
159+
content=> {}
160+
}
161+
Concept <|. c16
162+
c5 --> c16: "represents"
163+
164+
map "Claim instance concept" as c19 {
165+
id=>19
166+
is_schema=> false
167+
name=> [CLM] some claim
168+
content=> {}
169+
}
170+
Concept <|. c19
171+
c25 --> c19: "represents"
172+
173+
}
174+
175+
c11 .[hidden].> c25 : "references"
176+
c11 .[hidden].> c19 : "occurence"
177+
178+
c26 -[#blue]-> c25 : "references"
179+
c26 -[#blue]-> c19 : "occurence"
180+
}
181+
182+
nt1pgid <.. d1
183+
clm1pgid <.. d23
184+
somepgid <.. d4
185+
clm1refbkid <.. c11
186+
187+
@enduml

packages/database/doc/reference_diagram_anchor.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)