Module: Export::Coldp::Files::TaxonConceptRelation
- Defined in:
- lib/export/coldp/files/taxon_concept_relation.rb
Overview
taxonID relatedTaxonID sourceID type referenceID remarks modified modifiedBy
Constant Summary collapse
- MAP_TYPES =
{ "OtuRelationship::Intersecting" => "intersecting", # TODO: not included in CLB? http://api.checklistbank.org/vocab/TaxonConceptRelType "OtuRelationship::Disjoint" => "excludes", "OtuRelationship::Equal" => "equals", "OtuRelationship::ProperPartInverse" => "includes", "OtuRelationship::ProperPart" => "included in", "OtuRelationship::PartiallyOverlapping" => "overlaps", }
Class Method Summary collapse
Class Method Details
.generate(otus, project_members, reference_csv = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/export/coldp/files/taxon_concept_relation.rb', line 26 def self.generate(otus, project_members, reference_csv = nil ) ::CSV.generate(col_sep: "\t") do |csv| csv << %w{ taxonID relatedTaxonID sourceID type referenceID remarks modified modifiedBy } otus.each do |o| o.otu_relationships.each do |orel| sources = orel.sources.load reference_ids = sources.collect{|a| a.id} reference_id = reference_ids.first csv << [ orel.subject_otu_id, # taxonID orel.object_otu_id, # relatedTaxonID nil, # sourceID type(orel), # type reference_id, # referenceID nil, # remarks Export::Coldp.modified(orel[:updated_at]), # modified Export::Coldp.modified_by(orel[:updated_by_id], project_members) # modified_by ] Export::Coldp::Files::Reference.add_reference_rows(sources, reference_csv, project_members) if reference_csv end end end end |
.type(orel) ⇒ Object
21 22 23 |
# File 'lib/export/coldp/files/taxon_concept_relation.rb', line 21 def self.type(orel) MAP_TYPES[orel.type] end |