specify_cli 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +117 -0
- data/LICENSE.txt +21 -0
- data/README.rdoc +43 -0
- data/Rakefile +15 -0
- data/bin/specify_cli +248 -0
- data/lib/specify.rb +45 -0
- data/lib/specify/branch_parser.rb +85 -0
- data/lib/specify/cli.rb +11 -0
- data/lib/specify/cli/database_setup.rb +46 -0
- data/lib/specify/cli/stubs.rb +63 -0
- data/lib/specify/cli/viewset.rb +21 -0
- data/lib/specify/configuration.rb +12 -0
- data/lib/specify/configuration/config.rb +120 -0
- data/lib/specify/configuration/db_config.rb +162 -0
- data/lib/specify/configuration/host_config.rb +37 -0
- data/lib/specify/database.rb +140 -0
- data/lib/specify/models.rb +43 -0
- data/lib/specify/models/accession.rb +33 -0
- data/lib/specify/models/agent.rb +138 -0
- data/lib/specify/models/app_resource_data.rb +32 -0
- data/lib/specify/models/app_resource_dir.rb +43 -0
- data/lib/specify/models/auto_numbering_scheme.rb +94 -0
- data/lib/specify/models/collecting_event.rb +38 -0
- data/lib/specify/models/collection.rb +67 -0
- data/lib/specify/models/collection_object.rb +127 -0
- data/lib/specify/models/createable.rb +21 -0
- data/lib/specify/models/determination.rb +63 -0
- data/lib/specify/models/discipline.rb +61 -0
- data/lib/specify/models/division.rb +26 -0
- data/lib/specify/models/geography.rb +5 -0
- data/lib/specify/models/geography/administrative_division.rb +32 -0
- data/lib/specify/models/geography/geographic_name.rb +66 -0
- data/lib/specify/models/geography/geography.rb +23 -0
- data/lib/specify/models/institution.rb +13 -0
- data/lib/specify/models/locality.rb +50 -0
- data/lib/specify/models/preparation.rb +53 -0
- data/lib/specify/models/preparation_type.rb +30 -0
- data/lib/specify/models/record_set.rb +55 -0
- data/lib/specify/models/record_set_item.rb +29 -0
- data/lib/specify/models/taxonomy.rb +6 -0
- data/lib/specify/models/taxonomy/common_name.rb +14 -0
- data/lib/specify/models/taxonomy/rank.rb +31 -0
- data/lib/specify/models/taxonomy/taxon.rb +54 -0
- data/lib/specify/models/taxonomy/taxonomy.rb +21 -0
- data/lib/specify/models/tree_queryable.rb +55 -0
- data/lib/specify/models/updateable.rb +20 -0
- data/lib/specify/models/user.rb +104 -0
- data/lib/specify/models/view_set_object.rb +32 -0
- data/lib/specify/number_format.rb +60 -0
- data/lib/specify/services.rb +18 -0
- data/lib/specify/services/service.rb +51 -0
- data/lib/specify/services/stub_generator.rb +291 -0
- data/lib/specify/services/view_loader.rb +177 -0
- data/lib/specify/session.rb +77 -0
- data/lib/specify/user_type.rb +61 -0
- data/lib/specify/version.rb +19 -0
- data/man/specify_cli-database.1 +60 -0
- data/man/specify_cli-database.1.html +137 -0
- data/man/specify_cli-database.1.ronn +53 -0
- data/man/specify_cli-repository.1 +55 -0
- data/man/specify_cli-repository.1.html +128 -0
- data/man/specify_cli-repository.1.ronn +42 -0
- data/man/specify_cli-stubs.1 +177 -0
- data/man/specify_cli-stubs.1.html +239 -0
- data/man/specify_cli-stubs.1.ronn +147 -0
- data/man/specify_cli-viewset.1 +92 -0
- data/man/specify_cli-viewset.1.html +154 -0
- data/man/specify_cli-viewset.1.ronn +72 -0
- data/man/specify_cli.1 +213 -0
- data/man/specify_cli.1.html +252 -0
- data/man/specify_cli.1.ronn +157 -0
- data/spec/branch_parser_spec.rb +94 -0
- data/spec/cli/stubs_spec.rb +44 -0
- data/spec/configuration/config_spec.rb +269 -0
- data/spec/configuration/db_config_spec.rb +299 -0
- data/spec/configuration/host_config_spec.rb +64 -0
- data/spec/database_spec.rb +83 -0
- data/spec/examples.txt +217 -0
- data/spec/helpers.rb +15 -0
- data/spec/models/app_resource_data_spec.rb +38 -0
- data/spec/models/app_resource_dir_spec.rb +8 -0
- data/spec/models/auto_numbering_scheme_spec.rb +78 -0
- data/spec/models/collection_object_spec.rb +92 -0
- data/spec/models/collection_spec.rb +32 -0
- data/spec/models/discipline_spec.rb +31 -0
- data/spec/models/record_set_spec.rb +18 -0
- data/spec/models/user_spec.rb +182 -0
- data/spec/models/view_set_object_spec.rb +70 -0
- data/spec/number_format_spec.rb +43 -0
- data/spec/services/stub_generator_spec.rb +635 -0
- data/spec/services/view_loader_spec.rb +436 -0
- data/spec/session_spec.rb +105 -0
- data/spec/spec_helper.rb +116 -0
- data/spec/support/db.yml +12 -0
- data/spec/support/stub.yaml +17 -0
- data/spec/support/stub_locality.yaml +19 -0
- data/spec/support/viewsets/paleo.views.xml +30 -0
- data/spec/support/viewsets/paleo.xml +30 -0
- data/spec/user_type_spec.rb +79 -0
- data/specify_cli.gemspec +27 -0
- data/specify_cli.rdoc +1 -0
- metadata +246 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Divisions are the next highest level of scope within a Specify::Database.
|
6
|
+
#
|
7
|
+
# A Division belongs to the single instance of Specify::Model::Institution
|
8
|
+
# within a Specify::Database.
|
9
|
+
#
|
10
|
+
# A Division has one or more instances of Specify::Model::Discipline.
|
11
|
+
#
|
12
|
+
# Specify::Model::Agent instances are scoped to the Division level.
|
13
|
+
class Division < Sequel::Model(:division)
|
14
|
+
include Updateable
|
15
|
+
|
16
|
+
many_to_one :institution,
|
17
|
+
key: :InstitutionID
|
18
|
+
many_to_many :auto_numbering_schemes,
|
19
|
+
left_key: :DivisionID,
|
20
|
+
right_key: :AutoNumberingSchemeID,
|
21
|
+
join_table: :autonumsch_div
|
22
|
+
one_to_many :accessions,
|
23
|
+
key: :DivisionID
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# AdministrativeDivision is the _rank_ class for the
|
6
|
+
# Specify::Model::Geography _tree_. An AdministrativeDivision holds
|
7
|
+
# information about a formal political subdivison in a <em>geographic
|
8
|
+
# tree</em>.
|
9
|
+
#
|
10
|
+
# A AdministrativeDivision has a _parent_ (another instance of
|
11
|
+
# AdministrativeDivision) unless it is the root rank of the _tree_ and can
|
12
|
+
# have one _child_ (another instance of AdministrativeDivision).
|
13
|
+
class AdministrativeDivision < Sequel::Model(:geographytreedefitem)
|
14
|
+
include Updateable
|
15
|
+
|
16
|
+
many_to_one :geography,
|
17
|
+
key: :GeographyTreeDefID
|
18
|
+
one_to_many :geographic_names,
|
19
|
+
key: :GeographyTreeDefItemID
|
20
|
+
one_to_one :child,
|
21
|
+
class: self,
|
22
|
+
key: :ParentItemID
|
23
|
+
many_to_one :parent, class: self,
|
24
|
+
key: :ParentItemID
|
25
|
+
|
26
|
+
# Returns a String with the name of the formal political subdivision.
|
27
|
+
def name
|
28
|
+
self.Name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# GeographicName is the _item_ class for the Specify::Model::Geography
|
6
|
+
# _tree_. A GeographicName holds information about the items to be
|
7
|
+
# classified, i.e. concepts of geographic names. Each GeographicName belongs
|
8
|
+
# to a Specify::Model::AdministrativeDivision, that represents the formal
|
9
|
+
# political subdivision in a geography.
|
10
|
+
#
|
11
|
+
# A GeographicName has a _parent_ (another instance of GeographicName)
|
12
|
+
# unless it is the root geographic name of the _tree_ and can have
|
13
|
+
# _children_ (other instances of GeographicName).
|
14
|
+
class GeographicName < Sequel::Model(:geography)
|
15
|
+
include Updateable
|
16
|
+
|
17
|
+
many_to_one :geography,
|
18
|
+
key: :GeographyTreeDefID
|
19
|
+
many_to_one :rank,
|
20
|
+
class: 'Specify::Model::AdministrativeDivision',
|
21
|
+
key: :GeographyTreeDefItemID
|
22
|
+
many_to_one :parent,
|
23
|
+
class: self,
|
24
|
+
key: :ParentID
|
25
|
+
many_to_one :accepted_name,
|
26
|
+
class: self,
|
27
|
+
key: :AcceptedID
|
28
|
+
one_to_many :children,
|
29
|
+
class: self,
|
30
|
+
key: :ParentID
|
31
|
+
one_to_many :synonyms,
|
32
|
+
class: self,
|
33
|
+
key: :AcceptedID
|
34
|
+
one_to_many :localities,
|
35
|
+
key: :GeographyID
|
36
|
+
|
37
|
+
# Assigns new instances that are created from a
|
38
|
+
# Specify::Model::AdministrativeDivision to the administrative division's
|
39
|
+
# Specify::Model::Geography. Sets _Version_, timestamp for
|
40
|
+
# creation, and a GUID for the record.
|
41
|
+
def before_create
|
42
|
+
self.geography = rank&.geography ||
|
43
|
+
parent.rank&.geography
|
44
|
+
self[:Version] = 0
|
45
|
+
self[:TimestampCreated] = Time.now
|
46
|
+
self[:GUID] = SecureRandom.uuid
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns +true+ if +self+ has _children_.
|
51
|
+
def children?
|
52
|
+
!children.empty?
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates a string representation of +self+.
|
56
|
+
def inspect
|
57
|
+
"id: #{self.GeographyID}; Full Name: '#{self.FullName}'"
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns a String with the geographic name.
|
61
|
+
def name
|
62
|
+
self[:Name]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Geography is the _tree_ class for the <em>geographic tree</em>.
|
6
|
+
# Geographies hold all Specify::Model::AdministrativeDivision and
|
7
|
+
# Specify::Model::GeographicName instances belonging to a geography used by
|
8
|
+
# a Specify::Model::Discipline.
|
9
|
+
class Geography < Sequel::Model(:geographytreedef)
|
10
|
+
include TreeQueryable
|
11
|
+
include Updateable
|
12
|
+
|
13
|
+
one_to_many :disciplines,
|
14
|
+
key: :GeographyTreeDefID
|
15
|
+
one_to_many :ranks,
|
16
|
+
class: 'Specify::Model::AdministrativeDivision',
|
17
|
+
key: :GeographyTreeDefID
|
18
|
+
one_to_many :names,
|
19
|
+
class: 'Specify::Model::GeographicName',
|
20
|
+
key: :GeographyTreeDefID
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Institution is the highest level of scope within a Specify::Database.
|
6
|
+
#
|
7
|
+
# A Specify::Database has a single instance of Institution. The Institution
|
8
|
+
# has one or more instances of Specify::Model::Division.
|
9
|
+
class Institution < Sequel::Model(:institution)
|
10
|
+
include Updateable
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Localities are places where something has been collected.
|
6
|
+
#
|
7
|
+
# A Locality can belong to a Specify::Model::GeographicName, and is
|
8
|
+
# required to join a Specify::Model::CollectingEvent to a
|
9
|
+
# Specify::Model::GeographicName.
|
10
|
+
class Locality < Sequel::Model(:locality)
|
11
|
+
include Createable
|
12
|
+
include Updateable
|
13
|
+
|
14
|
+
many_to_one :discipline,
|
15
|
+
key: :DisciplineID
|
16
|
+
many_to_one :geographic_name,
|
17
|
+
key: :GeographyID
|
18
|
+
many_to_one :created_by,
|
19
|
+
class: 'Specify::Model::Agent',
|
20
|
+
key: :CreatedByAgentID
|
21
|
+
many_to_one :modified_by,
|
22
|
+
class: 'Specify::Model::Agent',
|
23
|
+
key: :ModifiedByAgentID
|
24
|
+
|
25
|
+
# Sequel hook that assigns a GUID and sets the #coordinate_notation
|
26
|
+
# to +3+.
|
27
|
+
def before_create
|
28
|
+
self[:GUID] = SecureRandom.uuid
|
29
|
+
self[:SrcLatLongUnit] = 3
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a string representation of +self+.
|
34
|
+
def inspect
|
35
|
+
geo = geographic_name ? "(#{geographic_name.FullName})" : ''
|
36
|
+
"id: #{self.LocalityID.to_s}, #{self.LocalityName} #{geo}"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns an Integer in the range 0-3 that designates the format in which
|
40
|
+
# latidtudes and longitudes are stored:
|
41
|
+
# [0] Decimal degrees
|
42
|
+
# [1] Degrees, minutes, and decimal seconds
|
43
|
+
# [2] Degrees and decimal minutes
|
44
|
+
# [3] None
|
45
|
+
def coordinate_notation
|
46
|
+
self[:SrcLatLongUnit]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Preparations are the physical (or virtual) represenatations of a
|
6
|
+
# Specify::Model::CollectionObject in a Speciy::Model::Collection.
|
7
|
+
#
|
8
|
+
# Collection objects represent the organisms or artifacts collected, the
|
9
|
+
# preparations are items derived from that organism or artifacts which are
|
10
|
+
# the actual units in a collections physical storage. In an ornithological
|
11
|
+
# collection, for example, the collection object will be the bird collected,
|
12
|
+
# preparations will be the skin, the skeleton, or any other physcial (or
|
13
|
+
# virtual derivatives).
|
14
|
+
#
|
15
|
+
# A preparation belongs to a Specify::Model::PreparationType, that
|
16
|
+
# provides a controlled vocabulary for available types of preparations (e.g.
|
17
|
+
# skin, skeletons, EtOH).
|
18
|
+
#
|
19
|
+
# A preparation has a #count, that is the number of items in a preparation.
|
20
|
+
# If, for example, the preparation is a jar of shrimps in ethanol, the
|
21
|
+
# preparation_type could be `EtOH`, and if there are 10 shrimps in the jar,
|
22
|
+
# the #count would be +10+.
|
23
|
+
class Preparation < Sequel::Model(:preparation)
|
24
|
+
include Createable
|
25
|
+
include Updateable
|
26
|
+
|
27
|
+
many_to_one :collection_object,
|
28
|
+
key: :CollectionObjectID
|
29
|
+
many_to_one :collection,
|
30
|
+
class: 'Specify::Model::Collection',
|
31
|
+
key: :CollectionMemberID
|
32
|
+
many_to_one :preparation_type,
|
33
|
+
key: :PrepTypeID
|
34
|
+
many_to_one :created_by,
|
35
|
+
class: 'Specify::Model::Agent',
|
36
|
+
key: :CreatedByAgentID
|
37
|
+
many_to_one :modified_by,
|
38
|
+
class: 'Specify::Model::Agent',
|
39
|
+
key: :ModifiedByAgentID
|
40
|
+
|
41
|
+
# Sequel hook that assigns a GUID.
|
42
|
+
def before_create
|
43
|
+
self[:GUID] = SecureRandom.uuid
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns the number of items in a preparation.
|
48
|
+
def count
|
49
|
+
self.CountAmt
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# PreparationTypes, are categopries of Specify::Model::Preparation.
|
6
|
+
# A PreparationType providess a controlled vocabulary for available types of
|
7
|
+
# preparations, where the element in the controlled vocabulary is the #name.
|
8
|
+
class PreparationType < Sequel::Model(:preptype)
|
9
|
+
include Createable
|
10
|
+
include Updateable
|
11
|
+
|
12
|
+
many_to_one :collection,
|
13
|
+
key: :CollectionID
|
14
|
+
one_to_many :preparations,
|
15
|
+
key: :PrepTypeID
|
16
|
+
many_to_one :created_by,
|
17
|
+
class: 'Specify::Model::Agent',
|
18
|
+
key: :CreatedByAgentID
|
19
|
+
many_to_one :modified_by,
|
20
|
+
class: 'Specify::Model::Agent',
|
21
|
+
key: :ModifiedByAgentID
|
22
|
+
|
23
|
+
# Returns a String with the name of +self+ (a short name that is an
|
24
|
+
# element of a controlled vocabulary).
|
25
|
+
def name
|
26
|
+
self[:Name]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# RecordSets are groups of records of certain classes in the Specify::Model,
|
6
|
+
# for example Specify::Model::CollectionObject (currently the only supported
|
7
|
+
# class for record sets).
|
8
|
+
#
|
9
|
+
# A RecordSet ontains Specify::Model::RecordSetItem instances. The items are
|
10
|
+
# ordered in the RecordSet, and the order is determined bu the
|
11
|
+
# Specify::Model::RecordSetItem#order_number.
|
12
|
+
class RecordSet < Sequel::Model(:recordset)
|
13
|
+
include Createable
|
14
|
+
include Updateable
|
15
|
+
|
16
|
+
many_to_one :user,
|
17
|
+
key: :SpecifyUserID
|
18
|
+
many_to_one :collection,
|
19
|
+
class: 'Specify::Model::Collection',
|
20
|
+
key: :CollectionMemberID
|
21
|
+
one_to_many :record_set_items,
|
22
|
+
key: :RecordSetID
|
23
|
+
many_to_many :collection_objects,
|
24
|
+
left_key: :RecordSetID,
|
25
|
+
right_key: :RecordId,
|
26
|
+
join_table: :recordsetitem
|
27
|
+
many_to_one :created_by,
|
28
|
+
class: 'Specify::Model::Agent',
|
29
|
+
key: :CreatedByAgentID
|
30
|
+
many_to_one :modified_by,
|
31
|
+
class: 'Specify::Model::Agent',
|
32
|
+
key: :ModifiedByAgentID
|
33
|
+
|
34
|
+
# Sequel hook that sets the _TableID_ that determines the kind of record
|
35
|
+
# set (currently, only record sets of Specify::Model::CollectionObject
|
36
|
+
# instances are supported - _TableID_ = +1+). Also sets the _Type_.
|
37
|
+
def before_create
|
38
|
+
self[:TableID] = 1
|
39
|
+
self[:Type] = 0 # FIXME: guess
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns the highest order number of items in +self+.
|
44
|
+
def highest_order_number
|
45
|
+
record_set_items_dataset.max(:OrderNumber)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns the order number for the next item added to +self+
|
49
|
+
def next_order_number
|
50
|
+
return 0 unless highest_order_number
|
51
|
+
highest_order_number + 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# RecordSetItems are orderd items in a Specify::Model::RecordSet.
|
6
|
+
#
|
7
|
+
# A RecordSetItem represents instances of Specify::Model classes that are
|
8
|
+
# contained in a Specify::Model::RecordSet. The only class currently
|
9
|
+
# supported is Specify::Model::CollectionObject.
|
10
|
+
class RecordSetItem < Sequel::Model(:recordsetitem)
|
11
|
+
many_to_one :record_set,
|
12
|
+
key: :RecordSetID
|
13
|
+
many_to_one :collection_object,
|
14
|
+
key: :RecordId
|
15
|
+
|
16
|
+
# Sequel hook that sets #order_number for newly created records.
|
17
|
+
def before_create
|
18
|
+
self[:OrderNumber] = record_set.next_order_number
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the index (an Integer) that marks the position of +self+ in a
|
23
|
+
# Specify::Model::RecordSet.
|
24
|
+
def order_number
|
25
|
+
self[:OrderNumber]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# CommonNames are vernacular names for a Specify::Model::Taxon.
|
6
|
+
class CommonName < Sequel::Model(:commonnametx)
|
7
|
+
include Createable
|
8
|
+
include Updateable
|
9
|
+
|
10
|
+
many_to_one :taxon,
|
11
|
+
key: :TaxonID
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Specify
|
4
|
+
module Model
|
5
|
+
# Rank is the _rank_ class for the Specify::Model::Taxonomy _tree_. A
|
6
|
+
# Rank holds information about a formal Linnean classification rank in
|
7
|
+
# a <em>taxonomic tree</em>.
|
8
|
+
#
|
9
|
+
# A Rank has a _parent_ (another instance of Rank) unless it is the root
|
10
|
+
# rank of the _tree_ and can have one _child_ (another instance of Rank).
|
11
|
+
class Rank < Sequel::Model(:taxontreedefitem)
|
12
|
+
include Updateable
|
13
|
+
|
14
|
+
many_to_one :taxonomy,
|
15
|
+
key: :TaxonTreeDefID
|
16
|
+
one_to_many :taxa,
|
17
|
+
key: :TaxonTreeDefItemID
|
18
|
+
one_to_one :child,
|
19
|
+
class: self,
|
20
|
+
key: :ParentItemID
|
21
|
+
many_to_one :parent, class: self,
|
22
|
+
key: :ParentItemID
|
23
|
+
|
24
|
+
# Returns a String with the name of the formal Linnean classification
|
25
|
+
# rank.
|
26
|
+
def name
|
27
|
+
self[:Name]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|