aboutsummaryrefslogtreecommitdiffstats
path: root/docs/data-model.puml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-03-05 23:42:15 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-03-05 23:42:15 -0300
commit8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5 (patch)
tree84f9ddd9e41236fb7a6f540aab07e65db9bc93cb /docs/data-model.puml
parent295c6a5a1f2b0db9d756ffe7bf413553a0c02737 (diff)
downloadSakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.tar.gz
Sakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.zip
ocaml re-migration
Diffstat (limited to 'docs/data-model.puml')
-rw-r--r--docs/data-model.puml101
1 files changed, 0 insertions, 101 deletions
diff --git a/docs/data-model.puml b/docs/data-model.puml
deleted file mode 100644
index 59e2cff..0000000
--- a/docs/data-model.puml
+++ /dev/null
@@ -1,101 +0,0 @@
-@startuml data-model
-!theme plain
-title Data Model Core Abstractions
-
-class attribute {
- + hash: SHA256
- + value: term()
-}
-
-class tuple {
- + hash: SHA256
- + relation: atom()
- + attribute_map: #{name => hash}
-}
-
-class relation {
- + hash: SHA256
- + name: atom()
- + tree: merkle_tree()
- + schema: #{attr => type_relation}
- + constraints: constraints()
- + cardinality: {finite, N} | aleph_zero | continuum
- + generator: function() | undefined
- + provenance: provenance()
-}
-
-class type_relation {
- + name: atom()
- + erlang_type: type()
- + membership_predicate: function()
- + unfold_generator: function()
- + cardinality: aleph_zero | continuum
-}
-
-class database_state {
- + hash: SHA256
- + name: atom()
- + tree: merkle_tree()
- + relations: #{name => hash}
- + type_relations: #{name => type_relation}
- + timestamp: integer()
-}
-
-database_state "1" *-- "many" relation : contains
-database_state "1" *-- "many" type_relation : defines types
-relation "1" *-- "many" tuple : contains
-tuple "1" *-- "many" attribute : references
-relation --> type_relation : schema references
-
-note right of attribute
- Content-Addressed Storage:
- - SHA-256 hash of value
- - Automatic deduplication
- - Immutable once stored
-
- Value Validation:
- Value must be member of
- type relation specified in schema
-end note
-
-note right of relation
- Storage Strategy:
- - Finite: Merkle tree (materialized)
- - Infinite: Generator (lazy)
-
- Type Relations:
- - Primitives: natural, integer, real, string
- - Composite: views over other relations
-end note
-
-note left of type_relation
- **Schema Philosophy:**
- Attributes are typed by type relations (not primitives).
- Types are relations (stored as infinite relations).
- Schema validation = membership checking.
-
- **Type Relations are Relations:**
- They define domains via:
- 1. Erlang type constraint
- 2. Additional predicates
- 3. Unfold generator for enumeration
-
- Examples:
- - natural[X] :- integer[X], X >= 0
- - complex[X] :- X is (A,B), real[A], real[B]
-end note
-
-note bottom of database_state
- **Schema Example:**
- employee relation schema:
- #{
- name => non_empty_string, % type relation
- age => natural, % type relation
- salary => positive_integer % type relation
- }
-
- Each schema value is a reference to a type relation,
- NOT a primitive type string like "integer"
-end note
-
-@enduml