diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2025-11-24 22:40:22 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-24 22:40:22 -0300 |
| commit | 62a017ce95ad2f6d9445b5b96f7aeba3f7c0d42f (patch) | |
| tree | d67f93407ad049e4dc39fae1002146a8d03e4505 /include/operations.hrl | |
| parent | 09be36e5f5e2c5714b9542df8ccc363ab86ac6da (diff) | |
| download | Sakura-62a017ce95ad2f6d9445b5b96f7aeba3f7c0d42f.tar.gz Sakura-62a017ce95ad2f6d9445b5b96f7aeba3f7c0d42f.zip | |
Joins with provenance and lineage (#11)
Diffstat (limited to 'include/operations.hrl')
| -rw-r--r-- | include/operations.hrl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/operations.hrl b/include/operations.hrl index 6d481ad..93b4a74 100644 --- a/include/operations.hrl +++ b/include/operations.hrl @@ -65,9 +65,40 @@ %%% Provenance Types (for updatable views) +%% Relation-level provenance (tracks operation lineage) -type provenance() :: undefined | {base, atom()} % Base relation | {join, provenance(), provenance()} | {select, provenance(), constraints()} | {project, provenance(), [atom()]} | {take, provenance(), pos_integer()}. + +%% Attribute-level provenance (tracks data lineage for each attribute) +%% Maps attribute name to its source (relation, original_attribute_name) +-type attribute_provenance() :: #{atom() => {atom(), atom()}}. + +%% Tuple-level lineage (tracks complete operational history) +%% Operation tree showing how the tuple was derived +-type lineage_op() :: + {base, atom()} % Base relation + | {select, fun(), lineage_op()} % Filter operation + | {project, [atom()], lineage_op()} % Projection + | {join, atom(), lineage_op(), lineage_op()} % Join on attribute + | {theta_join, fun(), lineage_op(), lineage_op()} % Join with predicate + | {sort, fun(), lineage_op()} % Sort operation + | {take, pos_integer(), lineage_op()} % Limit operation + | {aggregate, atom(), atom(), lineage_op()}. % Aggregation (future) + +%% Tuple metadata (contains provenance, lineage, and other system-managed fields) +-type tuple_metadata() :: #{ + provenance => attribute_provenance(), + lineage => lineage_op() + % Future: timestamp, version, etc. +}. + +%% Tuples with metadata use a nested 'meta' field: +%% #{id => 1, name => "Alice", +%% meta => #{ +%% provenance => #{id => {employees, id}, name => {employees, name}}, +%% lineage => {select, fun(T) -> maps:get(age, T) > 30 end, {base, employees}} +%% }} |
