Class: BibliographicalImporter::CSV::Record_Refworks

Inherits:
Object
  • Object
show all
Includes:
BibliographicalImporter::CommonRecordAttributes, ReferenceMethods
Defined in:
lib/bibliographical_importer/csv.rb

Instance Attribute Summary collapse

Attributes included from BibliographicalImporter::CommonRecordAttributes

#abstract, #affiliation, #authors, #cited, #doi, #id_scopus, #id_wos, #journal, #journal_abbr, #keywords, #keywords_plus, #language, #pages, #references_crossref, #references_scopus, #references_wos, #title, #type, #uid, #url, #volume, #year

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReferenceMethods

#authors_apa_6, #cite_apa_6, #ref_apa_6, #ref_apa_6_brief, #ref_apa_6_brief_html

Methods included from DOIHelpers

#a_doi, #doi_without_http, #find_doi, #url_doi

Constructor Details

#initialize(row_value) ⇒ Record_Refworks

Returns a new instance of Record_Refworks



51
52
53
54
55
# File 'lib/bibliographical_importer/csv.rb', line 51

def initialize(row_value)
  @row=row_value
  @authors=[]
  parse_common
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row



41
42
43
# File 'lib/bibliographical_importer/csv.rb', line 41

def row
  @row
end

Class Method Details

.create(row) ⇒ Object



44
45
46
47
48
49
# File 'lib/bibliographical_importer/csv.rb', line 44

def self.create(row)
  #type=self.determine_type(bibtex_value)
  #klass="Reference_#{type.capitalize}".to_sym
  #BibliographicalImporter::JSON.const_get(klass).send(:new, bibtex_value)
  BibliographicalImporter::CSV::Record_Refworks.new(row)
end

Instance Method Details

#authorObject



84
85
86
# File 'lib/bibliographical_importer/csv.rb', line 84

def author
  @authors.join (" and ")
end

#cited_referencesObject

Determine the type of the reference. It could be infered by fields



89
90
91
# File 'lib/bibliographical_importer/csv.rb', line 89

def cited_references
  nil
end

#parse_commonObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/bibliographical_importer/csv.rb', line 57

def parse_common
  ##$log.info(@row)
  begin
    require 'digest'

    @type="refworks"

    @title=row["Title Primary"]
    @abstract=row["Abstract"]
    @authors=row["Authors, Primary"].split(";")
    @journal=row["Periodical Full"]
    @year=row["Pub Year"]
    @volume=row["Volume"]
    @pages="#{row['Start Page']}-#{row['Other Pages']}"
    @doi=row["DOI"]
    @doi=nil if @doi!~/10./
    @keywords=row["Keywords"]
    @url=row["URL"]
    @journal_abbr=row["Periodical Abbrev"]
    @uid=digest=Digest::SHA256.hexdigest "#{row["Authors, Primary"]}-#{@year}-#{@title}"
  rescue Exception => e
    #$log.info("Error:#{row}")
    raise e
  end

end

#strip_lines(value) ⇒ Object



94
95
96
# File 'lib/bibliographical_importer/csv.rb', line 94

def strip_lines(value)
  value.to_s.gsub(/\n\s*/, ' ')
end