Project

General

Profile

« Previous | Next » 

Revision deeccd97

Added by Andreas Kohlbecker over 8 years ago

better detection of synonyms to avoid adding the accepted taxon as its own synonym

View differences:

src/main/java/org/cybertaxonomy/utis/checklist/EEA_BDC_Client.java
303 303
                    .toList();
304 304
            for(Vertex tv : titleVs) {
305 305
                Source source = new Source();
306
                logger.error(tv.toString());
306
                logger.debug(tv.toString());
307 307
                source.setName(tv.getProperty(GraphSail.VALUE).toString());
308 308
                taxonBase.getSources().add(source);
309 309
            }
......
337 337
                    .inE(RdfSchema.EUNIS_SPECIES.property("eunisPrimaryName")).outV().dedup()
338 338
                    .toList();
339 339
            for(Vertex synonymV : synonymVs) {
340
                String typeUri = queryClient.relatedVertexValue(synonymV, RdfSchema.RDF, "type");
341
                String status = null;
342
                try {
343
                    status = URI.create(typeUri).getFragment();
344
                } catch (Exception e) {
340
                // http://www.w3.org/1999/02/22-rdf-syntax-ns#type is used inconsistently, accepted taxa can have type SpeciesSynonym
341
                // and are their own synonym in this case !
342
                // using http://eunis.eea.europa.eu/rdf/species-schema.rdf#taxonomicRank is the recommended way to detect synonyms and to avoid
343
                // adding the accepted taxon as its own synonym
344
                String taxonomicRank = queryClient.relatedVertexValue(synonymV, RdfSchema.EUNIS_SPECIES, "taxonomicRank");
345 345

  
346
                }
347 346

  
348
                if (status != null && status.equals("SpeciesSynonym")) {
347
                if (taxonomicRank != null && taxonomicRank.equals("Synonym")) {
349 348

  
350 349
                    Synonym synonym = new Synonym();
351 350

  
352 351
                    TaxonName taxonName = createTaxonName(synonymV);
353
                    synonym.setTaxonomicStatus(status);
352
                    synonym.setTaxonomicStatus(taxonomicRank);
353
                    synonym.setUrl(synonymV.getProperty(GraphSail.VALUE).toString());
354 354
                    synonym.setTaxonName(taxonName);
355 355
                    synonym.setAccordingTo(queryClient.relatedVertexValue(synonymV, RdfSchema.DWC, "nameAccordingToID"));
356 356

  

Also available in: Unified diff