aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/operations.hrl94
1 files changed, 0 insertions, 94 deletions
diff --git a/include/operations.hrl b/include/operations.hrl
deleted file mode 100644
index 52f2f4c..0000000
--- a/include/operations.hrl
+++ /dev/null
@@ -1,94 +0,0 @@
-%%% Core Records
-
--record(database_state, {hash, name, tree, relations, timestamp}).
-
--record(relation, {
- hash, % Content hash (finite) or generator hash (infinite)
- name, % Relation name (atom)
- tree, % Merkle tree (mutable only), undefined for immutable/generator-based
- schema, % #{attribute_name => relation_name}
- constraints, % #relation_constraints{} - logical formulas over membership tests
- cardinality, % {finite, N} | aleph_zero | continuum
- generator, % Generator function (immutable only), undefined for tree-based
- membership_criteria, % #{attribute_name => constraint:relational_constraint()} - domain membership test
- provenance, % attribute_provenance() - maps attribute to source relation
- lineage % lineage_op() - operation tree showing derivation
-}).
-
--record(tuple, {hash, relation, attribute_map}).
--record(attribute, {hash, value}).
-
-%% Specification record for creating immutable relations
--record(domain, {
- name, % Atom - relation name
- schema, % #{attribute_name => relation_name}
- generator, % {module, function} - tuple generator
- membership_criteria, % #{attribute_name => constraint:relational_constraint()} - domain membership
- cardinality % {finite, N} | aleph_zero | continuum
-}).
-
-%% Relation constraints - unified logical formulas.
-%% Every formula is evaluated as a membership test expression over tuple bindings.
--record(relation_constraints, {
- constraints :: [{atom(), term()}]
-}).
-
-%%% Cardinality Types
-
--type cardinality() :: {finite, non_neg_integer()} % Finite set with N elements
- | aleph_zero % Countably infinite (ℵ₀)
- | continuum. % Uncountably infinite (2^ℵ₀)
-
--type constraints() :: #{atom() => constraint:relational_constraint()}.
-
--type boundedness_constraints() :: #{atom() => constraints()}.
-
-%%% Generator Types
-
--type generator_fun() :: fun((constraints()) -> generator_result()).
-
--type generator_result() ::
- done % No more tuples
- | {value, map(), generator_fun()} % Tuple and continuation
- | {error, term()}. % Error
-
--type generator_spec() ::
- {primitive, atom()} % Built-in: naturals, integers, rationals
- | {custom, generator_fun()} % User-defined generator
- | {take, atom(), pos_integer()} % Take N from relation
- | {derived, relational_op()}. % Derived from relational operation
-
--type relational_op() ::
- {select, atom(), constraints()}
- | {project, atom(), [atom()]}
- | {join, atom(), atom(), join_spec()}.
-
--type join_spec() ::
- {equijoin, atom()} % Natural join on attribute
- | {theta, atom(), atom(), atom()}. % Theta join: op(attr1, attr2)
-
-%%% 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)