Project

General

Profile

« Previous | Next » 

Revision 8a133607

Added by Andreas Müller over 4 years ago

ref #1444, ref #8508 add Monera filter handling in ERMS validation and for import

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsTaxonImport.java
80 80

  
81 81
	@Override
82 82
	protected String getIdQuery() {
83
		String strQuery = " SELECT id FROM tu WHERE id NOT IN (147415) " ;  //for now we exclude Monera as it has no children and is unclear what classification it has. In ERMS it is alternative accepted name, but according to https://en.wikipedia.org/wiki/Monera it is a super taxon to bacteria.
83
		String strQuery = " SELECT id FROM tu " ;  //WHERE id NOT IN (147415) for now we exclude Monera as it has no children and is unclear what classification it has. In ERMS it is alternative accepted name (in https://en.wikipedia.org/wiki/Monera it might be a super taxon to bacteria).
84 84
		return strQuery;
85 85
	}
86 86

  
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/validation/PesiErmsValidator.java
36 36

  
37 37
    private Source source = defaultSource;
38 38
    private Source destination = defaultDestination;
39
    private String moneraFilter = " NOT IN (-1)"; // 147415;
39 40

  
40 41
    private String origErms = "OriginalDB = 'ERMS' ";
41 42

  
......
123 124
        return success;
124 125
    }
125 126

  
126
    private final String countAddtionalTaxonSource = "SELECT count(*) FROM tu_sources ts WHERE ts.tu_id <>  147415 ";
127
    private final String countAddtionalTaxonSource = "SELECT count(*) FROM tu_sources ts WHERE ts.tu_id " + moneraFilter;
127 128
    private boolean testAdditionalTaxonSourcesCount() {
128 129
        int countSrc = source.getUniqueInteger(countAddtionalTaxonSource);
129 130
        int countDest = destination.getUniqueInteger("SELECT count(*) FROM AdditionalTaxonSource ");
......
138 139

  
139 140
        countSrc = source.getUniqueInteger("SELECT count(*) FROM tu "
140 141
                + " WHERE (tu_marine IS NOT NULL OR tu_brackish IS NOT NULL OR tu_fresh IS NOT NULL OR tu_terrestrial IS NOT NULL) "
141
                + "     AND tu.id <>  147415 ");
142
                + "     AND tu.id " + moneraFilter );
142 143
        countDest = destination.getUniqueInteger("SELECT count(*) FROM Note "
143 144
                + " WHERE (NoteCategoryFk = 4 AND LastAction IS NULL) ");
144 145
        result &= equals("Notes ecology count ", countSrc, countDest, String.valueOf(-1));
......
163 164
        return equals("CommonName count ", countSrc, countDest, String.valueOf(-1));
164 165
    }
165 166

  
166
    private final String countTaxonRelation = "SELECT count(*) FROM tu WHERE  tu_acctaxon <> id AND id NOT IN (147415) ";
167
    private final String countTaxonRelation = "SELECT count(*) FROM tu WHERE  tu_acctaxon <> id AND id " + moneraFilter;
167 168
    private boolean testTaxonRelationCount() {
168 169
         int countSrc = source.getUniqueInteger(countTaxonRelation);
169 170
         int countDest = destination.getUniqueInteger("SELECT count(*) FROM RelTaxon ");
......
171 172
     }
172 173

  
173 174

  
174
    private final String countTaxon = "SELECT count(*) FROM tu WHERE id NOT IN (147415)";
175
    private final String countTaxon = "SELECT count(*) FROM tu WHERE id " + moneraFilter;
175 176
    private boolean testTaxaCount() {
176 177
         int countSrc = source.getUniqueInteger(countTaxon);
177 178
         int countDest = destination.getUniqueInteger("SELECT count(*) FROM Taxon ");
......
192 193
                + " LEFT JOIN tu type ON type.id = t.tu_typetaxon "
193 194
                + " LEFT JOIN fossil fo ON t.tu_fossil = fo.fossil_id "
194 195
                + " LEFT JOIN qualitystatus qs ON t.tu_qualitystatus = qs.id "
195
                + " WHERE t.id NOT IN (147415) "
196
                + " WHERE t.id " + moneraFilter
196 197
                + " ORDER BY CAST(t.id as nvarchar(20)) ");
197 198
        ResultSet destRS = destination.getResultSet("SELECT t.*, "
198 199
                + "     pt.GenusOrUninomial p_GenusOrUninomial, pt.InfraGenericEpithet p_InfraGenericEpithet, pt.SpecificEpithet p_SpecificEpithet, "
......
403 404
        ResultSet srcRS = source.getResultSet(""
404 405
                + " SELECT t.* "
405 406
                + " FROM tu t "
406
                + " WHERE t.id NOT IN (147415) AND tu_acctaxon <> id "
407
                + " WHERE t.id "+ moneraFilter + " AND tu_acctaxon <> id "
407 408
                + " ORDER BY CAST(t.id as nvarchar(20)) ");
408 409
        ResultSet destRS = destination.getResultSet("SELECT rel.*, t1.IdInSource t1Id, t2.IdInSource t2Id "
409 410
                + " FROM RelTaxon rel "
......
438 439
                + " FROM tu_sources MN INNER JOIN tu ON MN.tu_id = tu.id "
439 440
                + "    LEFT JOIN sources s ON s.id = MN.source_id "
440 441
                + "    LEFT JOIN sourceuses su ON MN.sourceuse_id = su.sourceuse_id "
441
                + " WHERE MN.tu_id NOT IN (147415)  "
442
                + " WHERE MN.tu_id  " + moneraFilter
442 443
                + " ORDER BY CAST(tu.id as nvarchar(20)), MN.sourceuse_id, s.id ");  //, no.note (not possible because ntext
443 444
        ResultSet destRs = destination.getResultSet("SELECT t.IdInSource, ats.*, s.*, su.* "
444 445
                + " FROM AdditionalTaxonSource ats INNER JOIN Taxon t ON t.TaxonId = ats.TaxonFk "

Also available in: Unified diff