puree 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/puree/model/research_output.rb +6 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/mixins/project_mixin.rb +28 -0
- data/lib/puree/xml_extractor/research_output.rb +13 -0
- data/lib/puree/xml_extractor/xml_extractor.rb +1 -0
- data/test/xml_extractor/xml_extractor_research_output_test.rb +40 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bf126598ca6a267612c243bf8140c594c875ea
|
4
|
+
data.tar.gz: b09a23a98dda52719e3e1767f3d7ef08b52ba5da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d625c5527a02c5748e980640cfb7c56d851c661e9292aaea6732f0fecdca075cfeb50f163f622b7656455f022bbdc7f6797da9f429889731c81701623b73a9cd
|
7
|
+
data.tar.gz: fd3788695ac2118a2f9f20cf0d03a6b16bdfc53fe6080ad10c67e90cde7ee2ae1b256099a86efaeaee8e6a371a1e380c461d137f99fda1f6d23f35d28c6a85e2
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,16 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## 2.1.0 - 2018-03-12
|
6
|
+
### Added
|
7
|
+
- Research output - scopus_id, projects
|
8
|
+
|
5
9
|
## 2.0.0 - 2017-12-19
|
6
10
|
### Changed
|
7
11
|
- For Pure API 59.
|
8
12
|
|
9
13
|
### Added
|
10
|
-
- Independent modules: REST, Extractor, XMLExtractor
|
14
|
+
- Independent modules: REST, Extractor, XMLExtractor.
|
11
15
|
- Testing against known live data.
|
12
16
|
|
13
17
|
## 1.7.0 - 2017-11-03
|
@@ -50,6 +50,9 @@ module Puree
|
|
50
50
|
# @return [Array<Puree::Model::EndeavourPerson>]
|
51
51
|
attr_accessor :persons_other
|
52
52
|
|
53
|
+
# @return [Array<Puree::Model::RelatedContentHeader>]
|
54
|
+
attr_accessor :projects
|
55
|
+
|
53
56
|
# @return [Array<Puree::Model::PublicationStatus>]
|
54
57
|
attr_accessor :publication_statuses
|
55
58
|
|
@@ -60,6 +63,9 @@ module Puree
|
|
60
63
|
# @return [Fixnum, nil]
|
61
64
|
attr_accessor :scopus_citations_count
|
62
65
|
|
66
|
+
# @return [String, nil]
|
67
|
+
attr_accessor :scopus_id
|
68
|
+
|
63
69
|
# @return [Array<Puree::Model::ResearchOutputScopusMetric>]
|
64
70
|
attr_accessor :scopus_metrics
|
65
71
|
|
data/lib/puree/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Puree
|
2
|
+
|
3
|
+
module XMLExtractor
|
4
|
+
|
5
|
+
# Project extractor mixin.
|
6
|
+
#
|
7
|
+
module ProjectMixin
|
8
|
+
|
9
|
+
# Projects
|
10
|
+
# @return [Array<Puree::Model::RelatedContentHeader>]
|
11
|
+
def projects
|
12
|
+
xpath_result = xpath_query '/relatedProjects/relatedProject'
|
13
|
+
|
14
|
+
data_arr = []
|
15
|
+
xpath_result.each { |i|
|
16
|
+
related = Puree::Model::RelatedContentHeader.new
|
17
|
+
related.type = i.xpath('type').text.strip
|
18
|
+
related.title = i.xpath('name').text.strip
|
19
|
+
related.uuid = i.attr('uuid').strip
|
20
|
+
data_arr << related
|
21
|
+
}
|
22
|
+
data_arr.uniq { |d| d.uuid }
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -10,6 +10,7 @@ module Puree
|
|
10
10
|
include Puree::XMLExtractor::OrganisationalUnitMixin
|
11
11
|
include Puree::XMLExtractor::OwnerMixin
|
12
12
|
include Puree::XMLExtractor::PersonMixin
|
13
|
+
include Puree::XMLExtractor::ProjectMixin
|
13
14
|
include Puree::XMLExtractor::ResearchOutputMixin
|
14
15
|
include Puree::XMLExtractor::WorkflowMixin
|
15
16
|
include Puree::XMLExtractor::TitleMixin
|
@@ -119,6 +120,16 @@ module Puree
|
|
119
120
|
xpath_result ? xpath_result.to_i : nil
|
120
121
|
end
|
121
122
|
|
123
|
+
# @return [String, nil]
|
124
|
+
def scopus_id
|
125
|
+
xpath_result = xpath_query '/externalableInfo/secondarySources/secondarySource'
|
126
|
+
return if xpath_result.empty?
|
127
|
+
source = xpath_result.xpath('source')
|
128
|
+
if source && source.text.strip.downcase === 'scopus'
|
129
|
+
return xpath_result.xpath('sourceId').text.strip
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
122
133
|
# @return [Array<Puree::Model::ResearchOutputScopusMetric>]
|
123
134
|
def scopus_metrics
|
124
135
|
xpath_result = xpath_query '/scopusMetrics/scopusMetric'
|
@@ -169,9 +180,11 @@ module Puree
|
|
169
180
|
@model.persons_internal = persons_internal
|
170
181
|
@model.persons_external = persons_external
|
171
182
|
@model.persons_other = persons_other
|
183
|
+
@model.projects = projects
|
172
184
|
@model.publication_statuses = publication_statuses
|
173
185
|
@model.research_outputs = research_outputs
|
174
186
|
@model.scopus_citations_count = scopus_citations_count
|
187
|
+
@model.scopus_id = scopus_id
|
175
188
|
@model.scopus_metrics = scopus_metrics
|
176
189
|
@model.subtitle = subtitle
|
177
190
|
@model.title = title
|
@@ -13,6 +13,7 @@ require 'puree/xml_extractor/mixins/pages_mixin'
|
|
13
13
|
require 'puree/xml_extractor/mixins/person_mixin'
|
14
14
|
require 'puree/xml_extractor/mixins/page_range_mixin'
|
15
15
|
require 'puree/xml_extractor/mixins/peer_reviewed_mixin'
|
16
|
+
require 'puree/xml_extractor/mixins/project_mixin'
|
16
17
|
require 'puree/xml_extractor/mixins/publisher_mixin'
|
17
18
|
require 'puree/xml_extractor/mixins/research_output_mixin'
|
18
19
|
require 'puree/xml_extractor/mixins/workflow_mixin'
|
@@ -98,6 +98,16 @@ class TestXMLExtractorResearchOutput < Minitest::Test
|
|
98
98
|
refute_empty x.keywords.first
|
99
99
|
end
|
100
100
|
|
101
|
+
def test_projects
|
102
|
+
# Measurements of the Higgs boson production and decay rates and coupling strengths using pp collision data at s√=7s=7 and 8 TeV in the ATLAS experiment
|
103
|
+
id = '24ec62e9-a3cc-4402-9ec9-396067949031'
|
104
|
+
x = xml_extractor_from_id id
|
105
|
+
|
106
|
+
assert_instance_of Array, x.projects
|
107
|
+
assert_instance_of Puree::Model::RelatedContentHeader, x.projects.first
|
108
|
+
assert_equal true, x.projects.first.data?
|
109
|
+
end
|
110
|
+
|
101
111
|
def test_scopus_citations_count
|
102
112
|
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
103
113
|
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
@@ -106,6 +116,13 @@ class TestXMLExtractorResearchOutput < Minitest::Test
|
|
106
116
|
assert_instance_of Fixnum, x.scopus_citations_count
|
107
117
|
end
|
108
118
|
|
119
|
+
def test_scopus_id
|
120
|
+
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
121
|
+
x = xml_extractor_from_id id
|
122
|
+
|
123
|
+
assert_instance_of String, x.scopus_id
|
124
|
+
end
|
125
|
+
|
109
126
|
def test_scopus_metrics
|
110
127
|
# The effect of humic substances on barite precipitation-dissolution behaviour in natural and synthetic lake waters
|
111
128
|
id = 'ce76dbda-8b22-422b-9bb6-8143820171b8'
|
@@ -180,6 +197,9 @@ class TestXMLExtractorResearchOutput < Minitest::Test
|
|
180
197
|
assert_instance_of Array, x.persons_other
|
181
198
|
assert_empty x.persons_other
|
182
199
|
|
200
|
+
assert_instance_of Array, x.projects
|
201
|
+
assert_empty x.projects
|
202
|
+
|
183
203
|
assert_instance_of Array, x.publication_statuses
|
184
204
|
assert_empty x.publication_statuses
|
185
205
|
|
@@ -211,4 +231,24 @@ class TestXMLExtractorResearchOutput < Minitest::Test
|
|
211
231
|
|
212
232
|
assert_instance_of Puree::Model::ResearchOutput, x.model
|
213
233
|
end
|
234
|
+
|
235
|
+
def test_projects_snippet
|
236
|
+
# Improving the language skills of Pre-Kindergarten students
|
237
|
+
# id = '54ac6efc-1739-4e42-b4c9-bcb1c6dfd664'
|
238
|
+
|
239
|
+
xml =
|
240
|
+
'<contributionToJournal>
|
241
|
+
<relatedProjects>
|
242
|
+
<relatedProject uuid="fe8aebdf-a926-4e7b-adf1-082425e50330">
|
243
|
+
<name>The Language Bases of Reading Comprehension</name>
|
244
|
+
<type uri="/dk/atira/pure/upmproject/upmprojecttypes/upmproject/research">Research</type>
|
245
|
+
</relatedProject>
|
246
|
+
</relatedProjects>
|
247
|
+
</contributionToJournal>'
|
248
|
+
|
249
|
+
x = Puree::XMLExtractor::JournalArticle.new xml
|
250
|
+
assert_instance_of Array, x.projects
|
251
|
+
assert_instance_of Puree::Model::RelatedContentHeader, x.projects.first
|
252
|
+
assert_equal true, x.projects.first.data?
|
253
|
+
end
|
214
254
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Albin-Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/puree/xml_extractor/mixins/pages_mixin.rb
|
183
183
|
- lib/puree/xml_extractor/mixins/peer_reviewed_mixin.rb
|
184
184
|
- lib/puree/xml_extractor/mixins/person_mixin.rb
|
185
|
+
- lib/puree/xml_extractor/mixins/project_mixin.rb
|
185
186
|
- lib/puree/xml_extractor/mixins/publisher_mixin.rb
|
186
187
|
- lib/puree/xml_extractor/mixins/research_output_mixin.rb
|
187
188
|
- lib/puree/xml_extractor/mixins/title_mixin.rb
|