From 49e52032242e39eba0cf24ca16a37c84b52cc356 Mon Sep 17 00:00:00 2001 From: natile Date: Mon, 18 Nov 2002 18:06:58 +0000 Subject: [PATCH] Relation: inverse switch added. --- helm/ocaml/mathql_interpreter/mqint.ml | 6 +++--- helm/ocaml/mathql_interpreter/relation.ml | 4 ++-- helm/ocaml/mathql_interpreter/relation.mli | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index bbaeec0b5..bee3bd765 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -123,14 +123,14 @@ let rec exec_set_exp c = function | 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 " ^ (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 " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); print_endline (string_of_float (Sys.time() -. before) ^ "s"); @@ -202,7 +202,7 @@ 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) diff --git a/helm/ocaml/mathql_interpreter/relation.ml b/helm/ocaml/mathql_interpreter/relation.ml index 57b89122e..54f42a7e5 100644 --- a/helm/ocaml/mathql_interpreter/relation.ml +++ b/helm/ocaml/mathql_interpreter/relation.ml @@ -46,7 +46,7 @@ let get_prop_id propl = ;; -let relation_ex rop path rset attl = +let relation_ex inv rop path rset attl = let usek = get_prop_id path in let vvar = if attl = [] then "position" else List.hd attl @@ -139,7 +139,7 @@ let muse path attl r = (* prende un resource_set, una vvar (primo el. di attl) a cui associare la posizione, e la relazione (refObj o backPointer) e per ogni resource chiama la muse NOTA: "rop" per ora non viene usato perche' vale sempre "ExactOp" *) -let relation_galax_ex rop path rset attl = +let relation_galax_ex inv rop path rset attl = List.stable_sort (fun (uri1,l1) (uri2,l2) -> compare uri1 uri2) (List.concat (List.map (muse path attl) rset)) diff --git a/helm/ocaml/mathql_interpreter/relation.mli b/helm/ocaml/mathql_interpreter/relation.mli index 4a9d181e1..66df961c5 100644 --- a/helm/ocaml/mathql_interpreter/relation.mli +++ b/helm/ocaml/mathql_interpreter/relation.mli @@ -24,7 +24,9 @@ *) val relation_ex : - MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set + bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set + val relation_galax_ex : - MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set +bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set + -- 2.39.2