From 441f2f3359d6f59e4f26f1d5751926d26b1c7cf9 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Thu, 3 Sep 2026 16:55:45 -0300 Subject: Substantial relation kernel object --- lib/protocols/Relation.ml | 18 ++++++++++++++++++ lib/protocols/Relation.mli | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lib/protocols/Relation.ml create mode 100644 lib/protocols/Relation.mli (limited to 'lib/protocols') diff --git a/lib/protocols/Relation.ml b/lib/protocols/Relation.ml new file mode 100644 index 0000000..ece9b8e --- /dev/null +++ b/lib/protocols/Relation.ml @@ -0,0 +1,18 @@ +class type implementation = object + method heading : (Concepts.Hash.hash, Concepts.Condition.condition) result + method predicate : (Concepts.Hash.hash option, Concepts.Condition.condition) result + method local_constraints : (Concepts.Hash.hash option, Concepts.Condition.condition) result + method tuples : (Concepts.Hash.hash, Concepts.Condition.condition) result + method contains : Concepts.Blob.t -> (bool, Concepts.Condition.condition) result +end + +type Handle.protocol += Relation of implementation +type t = implementation + +let make impl = Relation (impl :> implementation) +let from handle = Handle.into handle (function Relation impl -> Some impl | _ -> None) +let heading i = Handle.invoke i (fun o -> o#heading) +let predicate i = Handle.invoke i (fun o -> o#predicate) +let local_constraints i = Handle.invoke i (fun o -> o#local_constraints) +let tuples i = Handle.invoke i (fun o -> o#tuples) +let contains i tuple = Handle.invoke i (fun o -> o#contains tuple) diff --git a/lib/protocols/Relation.mli b/lib/protocols/Relation.mli new file mode 100644 index 0000000..4aeb562 --- /dev/null +++ b/lib/protocols/Relation.mli @@ -0,0 +1,22 @@ +type t + +class type implementation = object + method heading : (Concepts.Hash.hash, Concepts.Condition.condition) result + method predicate : (Concepts.Hash.hash option, Concepts.Condition.condition) result + method local_constraints : (Concepts.Hash.hash option, Concepts.Condition.condition) result + method tuples : (Concepts.Hash.hash, Concepts.Condition.condition) result + method contains : Concepts.Blob.t -> (bool, Concepts.Condition.condition) result +end + +val make : #implementation -> Handle.protocol +val from : Handle.t -> t Handle.interface option +val heading : t Handle.interface -> (Concepts.Hash.hash, Concepts.Condition.condition) result + +val predicate : + t Handle.interface -> (Concepts.Hash.hash option, Concepts.Condition.condition) result + +val local_constraints : + t Handle.interface -> (Concepts.Hash.hash option, Concepts.Condition.condition) result + +val tuples : t Handle.interface -> (Concepts.Hash.hash, Concepts.Condition.condition) result +val contains : t Handle.interface -> Concepts.Blob.t -> (bool, Concepts.Condition.condition) result -- cgit v1.2.3