# - - - T x n y . _ _ b i n d S u b s p e c i f i c A l t def __bindSubspecificAlt ( self, scan, otherCode, eng, code ): '''Create a subspecific taxon and its binding. [ (scan is a Scan instance) and (otherCode and code are bird codes) and (eng is an English name) -> if otherCode is bound to a species in self.abTab -> self.taxaTree +:= a new subspecies with otherCode's species as its parent, English name (eng), normal status, canon (code), and disamb (None) self.abTab +:= a new StdBind binding (code) to that new subspecies else -> Log() +:= error message(s) raise SyntaxError ] '''
For the logic that locates the species taxon under which this
new subspecies will be added, see Section 17.24, “
Txny.__findSubspParent(): Under what
species does this new subspecies go?”.
#-- 1 -- # [ if otherCode is in self.abTab as a StdBind for a species -> # parent := the Taxon for that species # else -> # Log() +:= error message(s) # raise SyntaxError ] parent = self.__findSubspParent ( scan, otherCode )
The scientific name for a subspecies is the scientific name for the parent species with a space and a child number attached to it. The child number will be left-padded with zeroes to equal that rank's digit count in the taxonomic key.
For example, if Chen caerulescens already has two subspecies, the new one will have scientific name Chen caerulescens 03.
This is a minor change in functionality from version 2.0 of this suite, in which the suffixed numbers were not left-zero-padded. However, this would cause records sorted on this field to be out of order for species with more than 9 subspecific forms.
#-- 2 -- # [ sci := parent.sci + " " + (count of parent's existing # children + 1) ] sspRank = self.hier.lookupRankCode ( SSP_CODE ) sci = "%s %0*d" % (parent.sci, sspRank.keyLen, len(parent)+1)
The procedure for creating a new
and adding it to
self.abTab is similar to that of Section 17.11, “
Txny.__addSpecies(): Add a new species and
its bindings”, except that we use a different
method to find the parent of the new taxon. See Section 23, “
class RawTaxon: Temporary container for
taxon attributes”; Section 18.5, “
TaxaTree.addTaxon()”; and Section 17.12, “
Txny.__addCodes(): Set up symbol table
entries for a standard form”.
#-- 3 -- # [ rawSubsp := a new RawTaxon with rankCode=SSP_CODE, # sci=(sci), eng=(eng), normal status, canon=(code), # and disamb=None ] rawSubsp = RawTaxon ( SSP_CODE, sci, eng, STATUS_NORMAL, code, None ) #-- 4 -- # [ parent := parent with a new Taxon child made from # rawSubsp ] taxon = self.taxaTree.addTaxon ( parent, rawSubsp ) #-- 5 -- # [ if bindings for taxon are consistent with self.abTab -> # self.abTab +:= those bindings # else -> # Log() +:= error message(s) # raise SyntaxError ] self.__addCodes ( scan, taxon )