Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 47 additions & 19 deletions packages/database/doc/concept_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ Documents:

Content:

| id | source_local_id | page_id | scale | represents_id | text |
|----|-------------|-------------|----------|---------------|----------------------------------------------|
| 5 | nt1pgid | 1 | document | 16 | discourse-graphs/nodes/Claim |
| 6 | nt2pgid | 2 | document | 17 | discourse-graphs/nodes/Hypothesis |
| 12 | dgpgid | 3 | document | | roam/js/discourse-graph |
| 7 | et1bkid | 3 | block | 18 | Opposes |
| 13 | et1r1bkid | 3 | block | | source |
| 14 | et1r2bkid | 3 | block | | destination |
| 8 | somepgid | 4 | document | | Some page |
| 24 | hyp1pgid | 22 | document | 20 | [HYP] Some hypothesis |
| 25 | clm1pgid | 23 | document | 19 | [HYP] Some claim |
| 9 | hyp1refbkid | 4 | block | | a block referring to [[HYP] Some hypothesis] |
| 10 | opp1bkid | 4 | block | 21 | OpposedBy |
| 11 | clm1refbkid | 4 | block | | a block referring to [[CLM] Some claim] |
| id | source_local_id | page_id | scale | represents_id | part_of | text | metadata |
|----|-------------|-------------|----------|---------------| ------- |----------------------------------------------|----------------------|
| 5 | nt1pgid | 1 | document | 16 | | discourse-graphs/nodes/Claim | |
| 6 | nt2pgid | 2 | document | 17 | | discourse-graphs/nodes/Hypothesis | |
| 12 | dgpgid | 3 | document | | | roam/js/discourse-graph | |
| 7 | et1bkid | 3 | block | 18 | | Opposes | |
| 13 | et1r1bkid | 3 | block | | | source | |
| 14 | et1r2bkid | 3 | block | | | destination | |
| 8 | somepgid | 4 | document | | | Some page | |
| 24 | hyp1pgid | 22 | document | 20 | | [HYP] Some hypothesis | |
| 25 | clm1pgid | 23 | document | 19 | | [CLM] Some claim | |
| 9 | hyp1refbkid | 4 | block | | | a block referring to [[HYP] Some hypothesis] | |
| 10 | opp1bkid | 4 | block | 21 | | OpposedBy | |
| 11 | clm1refbkid | 4 | block | | | a block referring to [[CLM] Some claim] | |
| 26 | | 4 | quote | | 11 | [[CLM] Some claim] | {start: 21, end: 43} |
| 27 | | 4 | quote | | 9 | [[HYP] Some hypothesis] | {start: 21, end: 38} |

Concept:

Expand All @@ -68,13 +70,39 @@ ContentLink

| source | destination |
|--------|-------------|
| 9 | 24 |
| 11 | 25 |
| 27 | 24 |
| 26 | 25 |

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

| source | destination |
|--------|-------------|
| 27 | 20 |
| 26 | 19 |

Missing: Ontology

This is what the rows would look like in diagram form:
![Diagram showing the relationships between roam blocks and supabase rows.](./relation_diagram.svg)

This expresses how a single reference is modeled:

![Diagram showing the claim reference.](./reference_diagram_anchor.svg)

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.

ContentLink

| source | destination | metadata |
|--------|-------------|----------------------|
| 9 | 24 | {start: 21, end: 43} |
| 11 | 25 | {start: 21, end: 38} |

Occurence

| source | destination | metadata |
|--------|-------------|----------------------|
| 9 | 20 | {start: 21, end: 43} |
| 11 | 19 | {start: 21, end: 38} |


![Diagram showing the claim reference without materialized anchors.](./reference_diagram_no_anchor.svg)
196 changes: 196 additions & 0 deletions packages/database/doc/reference_diagram_anchor.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
@startuml

skinparam package<<Layout>> {
borderColor Transparent
backgroundColor Transparent
fontColor Transparent
stereotypeFontColor Transparent
}

