open Utility;;
open Dbconn;;
open Pattern;;
-open Union;;
+open Union;;*)
open Intersect;;
-open Diff;;
+(*open Diff;;
open Sortedby;;
open Use;;
open Select;;
type group_context = (MathQL.rvar * MathQL.attribute_group) list
+type vvar_context = (MathQL.vvar * MathQL.value) list
+
let svars = ref [] (* contesto delle svar *)
let groups = ref [] (* contesto dei gruppi *)
+let vvars = ref [] (* contesto delle vvar introdotte con let-in *)
-(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *)
let rec exec_set_exp = function
- | MathQL.Ref x -> []
-
-
+ | MathQL.Ref vexp -> List.map (fun s -> (s,[])) (exec_val_exp vexp)
+ | MathQL.Intersect sexp1 sexp2 -> intersect_ex (exec_set_exp sexp1) (exec_set_exp sexp2)
+ | _ -> assert false
+
(* valuta una MathQL.boole_exp e ritorna un boole *)
and exec_boole_exp = function
| MathQL.True -> true
| MathQL.Not x -> not (exec_boole_exp x)
| MathQL.And (x, y) -> (exec_boole_exp x) && (exec_boole_exp y)
- | MathQL.Or (x, y) -> (exec_boole_exp x) || (exec_boole_exp y)
-
+ | MathQL.Or (x, y) -> (exec_boole_exp x) || (exec_boole_exp y)
+ | _ -> assert false
(* valuta una MathQL.val_exp e ritorna un MathQL.value *)
and exec_val_exp = function
- | MathQL.Const l -> []
-
+ | MathQL.Const x -> x
+ | _ -> assert false
(* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *)
+(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *)
let execute x =
- svars := []; rvars := []; groups := [];
+ svars := []; rvars := []; groups := []; vvars := [];
exec_set_exp x
+