class ElsevierApi::XMLResponse::ElsevierApi::XMLResponse::ElsevierApi::XMLResponse::Abstractcitationsresponse

Attributes

column_total[R]
grand_total[R]
h_index[R]
later_total[R]
n_records[R]
prev_total[R]
range_total[R]
records[R]
year_range[R]

Public Instance Methods

citations_by_year(scopus_id) click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 83
def citations_by_year(scopus_id)
  record=get_record(scopus_id)
  return nil if record[:cc].length==0
  year_range.each_index.inject({}) {|ac,i|
    ac[@year_range[i]]=record[:cc][i]
    ac
  }
end
citations_outside_range?(scopus_id) click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 91
def citations_outside_range?(scopus_id)
  @grand_total!=@range_total
end
empty_record?(scopus_id) click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 79
def empty_record?(scopus_id)
  record=get_record(scopus_id)
  record[:cc]==[]
end
get_record(scopus_id) click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 74
def get_record(scopus_id)
  record=@records.find {|r| r[:scopus_id]==scopus_id}
  raise("Record doesn't exists") unless record
  record
end
process() click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 41
def process
  #p @xml
  @h_index=process_path(@xml,"//h-index").to_i
  @year_range=@xml.xpath("//columnHeading").map {|xx| xx.text.to_i}
  @prev_total=process_path(@xml,"//prevColumnTotal").to_i
  @later_total=process_path(@xml,"//laterColumnTotal").to_i
  @column_total=@xml.xpath("//columnTotal").map {|xx| xx.text.to_i}
  @range_total=process_path(@xml,"//rangeColumnTotal").to_i
  @grand_total=process_path(@xml,"//grandTotal").to_i


  @records=xml.xpath("//citeInfo").map do |x|
    scopus_id=process_path(x,".//dc:identifier")

    pcc=process_path(x,".//pcc").to_i
    cc=x.xpath(".//cc").map {|xx| xx.text.to_i}

    lcc=process_path(x,".//lcc").to_i
    #if scopus_id=="SCOPUS_ID:84866769122"
    #  p x
    #  p({:scopus_id=>scopus_id,:pcc=>pcc,:lcc=>lcc,:cc=>cc})
    #end
    {:scopus_id=>scopus_id,:pcc=>pcc,:lcc=>lcc,:cc=>cc}
  end
  #p @records
end
scopus_id_a() click to toggle source
# File lib/elsevier_api/xml_response/abstract_citation_response.rb, line 71
def scopus_id_a
  @records.map {|r| r[:scopus_id]}
end