package "Roam" {

map "Claim definition" as nt1pgid << page >> {
id=>nt1pgid
title=>discourse-graphs/nodes/Claim
}


map "Some claim instance" as clm1pgid << page >> {
id=>clm1pgid
title=>[CLM] Some claim
}

map "Some page" as somepgid << page >> {
id=>somepgid
title=>Some page
}

nt1pgid <-[hidden] clm1pgid
clm1pgid <-[hidden] somepgid

map "claim ref" as clm1refbkid << block >> {
| id => clm1refbkid
title=> a block referring to [[HYP] Some hypothesis]
}
somepgid o-[#darkorange] clm1refbkid

}
package "Supabase" {
together {

class Document {
{field} id : integer
{field} source_local_id : string
{field} created : datetime
{field} metadata : JSON
{field} last_modified : datetime
{field} url : string
{field} contents : blob
}
class Content {
{field} id : integer
{field} source_local_id : string
{field} created : datetime
{field} text : string
{field} metadata : JSON
{field} scale : Scale
{field} last_modified : datetime
}
class Concept {
{field} id : integer
{field} epistemic_status : EpistemicStatus
{field} name : string
{field} description : string
{field} created : datetime
{field} last_modified : datetime
{field} arity : integer
{field} reference_content : JSON
{field} literal_content : JSON
{field} is_schema : boolean
}
Document "1" o-- Content : document
Content "0..1" <-[#green]- Concept : represented_by

Content ..[#orange]> Content : references
Content --[#blue]> Concept : occurences
Concept -[#purple]> Concept : schema
' Content -> Concept : interpretation'
}
together {

map "Claim Definition page" as d1 {
id=>1
source_local_id=>nt1pgid
}

Document <|.[hidden] d1

map "Some claim instance page" as d23 {
id=>23
source_local_id=>clm1pgid
}

/' Document <|. d23 '/

map "Some page" as d4 {
id=>4
source_local_id=>somepgid
}

/' Document <|. d4 '/

}

together {

map "Claim definition block" as c5 {
id=> 5
source_local_id=> nt1pgid
page_id=> 1
scale=> document
represents_id=> 16
text=> discourse-graphs/nodes/Claim
}
Content <|.[hidden] c5
d1 *-- c5

map "Some claim instance block" as c25 {
id=> 25
source_local_id=> clm1pgid
page_id=> 4
scale=> document
represents_id=> 19
text=> [CLM] Some claim
}
/' Content <|. c25 '/
d23 *-- c25

map "Some page block" as c8 {
id=> 8
source_local_id=> somepgid
page_id=> 4
scale=> document
text=> Some page
}
/' Content <|. c8 '/
d4 *-- c8

}

together {
map "Claim reference block" as c11 {
id=> 11
source_local_id=> clm1refbkid
page_id=> 4
scale=> block
title=> "a block referring to [[CLM] Some claim]"
}

/' Content <|. c11 '/

map "Claim reference anchor" as c26 #lightblue {
id=> 26
page_id=> 4
part_of=>11
scale=> quote
title=> "[[CLM] Some claim]"
}
/' Content <|. c26 '/
c11 o-[#darkorange]-- c26
}
c8 o-[#darkorange]- c11

together {
map "Claim definition concept" as c16 {
id=>16
is_schema=> true
name=> Claim
content=> {}
}
Concept <|.[hidden] c16
c5 --> c16: "represents"

map "Claim instance concept" as c19 {
id=>19
is_schema=> false
name=> [CLM] some claim
content=> {}
}
/' Concept <|. c19 '/
c25 --> c19: "represents"

}

c11 .[hidden].> c25
c11 .[hidden].> c19

c26 .[#orange].> c25
c26 -[#blue]-> c19
}

nt1pgid <.. d1
clm1pgid <.. d23
somepgid <.. d4
clm1refbkid <.. c11

@enduml
1 change: 1 addition & 0 deletions packages/database/doc/reference_diagram_anchor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading