; docformat = 'rst' ; ; NAME: ; getAuthorRecord ; PURPOSE: ; Retrieve the publication record of an author from NASA/Ads. ; ;+ ; :Description: ; Retrieve the publication record of an author from NASA/Ads. ; ; :Categories: ; Bibliography ; ; :Params: ; author: in, required, type=string ; The name of the author, e.g., "Einstein", or "Einstein, A" ; ; :Keywords: ; refereed: in, optional, type=boolean, default=1 ; Only return refereed publications. ; contributed: in, optional, type=boolean, default=1 ; Only return non-refereed publications. ; ; :Returns: A structure with the bibliographic entries. Fields are:: ; type : Type of entry (refereed|invited|contributed|citations) ; ads : Ads Unique Identifyer ; id : Unique Id ; year : Year of publication ; month : Month of publication ; journal : Journal full name ; abbrev : Journal abbreviation ; volume : Volume ; issue : Issue ; page : Article pages ; title : Article title ; first : First author family name ; doi : Article DOI ; authors : Full list of authors ; ; :Examples: ; Get the list of refereed record from the author, and check for citations: ; IDL> ref = getAuthorRecord('carry, b', /refereed) ; ; :Uses: ; read_xml ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in October 2015, B. Carry (OCA) ;- function getAuthorRecord, author, refereed=refereed, contributed=contributed ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Verify Input Syntax ---------------------------------------------------------- if not keyword_set(author) then begin message, /ioError, 'Syntax error: bib = getAuthorRecord( author )' return, -1 endif ;--I.2-- Type of Entries -------------------------------------------------------------- if not keyword_set(refereed) and not keyword_set(contributed) then begin refereed=1 contributed=1 endif ;--I.3-- Proper Format for Author Name-------------------------------------------------- split = strsplit( author, ' ', /extract, count=nbField) if nbField gt 1 then begin new = split[0] for kS=1, nbField-1 do new+='%2C+'+split[kS] author=new endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Request Bibliographic Entries From Internet -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; time=sysTime(/JULIAN, /UTC) ;--II.1-- Interrogate NASA/Ads for Refereed Entries-------------------------------------- if keyword_set(refereed) then begin ;--II.1.1-- Get Publications nameRef = '/tmp/ref'+string(time,format='(D16.8)')+'.xml' ; print, 'curl "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?db_key=AST&db_key=PRE&qform=AST&arxiv_sel=astro-ph&arxiv_sel=cond-mat&arxiv_sel=cs&arxiv_sel=gr-qc&arxiv_sel=hep-ex&arxiv_sel=hep-lat&arxiv_sel=hep-ph&arxiv_sel=hep-th&arxiv_sel=math&arxiv_sel=math-ph&arxiv_sel=nlin&arxiv_sel=nucl-ex&arxiv_sel=nucl-th&arxiv_sel=physics&arxiv_sel=quant-ph&arxiv_sel=q-bio&sim_query=YES&ned_query=YES&adsobj_query=YES&aut_logic=OR&obj_logic=OR&author='+$ ; author+'&object=&start_mon=&start_year=&end_mon=&end_year=&ttl_logic=OR&title=&txt_logic=OR&text=&nr_to_return=200&start_nr=1&jou_pick=NO&ref_stems=&data_and=ALL&group_and=ALL&start_entry_day=&start_entry_mon=&start_entry_year=&end_entry_day=&end_entry_mon=&end_entry_year=&min_score=&sort=SCORE&data_type=SHORT_XML&aut_syn=YES&ttl_syn=YES&txt_syn=YES&aut_wt=1.0&obj_wt=1.0&ttl_wt=0.3&txt_wt=3.0&aut_wgt=YES&obj_wgt=YES&ttl_wgt=YES&txt_wgt=YES&ttl_sco=YES&txt_sco=YES&version=1" '+$ ; '-o '+nameRef ; spawn, 'curl "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?db_key=AST&db_key=PRE&qform=AST&arxiv_sel=astro-ph&arxiv_sel=cond-mat&arxiv_sel=cs&arxiv_sel=gr-qc&arxiv_sel=hep-ex&arxiv_sel=hep-lat&arxiv_sel=hep-ph&arxiv_sel=hep-th&arxiv_sel=math&arxiv_sel=math-ph&arxiv_sel=nlin&arxiv_sel=nucl-ex&arxiv_sel=nucl-th&arxiv_sel=physics&arxiv_sel=quant-ph&arxiv_sel=q-bio&sim_query=YES&ned_query=YES&adsobj_query=YES&aut_logic=OR&obj_logic=OR&author='+$ ; author+'&object=&start_mon=&start_year=&end_mon=&end_year=&ttl_logic=OR&title=&txt_logic=OR&text=&nr_to_return=200&start_nr=1&jou_pick=NO&ref_stems=&data_and=ALL&group_and=ALL&start_entry_day=&start_entry_mon=&start_entry_year=&end_entry_day=&end_entry_mon=&end_entry_year=&min_score=&sort=SCORE&data_type=SHORT_XML&aut_syn=YES&ttl_syn=YES&txt_syn=YES&aut_wt=1.0&obj_wt=1.0&ttl_wt=0.3&txt_wt=3.0&aut_wgt=YES&obj_wgt=YES&ttl_wgt=YES&txt_wgt=YES&ttl_sco=YES&txt_sco=YES&version=1" '+$ ; '-o '+nameRef, adsO, adsE spawn, 'wget "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?db_key=AST&db_key=PRE&qform=AST&arxiv_sel=astro-ph&arxiv_sel=cond-mat&arxiv_sel=cs&arxiv_sel=gr-qc&arxiv_sel=hep-ex&arxiv_sel=hep-lat&arxiv_sel=hep-ph&arxiv_sel=hep-th&arxiv_sel=math&arxiv_sel=math-ph&arxiv_sel=nlin&arxiv_sel=nucl-ex&arxiv_sel=nucl-th&arxiv_sel=physics&arxiv_sel=quant-ph&arxiv_sel=q-bio&sim_query=YES&ned_query=YES&adsobj_query=YES&aut_logic=OR&obj_logic=OR&author='+$ author+'&object=&start_mon=&start_year=&end_mon=&end_year=&ttl_logic=OR&title=&txt_logic=OR&text=&nr_to_return=200&start_nr=1&jou_pick=NO&ref_stems=&data_and=ALL&group_and=ALL&start_entry_day=&start_entry_mon=&start_entry_year=&end_entry_day=&end_entry_mon=&end_entry_year=&min_score=&sort=SCORE&data_type=SHORT_XML&aut_syn=YES&ttl_syn=YES&txt_syn=YES&aut_wt=1.0&obj_wt=1.0&ttl_wt=0.3&txt_wt=3.0&aut_wgt=YES&obj_wgt=YES&ttl_wgt=YES&txt_wgt=YES&ttl_sco=YES&txt_sco=YES&version=1" '+$ '-O '+nameRef, adsO, adsE ;--II.1.2-- Store into IDL Structure bibRefereed = readBiblioXML(nameRef, /refereed) ;--II.1.3-- Dump it if requested dimR=size(refereed) if dimR[dimR[0]+1] eq 7 then spawn, 'mv '+nameRef+' '+refereed endif ;--II.2-- Interrogate NASA/Ads for Contributed Entries --------------------------------- if keyword_set(contributed) then begin ;--II.2.1-- Get Publications nameRef = '/tmp/non'+string(time,format='(D16.8)')+'.xml' spawn, 'curl "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?db_key=AST&db_key=PRE&qform=AST&arxiv_sel=astro-ph&arxiv_sel=cond-mat&arxiv_sel=cs&arxiv_sel=gr-qc&arxiv_sel=hep-ex&arxiv_sel=hep-lat&arxiv_sel=hep-ph&arxiv_sel=hep-th&arxiv_sel=math&arxiv_sel=math-ph&arxiv_sel=nlin&arxiv_sel=nucl-ex&arxiv_sel=nucl-th&arxiv_sel=physics&arxiv_sel=quant-ph&arxiv_sel=q-bio&sim_query=YES&ned_query=YES&adsobj_query=YES&aut_logic=OR&obj_logic=OR&author='+$ author+'&object=&start_mon=&start_year=&end_mon=&end_year=&ttl_logic=OR&title=&txt_logic=OR&text=&nr_to_return=200&start_nr=1&jou_pick=EXCL&ref_stems=&data_and=ALL&group_and=ALL&start_entry_day=&start_entry_mon=&start_entry_year=&end_entry_day=&end_entry_mon=&end_entry_year=&min_score=&sort=SCORE&data_type=SHORT_XML&aut_syn=YES&ttl_syn=YES&txt_syn=YES&aut_wt=1.0&obj_wt=1.0&ttl_wt=0.3&txt_wt=3.0&aut_wgt=YES&obj_wgt=YES&ttl_wgt=YES&txt_wgt=YES&ttl_sco=YES&txt_sco=YES&version=1" '+$ '-o '+nameRef, adsO, adsE ;--II.2.2-- Store into IDL Structure bibContrib = readBiblioXML(nameRef, /contributed) ;--II.2.3-- Dump it if requested dimC=size(contributed) if dimC[dimC[0]+1] eq 7 then spawn, 'mv '+nameRef+' '+contributed endif ;--II.3-- Concatenate Various Types of Entries ----------------------------------------- tType = string(keyword_set(refereed),format='(I1)')+$ string(keyword_set(contributed), format='(I1)') case tType of '01': bib = bibContrib '10': bib = bibRefereed '11': bib = [bibRefereed,bibContrib] endcase return, bib end