From 3184f85de1dac7071afcf9838dfc3f8609b20a5a Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sun, 20 Sep 2026 03:00:57 -0300 Subject: provenance --- lib/concepts/Cardinality.mli | 1 + lib/kernel/SubstantialRelation.ml | 5 +++-- lib/protocols/Schematics.ml | 4 +++- lib/protocols/Schematics.mli | 12 +++++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/concepts/Cardinality.mli b/lib/concepts/Cardinality.mli index e4df62b..c9a5d6d 100644 --- a/lib/concepts/Cardinality.mli +++ b/lib/concepts/Cardinality.mli @@ -6,6 +6,7 @@ val equal : t -> t -> bool val leq : t -> t -> bool val join : t -> t -> t val meet : t -> t -> t + (** the class of a generator run under every binding produced by another, which is how the classes of the generators chosen by an analysis combine. *) diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml index 0176928..1b58e9a 100644 --- a/lib/kernel/SubstantialRelation.ml +++ b/lib/kernel/SubstantialRelation.ml @@ -120,11 +120,12 @@ module Make (S : Abstract.Storage.STORAGE) = struct kvs |> List.map (fun (name, domain) -> Concepts.Encoding.Bencode.as_string domain - |> Result.map (fun domain -> (name, domain))) + |> Result.map (fun domain -> + (name, {Protocols.Schematics.domain; provenance= []}) ) ) |> Utilities.List.sequence |> Result.map (fun kvs -> List.fold_left - (fun acc (name, domain) -> BatMap.String.add name domain acc) + (fun acc (name, attribute) -> BatMap.String.add name attribute acc) BatMap.String.empty kvs) let scan storage relation ~keep = diff --git a/lib/protocols/Schematics.ml b/lib/protocols/Schematics.ml index d2e50ad..49d8586 100644 --- a/lib/protocols/Schematics.ml +++ b/lib/protocols/Schematics.ml @@ -1,5 +1,7 @@ type multigroup_description = string BatMap.String.t -type relation_description = string BatMap.String.t +type origin = {source: string list; attribute: string} +type attribute_description = {domain: string; provenance: origin list} +type relation_description = attribute_description BatMap.String.t type tuple_description = {relation: relation_description; attributes: string BatMap.String.t} (* TODO: For now the description is completely detached from actual diff --git a/lib/protocols/Schematics.mli b/lib/protocols/Schematics.mli index dc8f320..fe81943 100644 --- a/lib/protocols/Schematics.mli +++ b/lib/protocols/Schematics.mli @@ -4,7 +4,17 @@ type t types and domains. Later figure out a way to represent the links without strings. *) type multigroup_description = string BatMap.String.t -type relation_description = string BatMap.String.t + +(** where an attribute comes from with the path relation and the + attribute it has. *) +type origin = {source: string list; attribute: string} + +(** an attribute of a derived relation may be for several occurrences + at once, for example in a natural join. So its provenance is a + collection. *) +type attribute_description = {domain: string; provenance: origin list} + +type relation_description = attribute_description BatMap.String.t type tuple_description = {relation: relation_description; attributes: string BatMap.String.t} type description = -- cgit v1.2.3