let uri = escape uri in
let positions =
match where with
- | `Conclusion -> ["\"MainConclusion\""; "\"InConclusion\""]
+ | `Conclusion -> [ MetadataTypes.mainconcl_pos; MetadataTypes.inconcl_pos ]
| `Statement ->
- ["\"MainConclusion\""; "\"InConclusion\""; "\"InHypothesis\"";
- "\"MainHypothesis\""]
+ [ MetadataTypes.mainconcl_pos; MetadataTypes.inconcl_pos;
+ MetadataTypes.inhyp_pos; MetadataTypes.mainhyp_pos ]
in
let query =
+ let pos_predicate =
+ String.concat " OR "
+ (List.map (fun pos -> sprintf "(h_position = \"%s\")" pos) positions)
+ in
sprintf ("SELECT h_occurrence FROM %s WHERE source=\"%s\" AND (%s) UNION "^^
"SELECT h_occurrence FROM %s WHERE source=\"%s\" AND (%s)")
- (MetadataTypes.obj_tbl ()) uri (String.concat " OR " positions)
- MetadataTypes.library_obj_tbl uri (String.concat " OR " positions)
+ (MetadataTypes.obj_tbl ()) uri pos_predicate
+ MetadataTypes.library_obj_tbl uri pos_predicate
in
let result = Mysql.exec dbd query in