Class: Queries::TaxonDetermination::Filter
- Inherits:
-
Query::Filter
- Object
- Query
- Query::Filter
- Queries::TaxonDetermination::Filter
- Defined in:
- lib/queries/taxon_determination/filter.rb
Constant Summary collapse
- PARAMS =
[ :collection_object_id, :otu_id, :taxon_determination_id, taxon_determination_object_type: [], taxon_determination_object_id: [], collection_object_id: [], determiner_id: [], otu_id: [], taxon_determination_id: [], ].freeze
Constants inherited from Query::Filter
Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES
Instance Attribute Summary collapse
-
#collection_object_id ⇒ Object
Returns the value of attribute collection_object_id.
-
#determiner_id ⇒ Object
Returns the value of attribute determiner_id.
-
#otu_id ⇒ Object
Returns the value of attribute otu_id.
-
#taxon_determination_id ⇒ Object
all Arrays.
-
#taxon_determination_object_id ⇒ Object
Returns the value of attribute taxon_determination_object_id.
-
#taxon_determination_object_type ⇒ Object
Returns the value of attribute taxon_determination_object_type.
Attributes inherited from Query::Filter
#api, #asserted_distribution_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_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, #taxon_name_query, #venn, #venn_mode
Attributes inherited from Query
Instance Method Summary collapse
- #and_clauses ⇒ Object
- #collection_object_id_facet ⇒ Object
- #determiner_id_facet ⇒ Object
-
#initialize(query_params = {}) ⇒ Filter
constructor
A new instance of Filter.
- #merge_clauses ⇒ Object
- #otu_id_facet ⇒ Object
- #roles_table ⇒ Arel::Table
- #taxon_determination_object_id_facet ⇒ Object
- #taxon_determination_object_type_facet ⇒ Object
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, included_annotator_facets, instantiated_base_filter, inverted_subqueries, #model_id_facet, #object_global_id_facet, #only_project?, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #query_name, #set_nested_queries, #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.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/queries/taxon_determination/filter.rb', line 26 def initialize(query_params = {}) super @collection_object_id = params[:collection_object_id] @determiner_id = params[:determiner_id] @otu_id = params[:otu_id] @taxon_determination_id = params[:taxon_determination_id] @taxon_determination_object_id = params[:taxon_determination_object_id] @taxon_determination_object_type = params[:taxon_determination_object_type] end |
Instance Attribute Details
#collection_object_id ⇒ Object
Returns the value of attribute collection_object_id.
20 21 22 |
# File 'lib/queries/taxon_determination/filter.rb', line 20 def collection_object_id @collection_object_id end |
#determiner_id ⇒ Object
Returns the value of attribute determiner_id.
22 23 24 |
# File 'lib/queries/taxon_determination/filter.rb', line 22 def determiner_id @determiner_id end |
#otu_id ⇒ Object
Returns the value of attribute otu_id.
21 22 23 |
# File 'lib/queries/taxon_determination/filter.rb', line 21 def otu_id @otu_id end |
#taxon_determination_id ⇒ Object
all Arrays
19 20 21 |
# File 'lib/queries/taxon_determination/filter.rb', line 19 def taxon_determination_id @taxon_determination_id end |
#taxon_determination_object_id ⇒ Object
Returns the value of attribute taxon_determination_object_id.
24 25 26 |
# File 'lib/queries/taxon_determination/filter.rb', line 24 def taxon_determination_object_id @taxon_determination_object_id end |
#taxon_determination_object_type ⇒ Object
Returns the value of attribute taxon_determination_object_type.
23 24 25 |
# File 'lib/queries/taxon_determination/filter.rb', line 23 def taxon_determination_object_type @taxon_determination_object_type end |
Instance Method Details
#and_clauses ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/queries/taxon_determination/filter.rb', line 100 def and_clauses [ otu_id_facet, collection_object_id_facet, taxon_determination_object_id_facet, taxon_determination_object_type_facet ] end |
#collection_object_id_facet ⇒ Object
66 67 68 69 70 |
# File 'lib/queries/taxon_determination/filter.rb', line 66 def collection_object_id_facet return nil if collection_object_id.empty? table[:taxon_determination_object_id].in(collection_object_id) .and(table[:taxon_determination_object_type].eq('CollectionObject')) end |
#determiner_id_facet ⇒ Object
82 83 84 85 86 87 |
# File 'lib/queries/taxon_determination/filter.rb', line 82 def determiner_id_facet return nil if determiner_id.empty? ::TaxonDetermination.joins(:determiner_roles).where( roles: {person_id: determiner_id} ) end |
#merge_clauses ⇒ Object
94 95 96 97 98 |
# File 'lib/queries/taxon_determination/filter.rb', line 94 def merge_clauses [ determiner_id_facet ] end |
#otu_id_facet ⇒ Object
61 62 63 64 |
# File 'lib/queries/taxon_determination/filter.rb', line 61 def otu_id_facet return nil if otu_id.empty? table[:otu_id].in(otu_id) end |
#roles_table ⇒ Arel::Table
90 91 92 |
# File 'lib/queries/taxon_determination/filter.rb', line 90 def roles_table ::Role.arel_table end |
#taxon_determination_object_id_facet ⇒ Object
77 78 79 80 |
# File 'lib/queries/taxon_determination/filter.rb', line 77 def taxon_determination_object_id_facet return nil if taxon_determination_object_id.empty? table[:taxon_determination_object_id].in(taxon_determination_object_id) end |
#taxon_determination_object_type_facet ⇒ Object
72 73 74 75 |
# File 'lib/queries/taxon_determination/filter.rb', line 72 def taxon_determination_object_type_facet return nil if taxon_determination_object_type.empty? table[:taxon_determination_object_type].in(taxon_determination_object_type) end |