Project

General

Profile

Revision b0a24fbb

IDb0a24fbb99ff1988927a3127cc19306223fcd752
Parent 7ac506c5
Child 639e7a63

Added by Andreas Müller over 1 year ago

fix #7857 update name relationship type respresentations and symmetrie

View differences:

cdmlib-model/src/main/resources/terms/NameRelationshipType.csv
1 1
"6878cb82-c1a4-4613-b012-7e73b413c8cd",,"Name Relationship Type","Name Relationship Type","NRT","0"
2
"eeaea868-c4c1-497f-b9fe-52c9fc4aca53",,"orthographic variant for","orthographic variant for","","has orthographic variant","has orthographic variant","",TRUE,TRUE
3
"264d2be4-e378-4168-9760-a9512ffbddc4",,"original spelling for","original spelling for","","has original spelling","has original spelling","",FALSE,FALSE
4
"c6f9afcb-8287-4a2b-a6f6-4da3a073d5de",,"misspelling for","misspelling for","","has misspelling","has misspelling","",TRUE,TRUE
5
"6e23ad45-3f2a-462b-ad87-d2389cd6e26c",,"has emendation","has emendation","","emendation for","emendation for","",TRUE,TRUE
6
"80f06f65-58e0-4209-b811-cb40ad7220a6",,"later homonym for","later homonym for","","is earlier homonym for","is earlier homonym for","",FALSE,TRUE
7
"2990a884-3302-4c8b-90b2-dfd31aaa2778",,"treated as later homonym for","treated as later homonym for","","is treated as earlier homonym for","is treated as earlier homonym for","",FALSE,FALSE
2
"eeaea868-c4c1-497f-b9fe-52c9fc4aca53",,"is orthographic variant for","is orthographic variant for","","has orthographic variant","has orthographic variant","",TRUE,TRUE
3
"264d2be4-e378-4168-9760-a9512ffbddc4",,"is original spelling for","is original spelling for","","has original spelling","has original spelling","",FALSE,FALSE
4
"c6f9afcb-8287-4a2b-a6f6-4da3a073d5de",,"is misspelling for","is misspelling for","","has misspelling","has misspelling","",TRUE,TRUE
5
"6e23ad45-3f2a-462b-ad87-d2389cd6e26c",,"has emendation","has emendation","","is emendation for","is emendation for","",TRUE,TRUE
6
"80f06f65-58e0-4209-b811-cb40ad7220a6",,"is later homonym for","is later homonym for","","is earlier homonym for","is earlier homonym for","",FALSE,TRUE
7
"2990a884-3302-4c8b-90b2-dfd31aaa2778",,"is treated as later homonym for","is treated as later homonym for","","is treated as earlier homonym for","is treated as earlier homonym for","",FALSE,FALSE
8 8
"29ab238d-598d-45b9-addd-003cf39ccc3e",,"is later isonym of","is later isonym of","","has earlier isonym","has earlier isonym","",FALSE,TRUE
9
"049c6358-1094-4765-9fae-c9972a0e7780",,"alternative name for","alternative name for","","has alternative name","has alternative name","",TRUE,TRUE
10
"25792738-98de-4762-bac1-8c156faded4a",,"basionym for","basionym for","","is new combination for","is new combination for","",FALSE,FALSE
11
"71c67c38-d162-445b-b0c2-7aba56106696",,"replaced synonym for","replaced synonym for","","is new name for","is new name for","",FALSE,FALSE
12
"e6439f95-bcac-4ebb-a8b5-69fa5ce79e6a",,"conserved against","conserved against","","is rejected in favour of","is rejected in favour of","",FALSE,FALSE
13
"a176c9ad-b4c2-4c57-addd-90373f8270eb",,"validated by","validated by","","is validating","is validating","",FALSE,FALSE
14
"a25ee4c1-863a-4dab-9499-290bf9b89639",,"later validated by","later validated by","","is later validating","is later validating","",FALSE,FALSE
15
"1dab357f-2e12-4511-97a4-e5153589e6a6",,"blocking name for","blocking name for","","is new combination blocked by","is new combination blocked by","",FALSE,FALSE
9
"049c6358-1094-4765-9fae-c9972a0e7780",,"is alternative name for","is alternative name for","","has alternative name","has alternative name","",TRUE,TRUE
10
"25792738-98de-4762-bac1-8c156faded4a",,"is basionym for","is basionym for","","is new combination for","is new combination for","",FALSE,FALSE
11
"71c67c38-d162-445b-b0c2-7aba56106696",,"is replaced synonym for","is replaced synonym for","","is new name for","is new name for","",FALSE,FALSE
12
"e6439f95-bcac-4ebb-a8b5-69fa5ce79e6a",,"is conserved against","is conserved against","","is rejected in favour of","is rejected in favour of","",FALSE,FALSE
13
"a176c9ad-b4c2-4c57-addd-90373f8270eb",,"is validated by","is validated by","","is validating","is validating","",FALSE,FALSE
14
"a25ee4c1-863a-4dab-9499-290bf9b89639",,"is later validated by","is later validated by","","is later validating","is later validating","",FALSE,FALSE
15
"1dab357f-2e12-4511-97a4-e5153589e6a6",,"is blocking name for","is blocking name for","","is new combination blocked by","is new combination blocked by","",FALSE,FALSE
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/TermRepresentationUpdater.java
31 31
	private static final Logger logger = Logger.getLogger(TermRepresentationUpdater.class);
