package links
This module provides an efficient method of performing calculations on delta sets. This is done by storing the records in a sorted order and by keeping track of the columns of the whole set of records rather than in each record itself.
module Simple_record : sig ... end
module Inconsistent_columns_error : sig ... end
val construct : records:Links_lens__.Phrase_value.t list -> t
val construct_cols :
columns:string list ->
records:Links_lens__.Phrase_value.t list ->
t
val construct_full :
columns:string list ->
plus:Simple_record.t list ->
neg:Simple_record.t list ->
t
val columns : t -> string list
val plus_rows : t -> Simple_record.t array
val neg_rows : t -> Simple_record.t array
val is_positive : t -> bool
The record set does not contain negative entries.
val total_size : t -> int
The total number of records in the set.
val pp : Stdlib.Format.formatter -> t -> unit
val pp_tabular : Stdlib.Format.formatter -> t -> unit
Print the set in tabular form.
val find : t -> record:Simple_record.t -> bool
Returns true if the record set contains record
as a positive row.
val get_cols_map : t -> columns:string list -> 'a list -> 'a list
Generate a function which maps a set of columns to a subset of those columns specified by columns
.
Example:
let sr = (* sorted records with columns A, B, C, D *) in
let map = get_cols_map sr ~columns:["B"; "D"] in
let proj = map [1; 2; 3; 4] in
(* proj = [2; 4] *)
val sort : t -> unit
Project the record set onto the given list of column names.
module Reorder_error : sig ... end
val reorder : t -> first:string list -> (t, Reorder_error.t) Stdlib.result
Reorder the columns, so that the columns first
appear at the beginning.
module Join_error : sig ... end
val join :
t ->
t ->
on:(string * string * string) list ->
(t, Join_error.t) Stdlib.result
Perform a relational join on two sets. on
consists out of tuples with the order:
- output name
- left input name
- right input name
val to_value : t -> Links_lens__.Phrase_value.t list
Convert a positive delta set into a value type.
val project_fun_dep :
t ->
fun_dep:Fun_dep.t ->
(string list * string list)
* (Simple_record.t * Simple_record.t) array
* (Simple_record.t * Simple_record.t) array
val calculate_fd_changelist :
t ->
fun_deps:Fun_dep.Set.t ->
((string list * string list) * (Simple_record.t * Simple_record.t) list) list
val relational_update : t -> fun_deps:Fun_dep.Set.t -> update_with:t -> t
val relational_merge : t -> fun_deps:Fun_dep.Set.t -> update_with:t -> t
val relational_extend :
t ->
key:string ->
by:string ->
data:t ->
default:Links_lens__.Phrase_value.t ->
(t, Reorder_error.t) Stdlib.result
Extend the given set of sorted records by the column by
and populate it using the relational data data
containing the functional dependency key
-> by
. Use the default value specified if no entry in data
is found.
val all_values : t -> Simple_record.t list
Get all distinct values of both positive and negative records in this set in a sorted list.
val to_diff :
t ->
key:string list ->
(string list
* (Simple_record.t list * Simple_record.t list * Simple_record.t list),
Reorder_error.t)
Stdlib.result
val to_diff_exn :
t ->
key:string list ->
string list
* (Simple_record.t list * Simple_record.t list * Simple_record.t list)