The Biocaml Library : Biocaml_entrez.Make.PubmedSummary

struct
(* DTD is at http://www.ncbi.nlm.nih.gov/entrez/query/DTD/eSummaryDTD/eSummary_pubmed.dtd *)

type t = {
pmid : int ;
doi : string option ;
pubdate : string option ;
source : string option ;
title : string ;
}

let parse_article_ids x =
map_echildren
~tag:"ArticleId"
(fun x -> sleaf_exn "IdType" x, sleaf_exn "Value" x)
x

let parse_document_summary x =
let article_ids = parse_article_ids (echild_exn "ArticleIds" x) in
{ pmid = int_of_string (List.Assoc.find_exn article_ids "pubmed") ;
doi = List.Assoc.find article_ids "doi" ;
pubdate = sleaf "PubDate" x ;
source = sleaf "Source" x ;
title = sleaf_exn "Title" x }

let parse_eSummaryResult x =
map_echildren
~tag:"DocumentSummary"
parse_document_summary
(echild_exn "DocumentSummarySet" x)


let search = search_and_summary `pubmed parse_eSummaryResult
end

AltStyle によって変換されたページ (->オリジナル) /