32 32

  
33 33
	public static final TermRepresentationUpdater NewInstance(String stepName, UUID uuidTerm, String description,  String label, String abbrev, UUID uuidLanguage){
34
		return new TermRepresentationUpdater(stepName, uuidTerm, description, label, abbrev, uuidLanguage, false);
34
		return new TermRepresentationUpdater(stepName, uuidTerm, description, label, abbrev, uuidLanguage, false, false);
35 35
	}
36
    public static final TermRepresentationUpdater NewInstanceWithTitleCache(String stepName, UUID uuidTerm, String description,  String label, String abbrev, UUID uuidLanguage){
37
        return new TermRepresentationUpdater(stepName, uuidTerm, description, label, abbrev, uuidLanguage, false, true);
38
    }
36 39

  
37 40
	public static final TermRepresentationUpdater NewReverseInstance(String stepName, UUID uuidTerm, String description,  String label, String abbrev, UUID uuidLanguage){
38
		return new TermRepresentationUpdater(stepName, uuidTerm, description, label, abbrev, uuidLanguage, true);
41
		return new TermRepresentationUpdater(stepName, uuidTerm, description, label, abbrev, uuidLanguage, true, false);
39 42
	}
40 43

  
41 44
	private UUID uuidTerm ;
......
44 47
	private String abbrev;
45 48
	private UUID uuidLanguage;
46 49
	private boolean isReverse = false;
50
	private boolean includeTitleCache = false;
47 51

  
48
	private TermRepresentationUpdater(String stepName, UUID uuidTerm, String description, String label, String abbrev, UUID uuidLanguage, boolean isReverse) {
52
	private TermRepresentationUpdater(String stepName, UUID uuidTerm, String description, String label, String abbrev, UUID uuidLanguage, boolean isReverse, boolean includeTitleCache) {
49 53
		super(stepName);
50 54
		this.abbrev = abbrev;
51 55
		this.description = description;
......
53 57
		this.uuidTerm = uuidTerm;
54 58
		this.uuidLanguage = uuidLanguage;
55 59
		this.isReverse = isReverse;
60
		this.includeTitleCache = includeTitleCache;
56 61
	}
57 62

  
58

  
59

  
60 63
	@Override
61 64
    public void invoke(ICdmDataSource datasource, IProgressMonitor monitor,
62 65
            CaseType caseType, SchemaUpdateResult result) throws SQLException{
......
108 111
			datasource.executeUpdate(sqlUpdateRepresentation);
109 112
		}
110 113

  
114
		if (includeTitleCache && label != null){
115
		    String sql = "UPDATE '%s' SET titleCache = '%s' WHERE uuid = '%s'";
116
		    sql = String.format(sql, caseType.transformTo("DefinedTermBase"), label, uuidTerm);
117
		    datasource.executeUpdate(sql);
118
		}
119

  
111 120
		return;
112 121
	}
