diff options
Diffstat (limited to '')
| -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}} +%% }} |
