Module: BiologicalAssociation::DwcExtensions

Extended by:
ActiveSupport::Concern
Included in:
BiologicalAssociation
Defined in:
app/models/biological_association/dwc_extensions.rb

Instance Method Summary collapse

Instance Method Details

#darwin_core_extension_row(inverted: false) ⇒ Object

Don’t use dwc_



23
24
25
# File 'app/models/biological_association/dwc_extensions.rb', line 23

def darwin_core_extension_row(inverted: false)
  Export::CSV::Dwc::Extension::BiologicalAssociations::HEADERS.collect{|h| send(DWC_EXTENSION_MAP[h.to_sym], inverted)}
end


84
85
86
87
# File 'app/models/biological_association/dwc_extensions.rb', line 84

def dwc_related_resource(inverted = false)
  index = biological_association_index
  inverted ? index.subject_label : index.object_label
end


75
76
77
78
79
80
81
82
# File 'app/models/biological_association/dwc_extensions.rb', line 75

def dwc_related_resource_id(inverted = false)
  index = biological_association_index
  if inverted
    index.subject_uuid || index.subject_id
  else
    index.object_uuid || index.object_id
  end
end

#dwc_relationship_according_to(inverted = false) ⇒ Object



89
90
91
92
# File 'app/models/biological_association/dwc_extensions.rb', line 89

def dwc_relationship_according_to(inverted = false)
  index = biological_association_index
  index.citations
end

#dwc_relationship_established_date(inverted = false) ⇒ Object



94
95
96
97
# File 'app/models/biological_association/dwc_extensions.rb', line 94

def dwc_relationship_established_date(inverted = false)
  index = biological_association_index
  index.established_date
end

#dwc_relationship_of_resource(inverted = false) ⇒ Object



70
71
72
73
# File 'app/models/biological_association/dwc_extensions.rb', line 70

def dwc_relationship_of_resource(inverted = false)
  index = biological_association_index
  inverted ? index.relationship_inverted_name : index.relationship_name
end

#dwc_relationship_of_resource_id(inverted = false) ⇒ Object



63
64
65
66
67
68
# File 'app/models/biological_association/dwc_extensions.rb', line 63

def dwc_relationship_of_resource_id(inverted = false)
  index = biological_association_index
  s = index.biological_relationship_uri || index.biological_relationship_id

  inverted ? "#{s} inverted" : s
end

#dwc_relationship_remarks(inverted = false) ⇒ Object



99
100
101
102
# File 'app/models/biological_association/dwc_extensions.rb', line 99

def dwc_relationship_remarks(inverted = false)
  index = biological_association_index
  index.remarks
end

#dwc_resource(inverted = false) ⇒ Object



58
59
60
61
# File 'app/models/biological_association/dwc_extensions.rb', line 58

def dwc_resource(inverted = false)
  index = biological_association_index
  inverted ? index.object_label : index.subject_label
end

#dwc_resource_id(inverted = false) ⇒ Object



49
50
51
52
53
54
55
56
# File 'app/models/biological_association/dwc_extensions.rb', line 49

def dwc_resource_id(inverted = false)
  index = biological_association_index
  if inverted
    index.object_uuid || index.object_id
  else
    index.subject_uuid || index.subject_id
  end
end

#dwc_resource_relationship_coreid(inverted = false) ⇒ Object



38
39
40
41
42
# File 'app/models/biological_association/dwc_extensions.rb', line 38

def dwc_resource_relationship_coreid(inverted = false)
  # Note that this could be either subject or object of the original
  # association, which is a good thing.
  dwc_resource_id(inverted)
end

#dwc_resource_relationship_id(inverted = false) ⇒ Object



44
45
46
47
# File 'app/models/biological_association/dwc_extensions.rb', line 44

def dwc_resource_relationship_id(inverted = false)
  index = biological_association_index
  index.biological_association_uuid
end

#globi_extension_jsonObject

Don’t use dwc_



28
29
30
31
32
33
34
35
36
# File 'app/models/biological_association/dwc_extensions.rb', line 28

def globi_extension_json
  r = {}
   Export::CSV::Dwc::Extension::BiologicalAssociations::HEADERS.each do |h|
    if m = DWC_EXTENSION_MAP[h.to_sym]
      r[h] = send(m, false)
    end
  end
  r
end