113 122

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_51/SchemaUpdater_50_55.java
11 11

  
12 12
import java.util.ArrayList;
13 13
import java.util.List;
14
import java.util.UUID;
14 15

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

  
......
21 22
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
22 23
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
23 24
import eu.etaxonomy.cdm.database.update.SimpleSchemaUpdaterStep;
25
import eu.etaxonomy.cdm.database.update.TermRepresentationUpdater;
24 26
import eu.etaxonomy.cdm.database.update.v47_50.SchemaUpdater_47_50;
25 27

  
26 28
/**
......
101 103
                columnName, columnName, INCLUDE_AUDIT);
102 104
        stepList.add(step);
103 105

  
106
        //7857 update name realtionships
107
        updateNameRelationships(stepList);
108

  
104 109
        return stepList;
105 110

  
106 111
	}
107 112

  
108 113

  
114
	//7857 update name realtionships
115
    private void updateNameRelationships(List<ISchemaUpdaterStep> stepList) {
116

  
117
        //7857 Update symmetrical for name relationships
118
        String stepName = "Update symmetrical for name relationships";
119
        String query = "UPDATE @@DefinedTermBase@@ "
120
                + " SET symmetrical=0 "
121
                + " WHERE uuid IN ('049c6358-1094-4765-9fae-c9972a0e7780', '6e23ad45-3f2a-462b-ad87-d2389cd6e26c', "
122
                + " 'c6f9afcb-8287-4a2b-a6f6-4da3a073d5de', 'eeaea868-c4c1-497f-b9fe-52c9fc4aca53') ";
123
        String tableName = "DefinedTermBase";
124
        ISchemaUpdaterStep step = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, tableName, -99);
125
        stepList.add(step);
126

  
127
        //orthographic variant for
128
        stepName = "orthographic variant for => is orthographic variant for";
129
        UUID uuidTerm = UUID.fromString("eeaea868-c4c1-497f-b9fe-52c9fc4aca53");
130
        UUID uuidLanguage = UUID.fromString("e9f8cdb7-6819-44e8-95d3-e2d0690c3523");
131
        String label = "is orthographic variant for";
132
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
133
                label, label, null, uuidLanguage);
134
        stepList.add(step);
135

  
136
        //original spelling for
137
        stepName = "original spelling for => is original spelling for";
138
        uuidTerm = UUID.fromString("264d2be4-e378-4168-9760-a9512ffbddc4");
139
        label = "is original spelling for";
140
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
141
                label, label, null, uuidLanguage);
142
        stepList.add(step);
143

  
144
        //misspelling for
145
        stepName = "misspelling for => is misspelling for";
146
        uuidTerm = UUID.fromString("c6f9afcb-8287-4a2b-a6f6-4da3a073d5de");
147
        label = "is misspelling for";
148
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
149
                label, label, null, uuidLanguage);
150
        stepList.add(step);
151

  
152
        //later homonym for
153
        stepName = "later homonym for => is later homonym for";
154
        uuidTerm = UUID.fromString("80f06f65-58e0-4209-b811-cb40ad7220a6");
155
        label = "is later homonym for";
156
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
157
                label, label, null, uuidLanguage);
158
        stepList.add(step);
159

  
160
        //treated as later homonym for
161
        stepName = " => is treated as later homonym for";
162
        uuidTerm = UUID.fromString("2990a884-3302-4c8b-90b2-dfd31aaa2778");
163
        label = "is treated as later homonym for";
164
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
165
                label, label, null, uuidLanguage);
166
        stepList.add(step);
167

  
168
        //alternative name for
169
        stepName = "alternative name for => is alternative name for";
170
        uuidTerm = UUID.fromString("049c6358-1094-4765-9fae-c9972a0e7780");
171
        label = "is alternative name for";
172
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
173
                label, label, null, uuidLanguage);
174
        stepList.add(step);
175

  
176
        //basionym for
177
        stepName = "basionym for => is basionym for";
178
        uuidTerm = UUID.fromString("25792738-98de-4762-bac1-8c156faded4a");
179
        label = "is basionym for";
180
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
181
                label, label, null, uuidLanguage);
182
        stepList.add(step);
183

  
184
        //replaced synonym for
185
        stepName = "replaced synonym for => is replaced synonym for";
186
        uuidTerm = UUID.fromString("71c67c38-d162-445b-b0c2-7aba56106696");
187
        label = "is replaced synonym for";
188
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
189
                label, label, null, uuidLanguage);
190
        stepList.add(step);
191

  
192
        //conserved against
193
        stepName = "conserved against => is conserved against";
194
        uuidTerm = UUID.fromString("e6439f95-bcac-4ebb-a8b5-69fa5ce79e6a");
195
        label = "is conserved against";
196
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
197
                label, label, null, uuidLanguage);
198
        stepList.add(step);
199

  
200
        //validated by
201
        stepName = "validated by => is validated by";
202
        uuidTerm = UUID.fromString("a176c9ad-b4c2-4c57-addd-90373f8270eb");
203
        label = "is validated by";
204
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
205
                label, label, null, uuidLanguage);
206
        stepList.add(step);
207

  
208
        //later validated by
209
        stepName = "later validated by => is later validated by";
210
        uuidTerm = UUID.fromString("a25ee4c1-863a-4dab-9499-290bf9b89639");
211
        label = "is later validated by";
212
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
213
                label, label, null, uuidLanguage);
214
        stepList.add(step);
215

  
216
        //blocking name for
217
        stepName = "blocking name for => is blocking name for";
218
        uuidTerm = UUID.fromString("1dab357f-2e12-4511-97a4-e5153589e6a6");
219
        label = "blocking name for";
220
        step = TermRepresentationUpdater.NewInstanceWithTitleCache(stepName, uuidTerm,
221
                label, label, null, uuidLanguage);
222
        stepList.add(step);
223

  
224
        //emendation for
225
        stepName = "emendation for => is emendation for";
226
        uuidTerm = UUID.fromString("6e23ad45-3f2a-462b-ad87-d2389cd6e26c");
227
        label = "is emendation for";
228
        step = TermRepresentationUpdater.NewReverseInstance(stepName, uuidTerm,
229
                label, label, null, uuidLanguage);
230
        stepList.add(step);
231
    }
232

  
109 233
    @Override
110 234
	public ISchemaUpdater getNextUpdater() {
111 235
		return null;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)