- (n+2,
- (sprintf "%s as %s" conclno_tbl cur_tbl1 ::
- sprintf "%s as %s" hypno_tbl cur_tbl2 :: from),
- (sprintf "%s.no - %s.no %s %d" cur_tbl2 cur_tbl1 op card ::
- (if n=0 then assert false
- else [sprintf "table0.source = %s.source" cur_tbl1;
- sprintf "table0.source = %s.source" cur_tbl2]) @
- where))
-
-let add_constraint tables (n,from,where) metadata =
- let obj_tbl,rel_tbl,sort_tbl,conclno_tbl,fullno_tbl,hypno_tbl = tables in
+ (sprintf "%s.hypothesis - %s.conclusion %s %d" tbl tbl op card :: where)
+
+let add_all_constr ?(tbl=library_count_tbl) (n,from,where) concl full diff =
+ match (concl, full, diff) with
+ | None, None, None -> (n,from,where)
+ | _ ->
+ let cur_tbl = tbln n in
+ let from = (sprintf "%s as %s" tbl cur_tbl) :: from in
+ let where = add_card_constr cur_tbl "conclusion" where concl in
+ let where = add_card_constr cur_tbl "statement" where full in
+ let where = add_diff_constr cur_tbl where diff in
+ (n+2,from,
+ (if n > 0 then
+ sprintf "table0.source = %s.source" cur_tbl :: where
+ else
+ where))
+
+
+let add_constraint ?(start=0) ?(tables=default_tables) (n,from,where) metadata =
+ let obj_tbl,rel_tbl,sort_tbl,count_tbl = tables
+ in