aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Schematics.ml
blob: 49d85868f6455caa73198377dca8d7b50fd5c084 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
type multigroup_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
   types and domains. Later figure out a way to represent the links
   without strings. *)
type description =
  | Multigroup of multigroup_description
  | Relation of relation_description
  | Tuple of tuple_description

class type implementation = object
  method describe : unit -> (description, Concepts.Condition.condition) result
end

type Handle.protocol += Schematics of implementation

type t = implementation

let make impl = Schematics (impl :> implementation)
let from handle =
  Handle.into handle (function Schematics impl -> Some impl | _ -> None)
let describe impl = Handle.invoke impl (fun o -> o#describe ())