diff --git a/packages/database/doc/concept_example.md b/packages/database/doc/concept_example.md index 04bf677a7..9ec5ccc67 100644 --- a/packages/database/doc/concept_example.md +++ b/packages/database/doc/concept_example.md @@ -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: @@ -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) diff --git a/packages/database/doc/reference_diagram_anchor.puml b/packages/database/doc/reference_diagram_anchor.puml new file mode 100644 index 000000000..e32870c19 --- /dev/null +++ b/packages/database/doc/reference_diagram_anchor.puml @@ -0,0 +1,196 @@ +@startuml + +skinparam package<> { + 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 diff --git a/packages/database/doc/reference_diagram_anchor.svg b/packages/database/doc/reference_diagram_anchor.svg new file mode 100644 index 000000000..1e6d333c1 --- /dev/null +++ b/packages/database/doc/reference_diagram_anchor.svg @@ -0,0 +1 @@ +RoamSupabase«page»Claim definitionidnt1pgidtitlediscourse-graphs/nodes/Claim«page»Some claim instanceidclm1pgidtitle[CLM] Some claim«page»Some pageidsomepgidtitleSome page«block»claim ref| idclm1refbkidtitlea block referring to [[HYP] Some hypothesis]Documentid : integersource_local_id : stringcreated : datetimemetadata : JSONlast_modified : datetimeurl : stringcontents : blobContentid : integersource_local_id : stringcreated : datetimetext : stringmetadata : JSONscale : Scalelast_modified : datetimeConceptid : integerepistemic_status : EpistemicStatusname : stringdescription : stringcreated : datetimelast_modified : datetimearity : integerreference_content : JSONliteral_content : JSONis_schema : booleanClaim Definition pageid1source_local_idnt1pgidSome claim instance pageid23source_local_idclm1pgidSome pageid4source_local_idsomepgidClaim definition blockid5source_local_idnt1pgidpage_id1scaledocumentrepresents_id16textdiscourse-graphs/nodes/ClaimSome claim instance blockid25source_local_idclm1pgidpage_id4scaledocumentrepresents_id19text[CLM] Some claimSome page blockid8source_local_idsomepgidpage_id4scaledocumenttextSome pageClaim reference blockid11source_local_idclm1refbkidpage_id4scaleblocktitle"a block referring to [[CLM] Some claim]"Claim reference anchorid26page_id4part_of11scalequotetitle"[[CLM] Some claim]"Claim definition conceptid16is_schematruenameClaimcontent{}Claim instance conceptid19is_schemafalsename[CLM] some claimcontent{}document1represented_by0..1occurencesreferencesschemarepresentsrepresents \ No newline at end of file diff --git a/packages/database/doc/reference_diagram_no_anchor.puml b/packages/database/doc/reference_diagram_no_anchor.puml new file mode 100644 index 000000000..26480bb8e --- /dev/null +++ b/packages/database/doc/reference_diagram_no_anchor.puml @@ -0,0 +1,197 @@ +@startuml + +skinparam package<> { + 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 { + id=> 26 + page_id=> 4 + part_of=>11 + scale=> quote + title=> "[[CLM] Some claim]" + } + /' Content <|. c26 '/ + c11 o-[#blue]-- c26 : part + hide c26 + } + c8 o-[#darkorange]- c11 : part + + 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 .[#orange].> c25 + c11 -[#blue]-> c19 + + c26 -[hidden]-> c25 + c26 -[hidden]-> c19 +} + +nt1pgid <.. d1 +clm1pgid <.. d23 +somepgid <.. d4 +clm1refbkid <.. c11 + +@enduml diff --git a/packages/database/doc/reference_diagram_no_anchor.svg b/packages/database/doc/reference_diagram_no_anchor.svg new file mode 100644 index 000000000..bc8c0153d --- /dev/null +++ b/packages/database/doc/reference_diagram_no_anchor.svg @@ -0,0 +1 @@ +RoamSupabase«page»Claim definitionidnt1pgidtitlediscourse-graphs/nodes/Claim«page»Some claim instanceidclm1pgidtitle[CLM] Some claim«page»Some pageidsomepgidtitleSome page«block»claim ref| idclm1refbkidtitlea block referring to [[HYP] Some hypothesis]Documentid : integersource_local_id : stringcreated : datetimemetadata : JSONlast_modified : datetimeurl : stringcontents : blobContentid : integersource_local_id : stringcreated : datetimetext : stringmetadata : JSONscale : Scalelast_modified : datetimeConceptid : integerepistemic_status : EpistemicStatusname : stringdescription : stringcreated : datetimelast_modified : datetimearity : integerreference_content : JSONliteral_content : JSONis_schema : booleanClaim Definition pageid1source_local_idnt1pgidSome claim instance pageid23source_local_idclm1pgidSome pageid4source_local_idsomepgidClaim definition blockid5source_local_idnt1pgidpage_id1scaledocumentrepresents_id16textdiscourse-graphs/nodes/ClaimSome claim instance blockid25source_local_idclm1pgidpage_id4scaledocumentrepresents_id19text[CLM] Some claimSome page blockid8source_local_idsomepgidpage_id4scaledocumenttextSome pageClaim reference blockid11source_local_idclm1refbkidpage_id4scaleblocktitle"a block referring to [[CLM] Some claim]"Claim definition conceptid16is_schematruenameClaimcontent{}Claim instance conceptid19is_schemafalsename[CLM] some claimcontent{}document1represented_by0..1occurencesreferencesschemapartrepresentsrepresents \ No newline at end of file