Class: Puree::XMLExtractor::ResearchOutput
Overview
Research output XML extractor.
Instance Method Summary
collapse
Methods included from TypeMixin
#type
Methods included from TitleMixin
#title
#workflow
#research_outputs
#projects
Methods included from OwnerMixin
#owner
#organisational_units
#description
Methods inherited from Resource
#created_at, #created_by, #model, #modified_at, #modified_by, #uuid
Methods inherited from Base
#xpath_query_for_multi_value, #xpath_query_for_single_value
Constructor Details
Returns a new instance of ResearchOutput.
19
20
21
22
|
# File 'lib/puree/xml_extractor/research_output.rb', line 19
def initialize(xml)
super
setup_model :research_output
end
|
Instance Method Details
#bibliographical_note ⇒ String?
25
26
27
|
# File 'lib/puree/xml_extractor/research_output.rb', line 25
def bibliographical_note
xpath_query_for_single_value('/bibliographicalNote')
end
|
#category ⇒ String?
30
31
32
|
# File 'lib/puree/xml_extractor/research_output.rb', line 30
def category
xpath_query_for_single_value '/category'
end
|
#doi ⇒ String?
Digital Object Identifier
36
37
38
|
# File 'lib/puree/xml_extractor/research_output.rb', line 36
def doi
xpath_query_for_single_value '/electronicVersions/electronicVersion[@type="wsElectronicVersionDoiAssociation"]/doi'
end
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/puree/xml_extractor/research_output.rb', line 41
def files
xpath_result = xpath_query '/electronicVersions/electronicVersion[@type="wsElectronicVersionFileAssociation"]'
docs = []
xpath_result.each do |d|
model = Puree::Model::File.new
model.name = d.xpath('file/fileName').text.strip
model.mime = d.xpath('file/mimeType').text.strip
model.size = d.xpath('file/size').text.strip.to_i
model.url = d.xpath('file/URL').text.strip
docs << model
end
docs.uniq { |d| d.url }
end
|
#keywords ⇒ Array<String>
63
64
65
|
# File 'lib/puree/xml_extractor/research_output.rb', line 63
def keywords
keyword_group 'keywordContainers'
end
|
#language ⇒ String?
68
69
70
|
# File 'lib/puree/xml_extractor/research_output.rb', line 68
def language
xpath_query_for_single_value '/language'
end
|
#links ⇒ Array<String>?
73
74
75
|
# File 'lib/puree/xml_extractor/research_output.rb', line 73
def links
xpath_query_for_multi_value '/electronicVersions/electronicVersion[@type="wsElectronicVersionLinkAssociation"]/link'
end
|
#open_access_permission ⇒ String?
78
79
80
|
# File 'lib/puree/xml_extractor/research_output.rb', line 78
def open_access_permission
xpath_query_for_single_value '/openAccessPermission'
end
|
88
89
90
|
# File 'lib/puree/xml_extractor/research_output.rb', line 88
def persons_external
persons 'external', '/personAssociations/personAssociation'
end
|
83
84
85
|
# File 'lib/puree/xml_extractor/research_output.rb', line 83
def persons_internal
persons 'internal', '/personAssociations/personAssociation'
end
|
93
94
95
|
# File 'lib/puree/xml_extractor/research_output.rb', line 93
def persons_other
persons 'other', '/personAssociations/personAssociation'
end
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/puree/xml_extractor/research_output.rb', line 98
def publication_statuses
xpath_result = xpath_query '/publicationStatuses/publicationStatus'
data = []
xpath_result.each do |i|
s = Puree::Model::PublicationStatus.new
s.stage = i.xpath('publicationStatus').text.strip
ymd = {}
ymd['year'] = i.xpath('publicationDate/year').text.strip
ymd['month'] = i.xpath('publicationDate/month').text.strip
ymd['day'] = i.xpath('publicationDate/day').text.strip
s.date = Puree::Util::Date.hash_to_time ymd
data << s
end
data.uniq { |d| d.stage }
end
|
#scopus_citations_count ⇒ Fixnum?
118
119
120
121
|
# File 'lib/puree/xml_extractor/research_output.rb', line 118
def scopus_citations_count
xpath_result = xpath_query_for_single_value '/totalScopusCitations'
xpath_result ? xpath_result.to_i : nil
end
|
#scopus_id ⇒ String?
124
125
126
127
128
129
130
131
|
# File 'lib/puree/xml_extractor/research_output.rb', line 124
def scopus_id
xpath_result = xpath_query '/externalableInfo/secondarySources/secondarySource'
return if xpath_result.empty?
source = xpath_result.xpath('source')
if source && source.text.strip.downcase === 'scopus'
return xpath_result.xpath('sourceId').text.strip
end
end
|
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/puree/xml_extractor/research_output.rb', line 134
def scopus_metrics
xpath_result = xpath_query '/scopusMetrics/scopusMetric'
data = []
xpath_result.each do |i|
s = Puree::Model::ResearchOutputScopusMetric.new
s.value = i.xpath('value').text.strip
s.year = i.xpath('year').text.strip
data << s
end
data
end
|
#subtitle ⇒ String?
147
148
149
|
# File 'lib/puree/xml_extractor/research_output.rb', line 147
def subtitle
xpath_query_for_single_value '/subTitle'
end
|
#translated_subtitle ⇒ String?
152
153
154
|
# File 'lib/puree/xml_extractor/research_output.rb', line 152
def translated_subtitle
xpath_query_for_single_value '/translatedSubTitle'
end
|
#translated_title ⇒ String?
157
158
159
|
# File 'lib/puree/xml_extractor/research_output.rb', line 157
def translated_title
xpath_query_for_single_value '/translatedTitle'
end
|