Skip to content

Commit 748fb65

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

File tree

5 files changed

+442
-18
lines changed

5 files changed

+442
-18
lines changed

packages/database/doc/concept_example.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@ 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+
| 12 | dgpgid | 3 | document | | | roam/js/discourse-graph | |
43+
| 7 | et1bkid | 3 | block | 18 | | Opposes | |
44+
| 13 | et1r1bkid | 3 | block | | | source | |
45+
| 14 | et1r2bkid | 3 | block | | | destination | |
46+
| 8 | somepgid | 4 | document | | | Some page | |
47+
| 24 | hyp1pgid | 22 | document | 20 | | [HYP] Some hypothesis | |
48+
| 25 | clm1pgid | 23 | document | 19 | | [CLM] Some claim | |
49+
| 9 | hyp1refbkid | 4 | block | | | a block referring to [[HYP] Some hypothesis] | |
50+
| 10 | opp1bkid | 4 | block | 21 | | OpposedBy | |
51+
| 11 | clm1refbkid | 4 | block | | | a block referring to [[CLM] Some claim] | |
52+
| 26 | | 4 | quote | | 11 | [[CLM] Some claim] | {start: 21, end: 43} |
53+
| 27 | | 4 | quote | | 9 | [[HYP] Some hypothesis] | {start: 21, end: 38} |
5154

5255
Concept:
5356

@@ -67,10 +70,36 @@ ContentLink
6770

6871
| source | destination |
6972
|--------|-------------|
70-
| 9 | 24 |
71-
| 11 | 25 |
73+
| 27 | 24 |
74+
| 26 | 25 |
7275

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.
76+
Occurence
7577

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

packages/database/doc/reference_diagram_anchor.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)