X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fmathql%2FmQueryUtil.ml;h=09759cc4536dfd8962ae825de25c9375c998895c;hb=ba64642ca7771cd9cc7b9f73476c8f608ffeeda5;hp=ea1829719f37bfd86641ecf4cadecb4f8deba55c;hpb=ba824e867afc3eaf081ed1a1d6526d421242a6a0;p=helm.git diff --git a/helm/ocaml/mathql/mQueryUtil.ml b/helm/ocaml/mathql/mQueryUtil.ml index ea1829719..09759cc45 100644 --- a/helm/ocaml/mathql/mQueryUtil.ml +++ b/helm/ocaml/mathql/mQueryUtil.ml @@ -48,46 +48,45 @@ let text_of_query x = let txt_svar sv = "%" ^ sv in let txt_rvar rv = "@" ^ rv in let txt_vvar vv = "$" ^ vv in + let txt_inv i = if i then "inverse " else "" in let txt_ref = function | M.ExactOp -> "" | M.SubOp -> "sub " | M.SuperOp -> "super " in - let txt_vvar_list l = - l - in + let txt_refpath i r p = txt_inv i ^ txt_ref r ^ txt_list txt_qstr "/" p ^ " " in let rec txt_val = function - | M.Const [s] -> txt_qstr s - | M.Const l -> "{" ^ txt_list txt_qstr ", " l ^ "}" - | M.VVar vv -> txt_vvar vv - | M.Record (rv, vv) -> txt_rvar rv ^ "." ^ txt_vvar vv - | M.Fun (s, x) -> "fun " ^ txt_qstr s ^ " " ^ txt_val x - | M.Attribute (r, p, x) -> "attribute " ^ txt_ref r ^ txt_list txt_qstr "/" p ^ " " ^ txt_val x - | M.RefOf x -> "refof " ^ txt_set x + | M.Const [s] -> txt_qstr s + | M.Const l -> "{" ^ txt_list txt_qstr ", " l ^ "}" + | M.VVar vv -> txt_vvar vv + | M.Record (rv, vv) -> txt_rvar rv ^ "." ^ txt_vvar vv + | M.Fun (s, x) -> "fun " ^ txt_qstr s ^ " " ^ txt_val x + | M.Attribute (i, r, p, x) -> "attribute " ^ txt_refpath i r p ^ txt_val x + | M.RefOf x -> "refof " ^ txt_set x and txt_boole = function | M.False -> "false" | M.True -> "true" | M.Ex b x -> "ex " ^ txt_boole x -(* | M.Ex b x -> "ex [" ^ txt_list txt_rvar "," b ^ "] " ^ txt_boole x *) - | M.Not x -> "not " ^ txt_boole x +(* | M.Ex b x -> "ex [" ^ txt_list txt_rvar "," b ^ "] " ^ txt_boole x +*) | M.Not x -> "not " ^ txt_boole x | M.And (x, y) -> "(" ^ txt_boole x ^ " and " ^ txt_boole y ^ ")" | M.Or (x, y) -> "(" ^ txt_boole x ^ " or " ^ txt_boole y ^ ")" | M.Sub (x, y) -> "(" ^ txt_val x ^ " sub " ^ txt_val y ^ ")" | M.Meet (x, y) -> "(" ^ txt_val x ^ " meet " ^ txt_val y ^ ")" | M.Eq (x, y) -> "(" ^ txt_val x ^ " eq " ^ txt_val y ^ ")" and txt_set = function - | M.SVar sv -> txt_svar sv - | M.RVar rv -> txt_rvar rv - | M.Relation (r, p, x, []) -> "relation " ^ txt_ref r ^ txt_list txt_qstr "/" p ^ " " ^ txt_set x - | M.Relation (r, p, x, l) -> "relation " ^ txt_ref r ^ txt_list txt_qstr "/" p ^ " " ^ txt_set x ^ " attr " ^ txt_list txt_vvar ", " l - | M.Union (x, y) -> "(" ^ txt_set x ^ " union " ^ txt_set y ^ ")" - | M.Intersect (x, y) -> "(" ^ txt_set x ^ " intersect " ^ txt_set y ^ ")" - | M.Diff (x, y) -> "(" ^ txt_set x ^ " diff " ^ txt_set y ^ ")" - | M.LetSVar (sv, x, y) -> "let " ^ txt_svar sv ^ " be " ^ txt_set x ^ " in " ^ txt_set y - | M.LetVVar (vv, x, y) -> "let " ^ txt_vvar vv ^ " be " ^ txt_val x ^ " in " ^ txt_set y - | M.Select (rv, x, y) -> "select " ^ txt_rvar rv ^ " in " ^ txt_set x ^ " where " ^ txt_boole y - | M.Pattern x -> "pattern " ^ txt_val x - | M.Ref x -> "ref " ^ txt_val x + | M.SVar sv -> txt_svar sv + | M.RVar rv -> txt_rvar rv + | M.Relation (i, r, p, x, []) -> "relation " ^ txt_refpath i r p ^ txt_set x + | M.Relation (i, r, p, x, l) -> "relation " ^ txt_refpath i r p ^ txt_set x ^ " attr " ^ txt_list txt_vvar ", " l + | M.Union (x, y) -> "(" ^ txt_set x ^ " union " ^ txt_set y ^ ")" + | M.Intersect (x, y) -> "(" ^ txt_set x ^ " intersect " ^ txt_set y ^ ")" + | M.Diff (x, y) -> "(" ^ txt_set x ^ " diff " ^ txt_set y ^ ")" + | M.LetSVar (sv, x, y) -> "let " ^ txt_svar sv ^ " be " ^ txt_set x ^ " in " ^ txt_set y + | M.LetVVar (vv, x, y) -> "let " ^ txt_vvar vv ^ " be " ^ txt_val x ^ " in " ^ txt_set y + | M.Select (rv, x, y) -> "select " ^ txt_rvar rv ^ " in " ^ txt_set x ^ " where " ^ txt_boole y + | M.Pattern x -> "pattern " ^ txt_val x + | M.Ref x -> "ref " ^ txt_val x in txt_set x