Project

General

Profile

Revision 1634067b

ID1634067bc95e86bcaea6c464ed6d34ffaede354d
Parent 6f5a0cd4
Child 84bbc7d1

Added by Andreas Müller 6 months ago

ref #7514 update misapplied name symbols & add tests

View differences:

cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/UTF8.java
13 13

  
14 14

  
15 15
	EN_DASH("\u2013"),   // https://de.wikipedia.org/wiki/Halbgeviertstrich
16
	EM_DASH("\u2014"),   // https://de.wikipedia.org/wiki/Geviertstrich
17
	EM_DASH_DOUBLE("\u2E3A"),   //https://de.wikipedia.org/wiki/Doppelgeviertstrich
16 18
	SPATIUM("\u202F"),   //very short non-breaking space
17 19
	EN_DASH_SPATIUM("\u202F\u2013\u202F"),
18 20
	HYBRID ("\u00D7"),   // hybrid sign
cdmlib-model/src/main/resources/terms/TaxonRelationshipType.csv
1 1
"15db0cf7-7afc-4a86-a7d4-221c73b0c9ac",,"Taxon Relationship Type","Taxon Relationship Type","TRT","1"
2 2
"d13fecdf-eb44-4dd7-9244-26679c05df1c",,"is taxonomically included in","is taxonomically included in","⊂","taxonomically includes","taxonomically includes","⊃",FALSE,TRUE
3
"1ed87175-59dd-437e-959e-0d71583d8417",,"is misapplied name for","is misapplied name for","––","has misapplied name","has misapplied name","–",FALSE,FALSE
4
"b59b4bd2-11ff-45d1-bae2-146efdeee206",,"is pro parte misapplied name for","is pro parte misapplied name for","––(p.p.)","has pro parte misapplied name","has pro parte misapplied name","-(p.p.)",FALSE,FALSE
5
"859fb615-b0e8-440b-866e-8a19f493cd36",,"is partial misapplied name for","is partial misapplied name for","––(part.)","has partial misapplied name","has partial misapplied name","-(part.)",FALSE,FALSE
3
"1ed87175-59dd-437e-959e-0d71583d8417",,"is misapplied name for","is misapplied name for","⸺","has misapplied name","has misapplied name","—",FALSE,FALSE
4
"b59b4bd2-11ff-45d1-bae2-146efdeee206",,"is pro parte misapplied name for","is pro parte misapplied name for","⸺(p.p.)","has pro parte misapplied name","has pro parte misapplied name","—(p.p.)",FALSE,FALSE
5
"859fb615-b0e8-440b-866e-8a19f493cd36",,"is partial misapplied name for","is partial misapplied name for","⸺(part.)","has partial misapplied name","has partial misapplied name","—(part.)",FALSE,FALSE
6 6
"605b1d01-f2b1-4544-b2e0-6f08def3d6ed",,"is invalid designation for","is invalid designation for","–","has invalid designation","has invalid designation",,FALSE,FALSE
7 7
"8a896603-0fa3-44c6-9cd7-df2d8792e577",,"is pro parte synonym for","is pro parte synonym for","⊃p.p.","has pro parte synonym","has pro parte synonym","p.p.",FALSE,FALSE
8 8
"9d7a5e56-973c-474c-b6c3-a1cb00833a3c",,"is partial synonym for","is partial synonym for","⊃part.","has partial synonym","has partial synonym","part.",FALSE,FALSE
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationshipTypeTest.java
1
/**
2
* Copyright (C) 2019 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.model.taxon;
10

  
11
import org.junit.Assert;
12
import org.junit.Before;
13
import org.junit.BeforeClass;
14
import org.junit.Test;
15

  
16
import eu.etaxonomy.cdm.common.UTF8;
17
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
18
import eu.etaxonomy.cdm.model.common.Language;
19

  
20
/**
21
 * @author a.mueller
22
 * @since 26.02.2019
23
 *
24
 */
