aboutsummaryrefslogtreecommitdiffstats
path: root/include/operations.hrl
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2025-12-31 21:07:26 -0300
committerGitHub <noreply@github.com>2025-12-31 21:07:26 -0300
commitc9b69ab3ae238da966bcba3d3e86f5c27a0df922 (patch)
tree68bcc6731a783a923524b46a436dcffb1f582988 /include/operations.hrl
parentff5691ffb1a969e50e0bd5e4638be8e2bb342c4e (diff)
downloadSakura-c9b69ab3ae238da966bcba3d3e86f5c27a0df922.tar.gz
Sakura-c9b69ab3ae238da966bcba3d3e86f5c27a0df922.zip
1OPs, bound context and domain constraints (#46)
Diffstat (limited to 'include/operations.hrl')
-rw-r--r--include/operations.hrl17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/operations.hrl b/include/operations.hrl
index dcaa287..0200c44 100644
--- a/include/operations.hrl
+++ b/include/operations.hrl
@@ -7,7 +7,7 @@
name, % Relation name (atom)
tree, % Merkle tree (mutable only), undefined for immutable/generator-based
schema, % #{attribute_name => relation_name}
- constraints, % #{attribute_name => constraint_spec()} - integrity constraints
+ 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
@@ -27,6 +27,21 @@
cardinality % {finite, N} | aleph_zero | continuum
}).
+%% Attribute constraint (1OP - 1st Order Property)
+%% Constrains values of a specific attribute in a relation
+-record(attribute_constraint, {
+ attribute :: atom(), % Attribute name (e.g., salary)
+ domain :: atom() | #relation{}, % Domain or relation this attribute draws from
+ constraints :: [term()] % Additional relational constraints beyond domain membership
+}).
+
+%% Relation constraints - holds all types of constraints for a relation
+-record(relation_constraints, {
+ attribute_constraints :: #{atom() => #attribute_constraint{}}, % 1OPs - attribute constraints
+ tuple_constraints :: [term()], % 2OPs - inter-attribute constraints (future)
+ multi_tuple_constraints :: [term()] % 3OPs - multi-tuple constraints (future)
+}).
+
%%% Cardinality Types
-type cardinality() :: {finite, non_neg_integer()} % Finite set with N elements