+
+
+(* input data structures ****************************************************)
+
+type svar = string (* the name of a variable for a resource set *)
+
+type avar = string (* the name of a variable for a resource *)
+
+type vvar = string (* the name of a variable for an attribute value *)
+
+type inverse = bool
+
+type refine = RefineExact
+ | RefineSub
+ | RefineSuper
+
+type main = path
+
+type pattern = bool
+
+type exp = path * (path option)
+
+type exp_list = exp list
+
+type allbut = bool
+
+type xml = bool
+
+type source = bool
+
+type bin = BinFJoin (* full union - with attr handling *)
+ | BinFMeet (* full intersection - with attr handling *)
+ | BinFDiff (* full difference - with attr handling *)
+
+type gen = GenFJoin (* full union - with attr handling *)
+ | GenFMeet (* full intersection - with attr handling *)
+
+type test = Xor
+ | Or
+ | And
+ | Sub
+ | Meet
+ | Eq
+ | Le
+ | Lt
+
+type query = Empty
+ | SVar of svar
+ | AVar of avar
+ | Subj of msval
+ | Property of inverse * refine * path *
+ main * istrue * isfalse list * exp_list *
+ pattern * msval
+ | Select of avar * query * msval
+ | Bin of bin * query * query
+ | LetSVar of svar * query * query
+ | LetVVar of vvar * msval * query
+ | For of gen * avar * query * query
+ | Add of bool * groups * query
+ | If of msval * query * query
+ | Log of xml * source * query
+ | StatQuery of query
+ | Keep of allbut * path list * query
+
+and msval = False
+ | True
+ | Not of msval
+ | Ex of avar list * msval
+ | Test of test * msval * msval
+ | Const of string
+ | Set of msval list
+ | Proj of path option * query
+ | Dot of avar * path
+ | VVar of vvar
+ | StatVal of msval
+ | Count of msval
+ | Align of string * msval
+
+and groups = Attr of (path * msval) list list
+ | From of avar
+
+and con = pattern * path * msval
+
+and istrue = con list
+
+and isfalse = con list