From a138f1c57ef376a3f2521ce1f8877ed97bc3e654 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sat, 3 Jan 2026 20:58:59 -0300 Subject: Refactor constraint system (#49) * fix dialyzer and clean code * rework on validation criterias and mnesia-aware domains * [refactor] add comparison relations to database startup * fix nix build * fix docs for edoc --- include/operations.hrl | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/operations.hrl b/include/operations.hrl index 0200c44..2afb27b 100644 --- a/include/operations.hrl +++ b/include/operations.hrl @@ -10,7 +10,7 @@ constraints, % #relation_constraints{} - all constraint types (1OP, 2OP, 3OP) cardinality, % {finite, N} | aleph_zero | continuum generator, % Generator function (immutable only), undefined for tree-based - membership_criteria, % #{attribute_name => constraint_spec()} - domain membership test + 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 }). @@ -23,7 +23,7 @@ name, % Atom - relation name schema, % #{attribute_name => relation_name} generator, % {module, function} - tuple generator - membership_criteria, % #{attribute_name => constraint_spec()} - domain membership + membership_criteria, % #{attribute_name => constraint:relational_constraint()} - domain membership cardinality % {finite, N} | aleph_zero | continuum }). @@ -48,23 +48,7 @@ | aleph_zero % Countably infinite (ℵ₀) | continuum. % Uncountably infinite (2^ℵ₀) -%%% Constraint Types - --type constraint_spec() :: - {eq, term()} % Equality: attr = value - | {neq, term()} % Inequality: attr ≠ value - | {lt, number()} % Less than: attr < value - | {lte, number()} % Less than or equal: attr ≤ value - | {gt, number()} % Greater than: attr > value - | {gte, number()} % Greater than or equal: attr ≥ value - | {in, [term()]} % Membership: attr ∈ list - | {range, number(), number()} % Range: attr ∈ [min, max] - | {member_of, atom()} % Type constraint: attr ∈ Relation - | {'and', [term()]} - | is_integer - | is_float. - --type constraints() :: #{atom() => constraint_spec()}. +-type constraints() :: #{atom() => constraint:relational_constraint()}. -type boundedness_constraints() :: #{atom() => constraints()}. -- cgit v1.2.3