Ghini / ghini.pocket

Android field data input system
GNU General Public License v3.0
3 stars 3 forks source link

link genera to closest-by super taxon #21

Open mfrasca opened 6 years ago

mfrasca commented 6 years ago

at the moment most genera are linked to families, even if families have subfamilies and tribes (no subtribe information yet, see #20). we should be linking genera to the first available above taxon, whatever that might be.

sqlite> select p.rank, c.rank, count(*) from taxon c, taxon p
   ...> where c.parent_id=p.id group by p.rank, c.rank order by c.rank;
0|1|488
1|2|348
2|3|229
1|5|26926

as you see: all families point to order, all subfamilies point to family, all tribes point to subfamily, but then genera point straight into family.

mfrasca commented 6 years ago

done it for 122 genera in the Orchid family.

sqlite> select p.rank, c.rank, count(*) from taxon c, taxon p 
   ...> where c.parent_id=p.id group by p.rank, c.rank order by c.rank;
0|1|488
1|2|348
2|3|242
3|4|51
1|5|26802
4|5|122
mfrasca commented 6 years ago

updating:

sqlite> select p.rank, c.rank, count(*) from taxon c, taxon p
   ...> where c.parent_id=p.id group by p.rank, c.rank order by c.rank;
0|1|490
1|2|355
2|3|243
3|4|48
1|5|26719
2|5|7
3|5|1
4|5|199