예제 #1
0
파일: tx.sync.go 프로젝트: js-arias/jdh
func txSyncPopDesc(c *cmdapp.Command, l jdh.ListScanner, p *jdh.Taxon) {
	pId := p.Id
	if !p.IsValid {
		pId = p.Parent
	}
	for {
		desc := &jdh.Taxon{}
		if err := l.Scan(desc); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		// check if the taxon is in the database
		if d := taxon(c, localDB, extDBFlag+":"+desc.Id); len(d.Id) != 0 {
			continue
		}
		// adds the new taxon
		tax := &jdh.Taxon{}
		*tax = *desc
		tax.Id = ""
		tax.Parent = pId
		tax.Extern = []string{extDBFlag + ":" + desc.Id}
		if _, err := localDB.Exec(jdh.Add, jdh.Taxonomy, tax); err != nil {
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
	}
}
예제 #2
0
파일: sp.gref.go 프로젝트: js-arias/jdh
func spGrefNav(c *cmdapp.Command, l jdh.ListScanner, gzt geography.Gazetter) {
	for {
		desc := &jdh.Taxon{}
		if err := l.Scan(desc); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		spGrefProc(c, desc, gzt)
	}
}
예제 #3
0
파일: ra.mk.go 프로젝트: js-arias/jdh
func raMkNav(c *cmdapp.Command, l jdh.ListScanner, spDB jdh.DB, prevRank, rank jdh.Rank, size float64) {
	for {
		desc := &jdh.Taxon{}
		if err := l.Scan(desc); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		raMkFetch(c, spDB, desc, prevRank, rank, size)
	}
}
예제 #4
0
파일: sp.pop.go 프로젝트: js-arias/jdh
func spPopNav(c *cmdapp.Command, l jdh.ListScanner, prevRank, rank jdh.Rank) {
	for {
		desc := &jdh.Taxon{}
		if err := l.Scan(desc); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		spPopFetch(c, desc, prevRank, rank)
	}
}
예제 #5
0
파일: tx.sync.go 프로젝트: js-arias/jdh
func txSyncRankNav(c *cmdapp.Command, l jdh.ListScanner, rank jdh.Rank) {
	for {
		desc := &jdh.Taxon{}
		if err := l.Scan(desc); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		txSyncRankSet(c, desc, rank)
	}
}
예제 #6
0
파일: tx.ls.go 프로젝트: js-arias/jdh
func txLsProc(c *cmdapp.Command, l jdh.ListScanner) {
	for {
		tax := &jdh.Taxon{}
		if err := l.Scan(tax); err != nil {
			if err == io.EOF {
				break
			}
			fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err))
			os.Exit(1)
		}
		if machineFlag {
			fmt.Fprintf(os.Stdout, "%s\n", tax.Id)
			continue
		}
		if verboseFlag {
			fmt.Fprintf(os.Stdout, "%s\t%s\t%s %s\t\n", tax.Id, tax.Rank, tax.Name, tax.Authority)
			continue
		}
		fmt.Fprintf(os.Stdout, "%s %s\n", tax.Name, tax.Authority)
	}
}