Class: ImportAttribute

Inherits:
DataAttribute show all
Defined in:
app/models/import_attribute.rb

Overview

The DataAttribute that has an externally referenced (and likely undefined) predicate.

ImportAttributes are used to attach data to other TW data in cases where the user is unclear as to the meaning of the related data. For example, if a spreadsheet is batch imported it might be that 4 of the 10 columns could be mapped to a concept, say CollectionObject, in TW. The remaining 6 columns do not nicely map. If the user wants to associate the data from those 6 columns she can include them as import attributes. In this case the column header is the @import_predicate.

Use with caution, typically as a means to maintain legacy values on import.

For example:

attribute_subject  import_predicate       value
@some_otu          "times_seen_in_lake"   14

or

attribute_subject  import_predicate       value
@some_specimen     'has_part'            'some_uri'

or

attribute_subject       import_predicate  value
@some_collecting_event  "micro_habitat"   "north side of wet rock"

Instance Attribute Summary (collapse)

Attributes inherited from DataAttribute

#attribute_subject_id, #attribute_subject_type, #controlled_vocabulary_term_id, #project_id, #type, #value

Method Summary

Methods inherited from DataAttribute

#editable?, find_for_autocomplete, #predicate_name

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from ActiverecordUtilities

#trim_attributes

Instance Attribute Details

- (string) import_predicate

The predicate literal. For example a column header.

Returns:

  • (string)


34
35
36
37
# File 'app/models/import_attribute.rb', line 34

class ImportAttribute < DataAttribute
   validates_presence_of :import_predicate
   validates_uniqueness_of :value, scope: [:attribute_subject_id, :attribute_subject_type, :type, :import_predicate, :project_id]
end