- let build_select_sort (pos, dep, sor) =
- M.Select
- ("uri",
- M.Relation (true, M.RefineExact, ("refSort", []), M.Ref (M.Const [""]), [assign "p" "position";assign "d" "depth";assign "s" "sort"]),
- M.Ex ["uri"]
- (M.And
- ((M.And
- ((M.Sub (M.Const [pos], M.Record ("uri", in_path "p"))),
- (M.Sub (M.Const [dep], M.Record ("uri", in_path "d"))))),
- (M.Sub (M.Const [sor], M.Record ("uri", in_path "s"))))))
+ let build_select_sort (pos, dep, sor) =
+ match dep with
+ None -> M.Select
+ ("uri",
+ M.Relation (true, M.RefineExact, ("refSort", []), M.Ref (M.Const [""]), [assign "p" "position";assign "d" "depth";assign "s" "sort"]),
+ M.Ex ["uri"]
+ (M.And
+ ((M.Sub (M.Const [pos], M.Record ("uri", in_path "p"))),
+ (M.Sub (M.Const [sor], M.Record ("uri", in_path "s"))))))
+
+ | Some dep -> let string_dep = string_of_int dep in
+ M.Select
+ ("uri",
+ M.Relation (true, M.RefineExact, ("refSort", []), M.Ref (M.Const [""]), [assign "p" "position";assign "d" "depth";assign "s" "sort"]),
+ M.Ex ["uri"]
+ (M.And
+ ((M.And
+ ((M.Sub (M.Const [pos], M.Record ("uri", in_path "p"))),
+ (M.Sub (M.Const [string_dep], M.Record ("uri", in_path "d"))))),
+ (M.Sub (M.Const [sor], M.Record ("uri", in_path "s"))))))