Class: BiologicalAssociation

Inherits:
ApplicationRecord show all
Includes:
Housekeeping, Shared::Citable, Shared::Confidence, Shared::DataAttributes, Shared::IsData, Shared::Notable, SoftValidation
Defined in:
app/models/biological_association.rb

Overview

A biological association biological relationship between two entities one of (CollectionObject, OTU).

Constant Summary

Constant Summary

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Methods included from SoftValidation

#clear_soft_validations, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from ActiverecordUtilities

#trim_attributes

Instance Attribute Details

- (Integer) biological_association_object_id

Returns id of the object

Returns:

  • (Integer)

    id of the object



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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

- (String) biological_association_object_type

Returns type of the object (e.g. CollectionObject)

Returns:

  • (String)

    type of the object (e.g. CollectionObject)



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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

- (Integer) biological_association_subject_id

Returns id of the subject of the relationship

Returns:

  • (Integer)

    id of the subject of the relationship



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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

- (String) biological_association_subject_type

Returns type fo the subject (e.g. Otu)

Returns:

  • (String)

    type fo the subject (e.g. Otu)



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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

- (Integer) biological_relationship_id

the biological relationship ID

Returns:

  • (Integer)


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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

- (Integer) project_id

the project ID

Returns:

  • (Integer)


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
# File 'app/models/biological_association.rb', line 27

class BiologicalAssociation < ApplicationRecord
  include Housekeeping
  include Shared::Citable
  include Shared::IsData
  include SoftValidation
  include Shared::DataAttributes
  include Shared::Notable
  include Shared::Confidence


  belongs_to :biological_relationship, inverse_of: :biological_associations
  belongs_to :biological_association_subject, polymorphic: true
  belongs_to :biological_association_object, polymorphic: true
  has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_association

  validates :biological_relationship, presence: true
  validates :biological_association_subject, presence: true
  validates :biological_association_object, presence: true

  validates_uniqueness_of :biological_association_subject_id, scope: [:biological_association_subject_type, :biological_association_object_id, :biological_association_object_type, :biological_relationship_id]

  def self.find_for_autocomplete(params)
    Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
  end

end

Class Method Details

+ (Object) find_for_autocomplete(params)



48
49
50
# File 'app/models/biological_association.rb', line 48

def self.find_for_autocomplete(params)
  Queries::BiologicalAssociationAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
end