aboutsummaryrefslogtreecommitdiffstats
path: root/test/Helpers.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-09-26 13:22:10 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-09-26 13:22:10 -0300
commit504e2d03a10f1641b36a9d5f127a18bc943562ce (patch)
tree3cff1b25540fd01c2c583f47e3bf90363543b0b2 /test/Helpers.ml
parent8ff6bd42c0708b35f3026633e99f109de1bec89e (diff)
downloadRNT-504e2d03a10f1641b36a9d5f127a18bc943562ce.tar.gz
RNT-504e2d03a10f1641b36a9d5f127a18bc943562ce.zip
ephemeral relations as outputs of FOL and program overhaul
Diffstat (limited to '')
-rw-r--r--test/Helpers.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Helpers.ml b/test/Helpers.ml
index 42cf8a5..7f65007 100644
--- a/test/Helpers.ml
+++ b/test/Helpers.ml
@@ -32,11 +32,29 @@ module Storage = struct
module Make (S : Abstract.Storage.STORAGE) (C : CONFIGURATOR) = struct
module SI = Kernel.Storage.Make (S)
+ module SR = Kernel.SubstantialRelation.Make (S)
let store_schema tx attributes =
Concepts.Encoding.Bencode.(Dict (List.map (fun a -> a, String "string") attributes) |> to_blob)
|> SI.store_blob tx
+ let relation conn attributes tuples =
+ let open Utilities.Result in
+ let* value =
+ SI.with_transaction conn (fun tx ->
+ let* schematics = store_schema tx attributes in
+ let* _ = SR.TupleSet.empty_under tx in
+ let* node =
+ List.fold_left
+ (fun node tuple ->
+ let* node = node in
+ SR.TupleSet.insert tx (Concepts.Tuple.hash tuple) tuple node )
+ (Ok SR.TupleSet.empty) tuples
+ in
+ Ok {SR.schematics; tuples= SR.TupleSet.hash_of node} )
+ in
+ SR.load conn value
+
let with_connection f dir () =
with_temporary_directory dir begin fun dir ->
begin