Class: INat::Entity::ProjectObservationRule
- Inherits:
-
Data::Entity
- Object
- Data::Model
- Data::Entity
- INat::Entity::ProjectObservationRule
- Includes:
- INat::Entity
- Defined in:
- lib/inat/data/entity/projectobservationrule.rb
Instance Attribute Summary collapse
-
#operand_id ⇒ type: Integer
The
operand_id
field. -
#operand_type ⇒ type: Symbol
The
operand_type
field. -
#operator ⇒ type: Symbol
The
operator
field. -
#project ⇒ type: Project
The
project
field.
Attributes inherited from Data::Entity
Class Method Summary collapse
Methods inherited from Data::Entity
by_id, #complete?, ddl, fetch, from_db_rows, #get, #init, #initialize, load, load_file, parse, read, #save, #to_db, #update
Methods included from App::Logger::DSL
#debug, debug, echo, #echo, error, #error, #info, info, log, #log, #warning, warning
Methods inherited from Data::Model
api_limit, api_part, api_path, backs, block, field, fields, has_path?, has_table?, #ignore, #initialize, links, #post_update, #process?, #saved?, table, #to_h, #update
Constructor Details
This class inherits a constructor from INat::Data::Entity
Instance Attribute Details
#operand_id ⇒ type: Integer
Returns the operand_id
field.
19 |
# File 'lib/inat/data/entity/projectobservationrule.rb', line 19 field :operand_id, type: Integer, index: true |
#operand_type ⇒ type: Symbol
Returns the operand_type
field.
18 |
# File 'lib/inat/data/entity/projectobservationrule.rb', line 18 field :operand_type, type: Symbol, index: true |
#operator ⇒ type: Symbol
Returns the operator
field.
17 |
# File 'lib/inat/data/entity/projectobservationrule.rb', line 17 field :operator, type: Symbol, index: true, required: true |
Class Method Details
.DDL ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/inat/data/entity/projectobservationrule.rb', line 23 def DDL super + "CREATE VIEW IF NOT EXISTS project_children AS\n" + " SELECT project_id, operand_id as child_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'in_project?' AND operand_type = 'Project';\n" + "CREATE VIEW IF NOT EXISTS project_rule_taxa AS\n" + " SELECT project_id, operand_id as taxon_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'in_taxon?' AND operand_type = 'Taxon';\n" + "CREATE VIEW IF NOT EXISTS project_rule_places AS\n" + " SELECT project_id, operand_id as place_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'observed_in_place?' AND operand_type = 'Place';\n" + "CREATE VIEW IF NOT EXISTS project_rule_excluded_taxa AS\n" + " SELECT project_id, operand_id as taxon_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'not_in_taxon?' AND operand_type = 'Taxon';\n" + "CREATE VIEW IF NOT EXISTS project_rule_excluded_places AS\n" + " SELECT project_id, operand_id as place_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'not_observed_in_place?' AND operand_type = 'Place';\n" end |