dwc-archive 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/VERSION +1 -1
- data/lib/dwc-archive/classification_normalizer.rb +11 -3
- data/spec/lib/dwc-archive_spec.rb +1 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1 +1,3 @@
|
|
1
|
+
0.8.1 Linnean classification path is now only for species and infraspecies with canonical forms. It ends with a canonical form of the taxon
|
2
|
+
|
1
3
|
0.8.0 Added linnean classification path to normalized data from DwCA. It consists of data associated with clades like 'kingdom', 'order' etc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
@@ -166,8 +166,8 @@ class DarwinCore
|
|
166
166
|
taxon.status = r[@core_fields[:taxonomicstatus]] if @core_fields[:taxonomicstatus]
|
167
167
|
taxon.source = r[@core_fields[:source]] if @core_fields[:source]
|
168
168
|
taxon.local_id = r[@core_fields[:localid]] if @core_fields[:localid]
|
169
|
-
taxon.linnean_classification_path = get_linnean_classification_path(r)
|
170
169
|
taxon.global_id = r[@core_fields[:globalid]] if @core_fields[:globalid]
|
170
|
+
taxon.linnean_classification_path = get_linnean_classification_path(r, taxon)
|
171
171
|
add_name_string(taxon.current_name)
|
172
172
|
add_name_string(taxon.current_name_canonical) if taxon.current_name_canonical && !taxon.current_name_canonical.empty?
|
173
173
|
end
|
@@ -313,12 +313,20 @@ class DarwinCore
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
end
|
316
|
-
|
317
|
-
|
316
|
+
|
317
|
+
#Collect linnean classification path only on species level
|
318
|
+
def get_linnean_classification_path(row, taxon)
|
318
319
|
res = []
|
319
320
|
[:kingdom, :phylum, :class, :order, :family, :genus, :subgenus].each do |clade|
|
320
321
|
res << [row[@core_fields[clade]], clade] if @core_fields[clade]
|
321
322
|
end
|
323
|
+
if !res.empty?
|
324
|
+
if taxon.current_name_canonical && taxon.current_name_canonical.split(" ").size > 1 && taxon.current_name != res[-1][0]
|
325
|
+
res << [taxon.current_name_canonical, taxon.rank]
|
326
|
+
else
|
327
|
+
res = []
|
328
|
+
end
|
329
|
+
end
|
322
330
|
res
|
323
331
|
end
|
324
332
|
|
@@ -157,7 +157,7 @@ describe DarwinCore do
|
|
157
157
|
dwc = DarwinCore.new(file)
|
158
158
|
cn = DarwinCore::ClassificationNormalizer.new(dwc)
|
159
159
|
norm = cn.normalize
|
160
|
-
cn.normalized_data.first.last.linnean_classification_path.should == [["Animalia", :kingdom], ["Arthropoda", :phylum], ["Insecta", :class], ["Diptera", :order], ["Cecidomyiidae", :family], ["Resseliella", :genus]]
|
160
|
+
cn.normalized_data.first.last.linnean_classification_path.should == [["Animalia", :kingdom], ["Arthropoda", :phylum], ["Insecta", :class], ["Diptera", :order], ["Cecidomyiidae", :family], ["Resseliella", :genus], ["Resseliella theobaldi", "species"]]
|
161
161
|
end
|
162
162
|
|
163
163
|
it "should keep linnean classification empty if terms are not there" do
|