(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                            XML Query Engine                         *)
(*                                                                     *)
(*  Copyright 2001, Lucent Technologies.                               *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: maputil.mli,v 1.9 2002/10/06 03:41:27 simeon Exp $ *)

open Xquery_ast

(* Commonly used variables in the typing & mapping: *)

val dot      : vname
val coll     : vname
val position : vname
val last     : vname

(*************************************************************)
(* this interface contains functions for mapping Full XQuery *)
(* expressions to the Core XQuery expression. For each Full  *)
(* XQuery expression, this inteface will have a mapping      *)
(* function defined, ie. its mapping rule.                   *)
(*************************************************************)

val map_binary_operator : binop -> cexpr -> cexpr -> expr_handle -> Finfo.finfo -> cexpr 
val map_unary_operator  : string -> cexpr -> expr_handle -> Finfo.finfo -> cexpr 
val map_function_app    : rfname -> cexpr list -> expr_handle -> Finfo.finfo -> Xatenv.tenv -> cexpr

val map_to_flwr    : cexpr list -> cexpr option -> cexpr -> expr_handle -> Finfo.finfo -> cexpr

val map_to_CEIf      : cexpr -> cexpr -> cexpr -> expr_handle -> Finfo.finfo -> cexpr
val map_to_CESome    : datatype option -> vname -> cexpr -> cexpr -> expr_handle -> Finfo.finfo -> cexpr
val map_to_CEEvery   : datatype option -> vname -> cexpr -> cexpr -> expr_handle -> Finfo.finfo -> cexpr
val map_to_sequence  : expr_handle -> Finfo.finfo  -> cexpr list -> cexpr

val map_to_element   : Sym.relem_symbol -> cexpr list -> cexpr list -> expr_handle -> Finfo.finfo -> cexpr
val map_to_computed_element : cexpr  -> cexpr list -> cexpr list -> expr_handle -> Finfo.finfo -> cexpr

val atomization               	: cexpr -> expr_handle -> Finfo.finfo -> cexpr 
val map_sequence_atomic_value 	: cexpr -> expr_handle -> Finfo.finfo -> cexpr 
val map_predicate_truth_value 	: cexpr -> cexpr -> expr_handle -> Finfo.finfo -> cexpr
val map_effective_boolean_value : cexpr -> expr_handle -> Finfo.finfo -> cexpr

val cast_to_simpletype : cexpr -> Simple.simple_type -> expr_handle -> Finfo.finfo -> cexpr

(* Generate new variable name and variable expression *)
val gen_new_var_expr : expr_handle -> Finfo.finfo -> (vname * cexpr)
