Class: Queries::ObservationMatrixRow::Filter

Inherits:
Query::Filter show all
Defined in:
lib/queries/observation_matrix_row/filter.rb

Constant Summary collapse

PARAMS =
[
  :observation_object_type,
  :observation_object_id,
  :observation_matrix_id,
  :observation_matrix_row_id,
  observation_matrix_row_id: []
].freeze

Constants inherited from Query::Filter

Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES

Instance Attribute Summary collapse

Attributes inherited from Query::Filter

#anatomical_part_query, #api, #asserted_distribution_query, #asserted_environment_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_query, #conveyance_query, #data_attribute_query, #depiction_query, #descriptor_query, #document_query, #dwc_occurrence_query, #extract_query, #field_occurrence_query, #image_query, #loan_query, #object_global_id, #observation_query, #order_by, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #recent_target, #roll_call, #sound_query, #taxon_name_query, #taxon_name_relationship_query, #venn, #venn_ignore_pagination, #venn_mode

Attributes inherited from Query

#query_string, #terms

Instance Method Summary collapse

Methods inherited from Query::Filter

#all, #all_and_clauses, #all_merge_clauses, #annotator_and_clauses, #annotator_merge_clauses, annotator_params, api_except_params, api_excluded_params, #apply_venn, #attribute_exact_facet, base_filter, base_query_name, base_query_to_h, #deep_permit, #disable_paging, included_annotator_facets, instantiated_base_filter, inverted_subqueries, #merge_clauses, #model_id_facet, #object_global_id_facet, #only_project?, #only_project_or_less?, #paging_state, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #raise_multiple_nested_queries, #raise_unregistered_nested_query, #set_nested_queries, #set_paging, set_paging, #shared_and_clauses, #subquery_vector, #target_and_clauses, #venn_query

Methods inherited from Query

#alphabetic_strings, #alphanumeric_strings, base_name, #base_name, #base_query, #build_terms, #cached_facet, #end_wildcard, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #no_terms?, referenced_klass, #referenced_klass, #referenced_klass_except, #referenced_klass_intersection, #referenced_klass_union, #start_and_end_wildcard, #start_wildcard, #table, #wildcard_pieces

Constructor Details

#initialize(query_params) ⇒ Filter

Returns a new instance of Filter.



21
22
23
24
25
26
27
28
# File 'lib/queries/observation_matrix_row/filter.rb', line 21

def initialize(query_params)
  super
  @observation_object_type = params[:observation_object_type]
  @observation_object_id = params[:observation_object_id]
  @observation_object_id_vector = params[:observation_object_id_vector]
  @observation_matrix_id = params[:observation_matrix_id]
  @observation_matrix_row_id = params[:observation_matrix_row_id]
end

Instance Attribute Details

#observation_matrix_id ⇒ Object

Returns the value of attribute observation_matrix_id.



15
16
17
# File 'lib/queries/observation_matrix_row/filter.rb', line 15

def observation_matrix_id
  @observation_matrix_id
end

#observation_object_id ⇒ Object

Returns the value of attribute observation_object_id.



14
15
16
# File 'lib/queries/observation_matrix_row/filter.rb', line 14

def observation_object_id
  @observation_object_id
end

#observation_object_id_vector ⇒ Object (readonly)

Parameters:

  • observation_object_id_vector (String, nil) —

    a vector of ids in the format 123|456|790|



19
20
21
# File 'lib/queries/observation_matrix_row/filter.rb', line 19

def observation_object_id_vector
  @observation_object_id_vector
end

#observation_object_type ⇒ Object

Returns the value of attribute observation_object_type.



13
14
15
# File 'lib/queries/observation_matrix_row/filter.rb', line 13

def observation_object_type
  @observation_object_type
end

Instance Method Details

#and_clauses ⇒ Object



43
44
45
46
47
48
49
# File 'lib/queries/observation_matrix_row/filter.rb', line 43

def and_clauses
  [
    matching_observation_matrix_id,
    matching_observation_object_id,
    matching_observation_object_type,
  ]
end

#matching_observation_matrix_id ⇒ Object



51
52
53
# File 'lib/queries/observation_matrix_row/filter.rb', line 51

def matching_observation_matrix_id
  observation_matrix_id.empty? ? nil : table[:observation_matrix_id].in(observation_matrix_id)
end

#matching_observation_object_id ⇒ Object



55
56
57
# File 'lib/queries/observation_matrix_row/filter.rb', line 55

def matching_observation_object_id
  observation_object_id.empty? ? nil : table[:observation_object_id].in(observation_object_id)
end

#matching_observation_object_type ⇒ Object



59
60
61
# File 'lib/queries/observation_matrix_row/filter.rb', line 59

def matching_observation_object_type
  observation_object_type.blank? ? nil : table[:observation_object_type].eq(observation_object_type)
end

#observation_matrix_row_id ⇒ Object



30
31
32
# File 'lib/queries/observation_matrix_row/filter.rb', line 30

def observation_matrix_row_id
  [@observation_matrix_row_id].flatten.compact
end