dwc-archive 0.7.16 → 0.7.17
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +4 -1
- data/VERSION +1 -1
- data/features/dwca-reader.feature +6 -0
- data/features/step_definitions/dwc-reader_steps.rb +10 -0
- data/lib/dwc-archive/classification_normalizer.rb +12 -7
- data/spec/files/synonyms_in_extension.tar.gz +0 -0
- data/spec/lib/dwc-archive_spec.rb +17 -0
- metadata +23 -23
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -62,6 +62,9 @@ Update to latest rubygems (v >= 1.3.6) which adds gemcutter sources by default.
|
|
62
62
|
# if you don't want to generate path consisting of canonical forms of ancestors to a taxon
|
63
63
|
cn.normalize(:with_canonical_names => false)
|
64
64
|
|
65
|
+
# if you don't want to ingest information from extensions
|
66
|
+
cn.normalize(:with_extensions => false)
|
67
|
+
|
65
68
|
# to get a flat hash of nodes with attached vernacular names and synonyms
|
66
69
|
normalized_data = cn.normalized_data
|
67
70
|
|
@@ -148,4 +151,4 @@ Update to latest rubygems (v >= 1.3.6) which adds gemcutter sources by default.
|
|
148
151
|
|
149
152
|
== Copyright
|
150
153
|
|
151
|
-
Copyright (c) 2010
|
154
|
+
Copyright (c) 2010-2012 Marine Biological Laboratory. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.17
|
@@ -79,3 +79,9 @@ Feature: Reading of a Darwing Core Archive
|
|
79
79
|
Then I am able to use normalize method without canonical names path
|
80
80
|
And get normalized classification in expected format
|
81
81
|
And there are id paths, no canonical names paths in normalized classification
|
82
|
+
|
83
|
+
Scenario: Normalizing classification skipping extensions data
|
84
|
+
Given path to a dwc file "synonyms_in_extension.tar.gz"
|
85
|
+
When I create a new DarwinCore instance
|
86
|
+
Then I am able to use normalize method without ingesting extensions
|
87
|
+
And extension information is not ingested
|
@@ -253,3 +253,13 @@ Then /^I am able to use normalize method without canonical names path$/ do
|
|
253
253
|
@cn = DarwinCore::ClassificationNormalizer.new(@dwc)
|
254
254
|
@cn.normalize(:with_canonical_names => false)
|
255
255
|
end
|
256
|
+
|
257
|
+
Then /^I am able to use normalize method without ingesting extensions$/ do
|
258
|
+
@cn = DarwinCore::ClassificationNormalizer.new(@dwc)
|
259
|
+
@cn.normalize(:with_extensions => false)
|
260
|
+
end
|
261
|
+
|
262
|
+
Then /^extension information is not ingested$/ do
|
263
|
+
@cn.normalized_data.keys.size.should > 0;
|
264
|
+
@cn.normalized_data.values.select { |d| d.synonyms.size > 0 }.size.should == 0
|
265
|
+
end
|
@@ -46,30 +46,35 @@ class DarwinCore
|
|
46
46
|
@vernacular_name_strings[name_string] = 1 unless @vernacular_name_strings[name_string]
|
47
47
|
end
|
48
48
|
|
49
|
-
def name_strings(opts = {
|
50
|
-
|
49
|
+
def name_strings(opts = {})
|
50
|
+
opts = { with_hash: false }.merge(opts)
|
51
|
+
if !!opts[:with_hash]
|
51
52
|
@name_strings
|
52
53
|
else
|
53
54
|
@name_strings.keys
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
57
|
-
def vernacular_name_strings(opts = {
|
58
|
-
|
58
|
+
def vernacular_name_strings(opts = {})
|
59
|
+
opts = { with_hash: false }.merge(opts)
|
60
|
+
if !!opts[:with_hash]
|
59
61
|
@vernacular_name_strings
|
60
62
|
else
|
61
63
|
@vernacular_name_strings.keys
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
def normalize(opts = {
|
66
|
-
|
67
|
+
def normalize(opts = {})
|
68
|
+
opts = { :with_canonical_names => true, :with_extensions => true }.merge(opts)
|
69
|
+
@with_canonical_names = !!opts[:with_canonical_names]
|
67
70
|
DarwinCore.logger_write(@dwc.object_id, "Started normalization of the classification")
|
68
71
|
ingest_core
|
69
72
|
DarwinCore.logger_write(@dwc.object_id, "Calculating the classification parent/child paths")
|
70
73
|
has_parent_id? ? calculate_classification_path : @normalized_data.keys.each { |id| @tree[id] = {} }
|
71
74
|
DarwinCore.logger_write(@dwc.object_id, "Ingesting data from extensions")
|
72
|
-
|
75
|
+
if !!opts[:with_extensions]
|
76
|
+
ingest_extensions
|
77
|
+
end
|
73
78
|
@normalized_data
|
74
79
|
end
|
75
80
|
|
Binary file
|
@@ -135,6 +135,23 @@ describe DarwinCore do
|
|
135
135
|
norm.select { |k,v| !v.synonyms.empty? }.map { |k,v| v.synonyms }.size.should == 0
|
136
136
|
end
|
137
137
|
|
138
|
+
it "should not attempt to assemble extensions with with_extensions opts set to false" do
|
139
|
+
file = File.join(@file_dir, 'data.tar.gz')
|
140
|
+
dwc = DarwinCore.new(file)
|
141
|
+
cn = DarwinCore::ClassificationNormalizer.new(dwc)
|
142
|
+
norm = cn.normalize(:with_extensions => false)
|
143
|
+
norm.select { |k,v| !v.vernacular_names.empty? }.size.should == 0
|
144
|
+
norm = cn.normalize()
|
145
|
+
norm.select { |k,v| !v.vernacular_names.empty? }.size.should > 0
|
146
|
+
file = File.join(@file_dir, 'synonyms_in_extension.tar.gz')
|
147
|
+
dwc = DarwinCore.new(file)
|
148
|
+
cn = DarwinCore::ClassificationNormalizer.new(dwc)
|
149
|
+
norm = cn.normalize(:with_extensions => false)
|
150
|
+
norm.select { |k,v| !v.synonyms.empty? }.size.should == 0
|
151
|
+
norm = cn.normalize()
|
152
|
+
norm.select { |k,v| !v.synonyms.empty? }.size.should > 0
|
153
|
+
end
|
154
|
+
|
138
155
|
it "should be able to assemble synonyms from core" do
|
139
156
|
file = File.join(@file_dir, 'synonyms_in_core_accepted_name_field.tar.gz')
|
140
157
|
dwc = DarwinCore.new(file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwc-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-02-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70271462144240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.5.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70271462144240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: parsley-store
|
27
|
-
requirement: &
|
27
|
+
requirement: &70271462143620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70271462143620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70271462142960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.7.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70271462142960
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &70271462133960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70271462133960
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70271462133200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '1.0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70271462133200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &70271462132480 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70271462132480
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ruby-debug19
|
82
|
-
requirement: &
|
82
|
+
requirement: &70271462131580 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.11.6
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70271462131580
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: parsley-store
|
93
|
-
requirement: &
|
93
|
+
requirement: &70271462130840 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.3.0
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70271462130840
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rspec
|
104
|
-
requirement: &
|
104
|
+
requirement: &70271462130180 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 1.2.9
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70271462130180
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: cucumber
|
115
|
-
requirement: &
|
115
|
+
requirement: &70271462129460 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70271462129460
|
124
124
|
description: Darwin Core Archive is the current standard exchange format for GLobal
|
125
125
|
Names Architecture modules. This gem makes it easy to incorporate files in Darwin
|
126
126
|
Core Archive format into a ruby project.
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.8.
|
204
|
+
rubygems_version: 1.8.10
|
205
205
|
signing_key:
|
206
206
|
specification_version: 3
|
207
207
|
summary: Handler of Darwin Core Archive files
|