; docformat = 'rst' ; ; NAME: ; getAuthorCitation ; PURPOSE: ; Retrieve the citations to a bibliographic list from NASA/Ads XML output. ; ;+ ; :Description: ; Retrieve the citations to a bibliographic list from NASA/Ads XML output. ; ; :Categories: ; Bibliography ; ; :Params: ; bib: in, required, type=structure ; A structure of bibliography information. ; ; :Keywords: ; plot: in, required, type=boolean, default=0 ; Create a plot for each bibligraphic reference. ; ; :Returns: A structure with the bibliographic entries. Fields are:: ; ; :Examples: ; Get the list of record from the author, and check for citations: ; IDL> ref = getAuthorRecord('carry, b', /refereed) ; IDL> cit = getAuthorCitations(ref, hIndex=h) ; IDL> print, 'h-index = '+strtrim(string(h,format='(I)'),2) ; ; :Uses: ; read_xml ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in October 2015, B. Carry (OCA) ;- function getAuthorCitations, bib, plot=plot, hIndex=hIndex COMPILE_OPT hidden, idl2 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--I.1-- Verify Input Syntax ---------------------------------------------------------- if not keyword_set(bib) then begin message, /IOERROR, 'Syntax error: citations = getAuthorCitations( bib )' return, -1 endif ;--I.2-- Analysis Input Bibliography -------------------------------------------------- nbBib=n_elements( bib ) ;--I.2-- Test File for Reading -------------------------------------------------------- ; if not file_test(file,/read) then begin ; message, /IOERROR, 'Bibliography file cannot be found: '+strtrim(file,2) ; return, -2 ; endif ;--I.3-- Type of Entries -------------------------------------------------------------- ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Request Citations Entries From Internet -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Set Output Structure --------------------------------------------------------- cit={type:'', ads:'', id:'', year:0, month:'', $ journal:'', abbrev:'', volume:0, issue:'', page:'', $ title:'', first:'', doi: '', $ authors:ptr_new()} hIndex=intarr(nbBib) ;--II.2-- Interrogate NASA/Ads for Other Citations ------------------------------------- for kBib=0, nbBib-1 do begin ;--II.2.1-- Get Publications time=sysTime(/JULIAN, /UTC) nameRef = '/tmp/cit'+string(time,format='(D16.8)')+'.xml' ; spawn, 'wget "http://adsabs.harvard.edu/cgi-bin/nph-ref_query?bibcode='+$ ; bib[kBib].ads+'&refs=CITATIONS&db_key=AST&data_type=SHORT_XML" -O '+nameRef spawn, 'wget "http://adsabs.harvard.edu/cgi-bin/nph-ref_query?bibcode='+$ bib[kBib].ads+'&refs=CITATIONS&db_key=AST&data_type=SHORT_XML" -O '+nameRef, adsO, adsE ;--II.2.2-- Store into IDL Structure citAdd = readBiblioXML(nameRef, /citations) if size(citAdd,/Type) eq 8 then begin ;--II.2.3-- Add to Existing Structure cit = [cit, citAdd] ;--II.3-- Plot Current Citations ------------------------------------------------------- if keyword_set(plot) then begin if size(plot,/Type) eq 7 then begin nameFig=plot+'/'+bib[kBib].id+'.png' if ~file_test( plot+'/', /directory) then file_mkdir, plot+'/' endif else nameFig=bib[kBib].id+'.png' plotBiblioYear, citAdd, nameFig endif ;--II.4-- Build H-Index Array ---------------------------------------------------------- hIndex[kBib] = n_elements(citAdd) endif endfor nbCit=n_elements(cit) if nbCit gt 1 then cit=cit[1:nbCit-1] ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; return, cit end