X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fmathql_interpreter%2Fmqint.ml;h=415ee13401ae35d0179c88df75354dbeeb832f76;hb=9ee9af7b1b537f0ff921b4936bd5a248fac72e6d;hp=64aea7d3373d682aada9ba33cf6604bcfd31ceb8;hpb=a7720af3d9a8e97ab9e5179150350025da58d97f;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index 64aea7d33..415ee1340 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -42,7 +42,8 @@ open Context;; open Diff;; open Relation;; open Func;; - +open Attribute;; +open Pattern;; exception BooleExpTrue @@ -78,6 +79,7 @@ let rec exec_set_exp c = function MathQL.SVar svar -> List.assoc svar c.svars | MathQL.RVar rvar -> [List.assoc rvar c.rvars] | MathQL.Ref vexp -> List.map (fun s -> (s,[])) (exec_val_exp c vexp) + | MathQL.Pattern vexp -> pattern_ex (exec_val_exp c vexp) | MathQL.Intersect (sexp1, sexp2) -> let before = Sys.time() in let rs1 = exec_set_exp c sexp1 in @@ -119,19 +121,19 @@ let rec exec_set_exp c = function print_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res - | MathQL.Relation (rop, path, sexp, attl) -> + | MathQL.Relation (inv, rop, path, sexp, attl) -> let before = Sys.time() in if ! dbname = postgres_db then - (let res = relation_ex rop path (exec_set_exp c sexp) attl in + (let res = relation_ex inv rop path (exec_set_exp c sexp) attl in if ! stat then - (print_string ("RELATION " ^ (List.hd path) ^ " = " ^ string_of_int(List.length res) ^ ": "); + (print_string ("RELATION " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); print_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res) else - (let res = relation_galax_ex rop path (exec_set_exp c sexp) attl in + (let res = relation_galax_ex inv rop path (exec_set_exp c sexp) attl in if !stat then - (print_string ("RELATION-GALAX " ^ (List.hd path) ^ " = " ^ string_of_int(List.length res) ^ ": "); + (print_string ("RELATION-GALAX " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); print_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res) @@ -154,7 +156,6 @@ let rec exec_set_exp c = function flush stdout); res | MathQL.Diff (sexp1, sexp2) -> diff_ex (exec_set_exp c sexp1) (exec_set_exp c sexp2) - | _ -> assert false (* valuta una MathQL.boole_exp e ritorna un boole *) @@ -201,12 +202,12 @@ and exec_val_exp c = function else s::[] in edup ol - | MathQL.Record (rvar, vvar) -> List.assoc vvar (List.assoc rvar c.groups) + | MathQL.Record (rvar, path) -> List.assoc path (List.assoc rvar c.groups) | MathQL.VVar s -> List.assoc s c.vvars | MathQL.RefOf sexp -> List.map (fun (s,_) -> s) (exec_set_exp c sexp) | MathQL.Fun (s, vexp) -> fun_ex s (exec_val_exp c vexp) - | MathQL.Attribute (rop, path, vexp) -> [] + | MathQL.Attribute (inv, rop, path, vexp) -> attribute_ex rop path inv (exec_val_exp c vexp) (* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *) and execute x =