-let dc_metadata db obj =
- let tables =
- [ "dc:creator","dccreator" ;
- "dc:date","dcdate" ;
- "dc:description","dcdescription" ;
- "dc:format","dcformat" ;
- "dc:identifier","dcidentifier" ;
- "dc:language","dclanguage" ;
- "dc:publisher","dcpublisher" ;
- "dcq:RelationType","dcqRelationType" ;
- "dc:relation","dcrelation" ;
- "dc:rights","dcrights" ;
- "dc:source","dcsource" ;
- "dc:subject","dcsubject" ;
- "dc:title","dctitle" ;
- "hth:ResourceFormat","hthResourceFormat" ;
- "hth:contact","hthcontact" ;
- "hth:firstVersion","hthfirstVersion" ;
- "hth:institution","hthinstitution" ;
- "hth:modified","hthmodified"
- ]
- in
- let msg = mk_new_msg () in
- msg_output_dc_header msg obj ;
- List.iter
- (fun (propertyname,tablename) ->
- let res =
- M.exec db
- ("SELECT * FROM " ^ tablename ^ " WHERE uri = '" ^ obj ^ "';") in
- M.iter res
- ~f:(function cols ->
- let value = value_of_optional_value (cols.(0)) in
- msg_output_string msg
- (" <" ^ propertyname ^ ">" ^ value ^ "</" ^ propertyname ^ ">\n") ;
- ) ;
- ) tables ;
+let dc_metadata dbd obj =
+ let tables =
+ [ "dc:creator","dccreator" ;
+ "dc:date","dcdate" ;
+ "dc:description","dcdescription" ;
+ "dc:format","dcformat" ;
+ "dc:identifier","dcidentifier" ;
+ "dc:language","dclanguage" ;
+ "dc:publisher","dcpublisher" ;
+ "dcq:RelationType","dcqRelationType" ;
+ "dc:relation","dcrelation" ;
+ "dc:rights","dcrights" ;
+ "dc:source","dcsource" ;
+ "dc:subject","dcsubject" ;
+ "dc:title","dctitle" ;
+ "hth:ResourceFormat","hthResourceFormat" ;
+ "hth:contact","hthcontact" ;
+ "hth:firstVersion","hthfirstVersion" ;
+ "hth:institution","hthinstitution" ;
+ "hth:modified","hthmodified"
+ ]
+ in
+ let msg = mk_new_msg () in
+ let table_map (propertyname, tablename) =
+ let query = "SELECT * FROM " ^ tablename ^ " WHERE uri = '" ^ obj ^ "';" in
+ let map cols =
+ let value = value_of_optional_value (cols.(0)) in
+ msg_output_string msg
+ (" <" ^ propertyname ^ ">" ^ value ^ "</" ^ propertyname ^ ">\n")
+ in
+ exec_and_iter dbd query map
+ in
+ msg_output_dc_header msg obj ;
+ List.iter table_map tables ;