aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Tuple.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/concepts/Tuple.ml48
-rw-r--r--lib/concepts/Tuple.mli9
2 files changed, 0 insertions, 57 deletions
diff --git a/lib/concepts/Tuple.ml b/lib/concepts/Tuple.ml
deleted file mode 100644
index 8fac426..0000000
--- a/lib/concepts/Tuple.ml
+++ /dev/null
@@ -1,48 +0,0 @@
-(* @needs Value *)
-
-module AttributeMap = BatMap.String
-
-(** A tuple: a finite map from attribute name to attribute. *)
-type t = Value.value AttributeMap.t
-
-(** [empty] The tuple with no attributes. *)
-let empty : t = AttributeMap.empty
-
-(** [access name t] Looks up the attribute bound to [name] in [t].
- @param name attribute name to look up.
- @param t tuple to search.
- @return the attribute, or [None] when [name] is unbound. *)
-let access (name : string) (t : t) : Value.value option = AttributeMap.find_opt name t
-
-(** [merge left right] Unions two tuples. Shared attributes take the
- [left] value; one-sided attributes are kept. Precondition: shared
- attributes agree (the natural-join matcher guarantees this), so the
- [left] bias is never observable.
- @param left first tuple.
- @param right second tuple.
- @return the merged tuple. *)
-let merge (left : t) (right : t) : t =
- let merger _ (left : Value.value option) (right : Value.value option) : Value.value option =
- match left, right with (Some _ as v), _ | None, (Some _ as v) -> v | None, None -> None
- in
- AttributeMap.merge merger left right
-
-(** [project keep t] Keeps only the attributes of [t] whose names are
- in [keep].
- @param keep set of attribute names to retain.
- @param t tuple to project.
- @return the projected tuple. *)
-let project (keep : BatSet.String.t) (t : t) : t =
- AttributeMap.filter (fun name _ -> BatSet.String.mem name keep) t
-
-(** [rename mapping t] Renames the attributes of [t] through
- [mapping]; names absent from [mapping] are left unchanged.
- @param mapping map from old name to new name.
- @param t tuple to rename.
- @return the renamed tuple. *)
-let rename (mapping : string BatMap.String.t) (t : t) : t =
- AttributeMap.fold
- (fun name attr acc ->
- let name = BatMap.String.find_default name name mapping in
- AttributeMap.add name attr acc )
- t AttributeMap.empty
diff --git a/lib/concepts/Tuple.mli b/lib/concepts/Tuple.mli
deleted file mode 100644
index 07f7a24..0000000
--- a/lib/concepts/Tuple.mli
+++ /dev/null
@@ -1,9 +0,0 @@
-module AttributeMap = BatMap.String
-
-type t = Value.value AttributeMap.t
-
-val empty : t
-val access : string -> t -> Value.value option
-val merge : t -> t -> t
-val project : BatSet.String.t -> t -> t
-val rename : string BatMap.String.t -> t -> t