String oldTaxonID = rec.get("tID");
Taxon t = taxon.get(oldTaxonID);
TaxonVariant tv = knownTaxonVariant.get(oldID);
if (tv == null) {
warn("File calls for missing taxonVariant with TB1id=" + oldID + ", oldID " + oldID);
continue;
}
if (oldTaxonID == null) {
if (tv.getTaxon() != null)
warn("TB1id=" + oldID + ", Tv" + tv.getId() + " should have no taxon, but does");
} else {
if (t == null) {
if (tv.getTaxon() != null)
warn("TaxonVariant " + oldID + " calls for taxon " + rec.get("tID") + " which is missing from the DB");
} else {
if (tv.getTaxon() == null)
warn("TaxonVariant " + oldID + " should link to taxon " + rec.get("tID") + " (T" + t.getId() + ") but links to none");
else if (! tv.getTaxon().getId().equals(t.getId()))
warn("TaxonVariant " + oldID + " should link to taxon " + rec.get("tID") + " (T" + t.getId() + ") but links to T" + tv.getTaxon().getId() + " instead");
}
}
{
String nameString = rec.get("nameString");
if (nameString == null && tv.getName() != null)
warn("TB1id=" + oldID + " should have no name, but Tv" + tv.getId() + " has " + tv.getName());
else if (nameString != null && tv.getName() == null)
warn("TB1id=" + oldID + " should have name " + nameString + " but Tv" + tv.getId() + " has none");
else if (nameString != null && tv.getName() != null)
if (! nameString.equals(tv.getName()))
warn("File says TB1id=" + oldID + " Tv" + tv.getId() + " should have name " + nameString + " but it has " + tv.getName());
}
{
String lexQualF = rec.get("lexQual"), lexQualDB = tv.getLexicalQualifier();
if (lexQualDB.equals("")) lexQualDB = null;
if (lexQualF.equals("")) lexQualF = null;
if (lexQualF == null && lexQualDB != null)
warn("TB1id=" + oldID + " should have no LQ, but Tv" + tv.getId() + " has " + lexQualDB);
else if (lexQualF != null && lexQualDB == null)
warn("TB1id=" + oldID + " should have LQ " + lexQualF + " but Tv" + tv.getId() + " has none");
else if (lexQualF != null && lexQualDB != null)
if (! lexQualF.equals(lexQualDB))
warn("File says TB1id=" + oldID + " Tv" + tv.getId() + " should have LQ " + lexQualF + " but it has " + lexQualDB);
}
{
Long uBioId;
{
String uBioIdString = rec.get("uBIO");
uBioId = uBioIdString.equals("") ? null : Long.decode(uBioIdString);
}
if (uBioId == null && tv.getNamebankID() != null)
warn("TB1id=" + oldID + " should have no name, but Tv" + tv.getId() + " has " + tv.getNamebankID());
else if (uBioId != null && tv.getNamebankID() == null)
warn("TB1id=" + oldID + " should have name " + uBioId + " but Tv" + tv.getId() + " has none");
else if (uBioId != null && tv.getNamebankID() != null)
if (! uBioId.equals(tv.getNamebankID()))
warn("File says TB1id=" + oldID + " Tv" + tv.getId() + " should have name " + uBioId + " but it has " + tv.getNamebankID());
}
taxonVariant.put(oldID, tv);
knownTaxonVariant.remove(oldID);
}