25
public class TaxonRelationshipTypeTest {
26

  
27
    @BeforeClass
28
    public static void setUpBeforeClass() throws Exception {
29
        if (Language.ENGLISH() == null){
30
            new DefaultTermInitializer().initialize();
31
        }
32
    }
33

  
34
    @Before
35
    public void setUp() throws Exception {
36
    }
37

  
38
    @Test
39
    public void testRepresentations() {
40
        //these tests mostly test that UTF8 symbols have not bee manipulated in the csv files by encoding changes.
41
        //They are not meant for defining correct symbols over long time. Many of the symbols are not finally discussed.
42

  
43
        //MISAPPLIED_NAME_FOR
44
        TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
45
        Assert.assertEquals(UTF8.EM_DASH.toString(), inverseAbbrev(type));
46
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE.toString(), abbrev(type));
47

  
48
        //PRO PARTE MISAPPLIED_NAME_FOR
49
        type = TaxonRelationshipType.PRO_PARTE_MISAPPLIED_NAME_FOR();
50
        Assert.assertEquals(UTF8.EM_DASH + "(p.p.)", inverseAbbrev(type));
51
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE + "(p.p.)", abbrev(type));
52

  
53
        type = TaxonRelationshipType.PARTIAL_MISAPPLIED_NAME_FOR();
54
        Assert.assertEquals(UTF8.EM_DASH + "(part.)", inverseAbbrev(type));
55
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE + "(part.)", abbrev(type));
56

  
57
    }
58

  
59
    private String inverseAbbrev(TaxonRelationshipType relType) {
60
        return relType.getPreferredInverseRepresentation(null).getAbbreviatedLabel();
61
    }
62

  
63
    private String abbrev(TaxonRelationshipType relType) {
64
        return relType.getPreferredRepresentation((Language)null).getAbbreviatedLabel();
65
    }
66

  
67
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_55/SchemaUpdater_50_55.java
15 15

  
16 16
import org.apache.log4j.Logger;
17 17

  
18
import eu.etaxonomy.cdm.common.UTF8;
18 19
import eu.etaxonomy.cdm.database.update.ColumnAdder;
19 20
import eu.etaxonomy.cdm.database.update.ColumnNameChanger;
20 21
import eu.etaxonomy.cdm.database.update.ColumnRemover;
......
323 324
        //Update misapplied name symbols
324 325
        String stepName = "Update misapplied name symbols";
325 326
        String query = "UPDATE @@DefinedTermBase@@ "
326
                + " SET symbol='––' , inverseSymbol = '-' "
327
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"' , inverseSymbol = '"+UTF8.EM_DASH+"' "
327 328
                + " WHERE uuid = '1ed87175-59dd-437e-959e-0d71583d8417' ";
328 329
        String tableName = "DefinedTermBase";
329 330
        ISchemaUpdaterStep step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
......
332 333
        //Update pro parte misapplied name symbols
333 334
        stepName = "Update pro parte misapplied name symbols";
334 335
        query = "UPDATE @@DefinedTermBase@@ "
335
                + " SET symbol='––(p.p.)' , inverseSymbol = '-(p.p.)' "
336
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"(p.p.)' , inverseSymbol = '"+UTF8.EM_DASH+"(p.p.)' "
336 337
                + " WHERE uuid = 'b59b4bd2-11ff-45d1-bae2-146efdeee206' ";
337 338
        tableName = "DefinedTermBase";
338 339
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
......
341 342
        //Update partial misapplied name symbols
342 343
        stepName = "Update partial misapplied name symbols";
343 344
        query = "UPDATE @@DefinedTermBase@@ "
344
                + " SET symbol='––(part.)' , inverseSymbol = '-(part.)' "
345
                + " SET symbol='"+UTF8.EM_DASH_DOUBLE+"(part.)' , inverseSymbol = '"+UTF8.EM_DASH+"(part.)' "
345 346
                + " WHERE uuid = '859fb615-b0e8-440b-866e-8a19f493cd36' ";
346 347
        tableName = "DefinedTermBase";
347 348
        step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)